mirror of
https://gitlab.com/ita1024/waf.git
synced 2024-11-22 01:46:15 +01:00
Argparse updates
This commit is contained in:
parent
4d0edd113a
commit
149102f11f
@ -25,7 +25,7 @@ import random, bz2, os, threading
|
||||
lock = threading.Lock()
|
||||
|
||||
def options(opt):
|
||||
opt.add_option('--num', action='store', type='int', default=200, help='amount of compressed files to create')
|
||||
opt.add_option('--num', action='store', type=int, default=200, help='amount of compressed files to create')
|
||||
|
||||
# values for storing the min and max
|
||||
gzip = [10000000, 0]
|
||||
|
@ -5,7 +5,7 @@
|
||||
# this may be useful for link tasks for example
|
||||
|
||||
def options(opt):
|
||||
opt.add_option('--loops', action='store', type='int', default=5, help='amount of cpu-intensive loops to perform')
|
||||
opt.add_option('--loops', action='store', type=int, default=5, help='amount of cpu-intensive loops to perform')
|
||||
|
||||
def configure(conf):
|
||||
busy = conf.path.find_node('look_busy.py').abspath()
|
||||
|
@ -210,9 +210,12 @@ class OptionsContext(Context.Context):
|
||||
return count
|
||||
|
||||
def add_option(self, *k, **kw):
|
||||
if 'type' in kw and kw['type'] == 'int':
|
||||
if 'type' in kw and type(kw['type']) == str:
|
||||
Logs.warn('Invalid "type=str" in add_option (must be a class, not a string)')
|
||||
kw['type'] = int
|
||||
if kw['type'] == 'int':
|
||||
kw['type'] = int
|
||||
elif kw['type'] == 'string':
|
||||
kw['type'] = str
|
||||
return self.add_argument(*k, **kw)
|
||||
|
||||
def add_argument(self, *k, **kw):
|
||||
|
@ -179,7 +179,7 @@ def options(opt):
|
||||
|
||||
$ waf configure --with-csc-binary=/foo/bar/mcs
|
||||
"""
|
||||
opt.add_option('--with-csc-binary', type='string', dest='cscbinary')
|
||||
opt.add_option('--with-csc-binary', type=str, dest='cscbinary')
|
||||
|
||||
class fake_csshlib(Task.Task):
|
||||
"""
|
||||
|
@ -99,8 +99,8 @@ def options(opt):
|
||||
m = re.match(r'(^\d+\.\d+).*', vsver)
|
||||
if m:
|
||||
default_ver = 'msvc %s' % m.group(1)
|
||||
opt.add_option('--msvc_version', type='string', help = 'msvc version, eg: "msvc 10.0,msvc 9.0"', default=default_ver)
|
||||
opt.add_option('--msvc_targets', type='string', help = 'msvc targets, eg: "x64,arm"', default='')
|
||||
opt.add_option('--msvc_version', type=str, help = 'msvc version, eg: "msvc 10.0,msvc 9.0"', default=default_ver)
|
||||
opt.add_option('--msvc_targets', type=str, help = 'msvc targets, eg: "x64,arm"', default='')
|
||||
opt.add_option('--no-msvc-lazy', action='store_false', help = 'lazily check msvc target environments', default=True, dest='msvc_lazy')
|
||||
|
||||
class MSVCVersion(object):
|
||||
|
@ -151,6 +151,6 @@ def options(opt):
|
||||
"""
|
||||
Add the ``--with-perl-archdir`` and ``--with-perl-binary`` command-line options.
|
||||
"""
|
||||
opt.add_option('--with-perl-binary', type='string', dest='perlbinary', help = 'Specify alternate perl binary', default=None)
|
||||
opt.add_option('--with-perl-archdir', type='string', dest='perlarchdir', help = 'Specify directory where to install arch specific files', default=None)
|
||||
opt.add_option('--with-perl-binary', type=str, dest='perlbinary', help = 'Specify alternate perl binary', default=None)
|
||||
opt.add_option('--with-perl-archdir', type=str, dest='perlarchdir', help = 'Specify directory where to install arch specific files', default=None)
|
||||
|
||||
|
@ -889,8 +889,8 @@ def options(opt):
|
||||
"""
|
||||
opt.add_option('--want-rpath', action='store_true', default=False, dest='want_rpath', help='enable the rpath for qt libraries')
|
||||
for i in 'qtdir qtbin qtlibs'.split():
|
||||
opt.add_option('--'+i, type='string', default='', dest=i)
|
||||
opt.add_option('--'+i, type=str, default='', dest=i)
|
||||
|
||||
opt.add_option('--translate', action='store_true', help='collect translation strings', dest='trans_qt5', default=False)
|
||||
opt.add_option('--qtextralibs', type='string', default='', dest='qtextralibs', help='additional qt libraries on the system to add to default ones, comma separated')
|
||||
opt.add_option('--qtextralibs', type=str, default='', dest='qtextralibs', help='additional qt libraries on the system to add to default ones, comma separated')
|
||||
|
||||
|
@ -180,7 +180,7 @@ def options(opt):
|
||||
"""
|
||||
Add the ``--with-ruby-archdir``, ``--with-ruby-libdir`` and ``--with-ruby-binary`` options
|
||||
"""
|
||||
opt.add_option('--with-ruby-archdir', type='string', dest='rubyarchdir', help='Specify directory where to install arch specific files')
|
||||
opt.add_option('--with-ruby-libdir', type='string', dest='rubylibdir', help='Specify alternate ruby library path')
|
||||
opt.add_option('--with-ruby-binary', type='string', dest='rubybinary', help='Specify alternate ruby binary')
|
||||
opt.add_option('--with-ruby-archdir', type=str, dest='rubyarchdir', help='Specify directory where to install arch specific files')
|
||||
opt.add_option('--with-ruby-libdir', type=str, dest='rubylibdir', help='Specify alternate ruby library path')
|
||||
opt.add_option('--with-ruby-binary', type=str, dest='rubybinary', help='Specify alternate ruby binary')
|
||||
|
||||
|
@ -131,28 +131,28 @@ BOOST_TOOLSETS = {
|
||||
|
||||
def options(opt):
|
||||
opt = opt.add_option_group('Boost Options')
|
||||
opt.add_option('--boost-includes', type='string',
|
||||
opt.add_option('--boost-includes', type=str,
|
||||
default='', dest='boost_includes',
|
||||
help='''path to the directory where the boost includes are,
|
||||
e.g., /path/to/boost_1_55_0/stage/include''')
|
||||
opt.add_option('--boost-libs', type='string',
|
||||
opt.add_option('--boost-libs', type=str,
|
||||
default='', dest='boost_libs',
|
||||
help='''path to the directory where the boost libs are,
|
||||
e.g., path/to/boost_1_55_0/stage/lib''')
|
||||
opt.add_option('--boost-mt', action='store_true',
|
||||
default=False, dest='boost_mt',
|
||||
help='select multi-threaded libraries')
|
||||
opt.add_option('--boost-abi', type='string', default='', dest='boost_abi',
|
||||
opt.add_option('--boost-abi', type=str, default='', dest='boost_abi',
|
||||
help='''select libraries with tags (gd for debug, static is automatically added),
|
||||
see doc Boost, Getting Started, chapter 6.1''')
|
||||
opt.add_option('--boost-linkage_autodetect', action="store_true", dest='boost_linkage_autodetect',
|
||||
help="auto-detect boost linkage options (don't get used to it / might break other stuff)")
|
||||
opt.add_option('--boost-toolset', type='string',
|
||||
opt.add_option('--boost-toolset', type=str,
|
||||
default='', dest='boost_toolset',
|
||||
help='force a toolset e.g. msvc, vc90, \
|
||||
gcc, mingw, mgw45 (default: auto)')
|
||||
py_version = '%d%d' % (sys.version_info[0], sys.version_info[1])
|
||||
opt.add_option('--boost-python', type='string',
|
||||
opt.add_option('--boost-python', type=str,
|
||||
default=py_version, dest='boost_python',
|
||||
help='select the lib python with this version \
|
||||
(default: %s)' % py_version)
|
||||
|
12
waflib/extras/cpplint.py
vendored
12
waflib/extras/cpplint.py
vendored
@ -59,23 +59,23 @@ CPPLINT_STR = ('${CPPLINT} '
|
||||
|
||||
|
||||
def options(opt):
|
||||
opt.add_option('--cpplint-filters', type='string',
|
||||
opt.add_option('--cpplint-filters', type=str,
|
||||
default='', dest='CPPLINT_FILTERS',
|
||||
help='add filters to cpplint')
|
||||
opt.add_option('--cpplint-length', type='int',
|
||||
opt.add_option('--cpplint-length', type=int,
|
||||
default=80, dest='CPPLINT_LINE_LENGTH',
|
||||
help='specify the line length (default: 80)')
|
||||
opt.add_option('--cpplint-level', default=1, type='int', dest='CPPLINT_LEVEL',
|
||||
opt.add_option('--cpplint-level', default=1, type=int, dest='CPPLINT_LEVEL',
|
||||
help='specify the log level (default: 1)')
|
||||
opt.add_option('--cpplint-break', default=5, type='int', dest='CPPLINT_BREAK',
|
||||
opt.add_option('--cpplint-break', default=5, type=int, dest='CPPLINT_BREAK',
|
||||
help='break the build if error >= level (default: 5)')
|
||||
opt.add_option('--cpplint-root', type='string',
|
||||
opt.add_option('--cpplint-root', type=str,
|
||||
default='', dest='CPPLINT_ROOT',
|
||||
help='root directory used to derive header guard')
|
||||
opt.add_option('--cpplint-skip', action='store_true',
|
||||
default=False, dest='CPPLINT_SKIP',
|
||||
help='skip cpplint during build')
|
||||
opt.add_option('--cpplint-output', type='string',
|
||||
opt.add_option('--cpplint-output', type=str,
|
||||
default='waf', dest='CPPLINT_OUTPUT',
|
||||
help='select output format (waf, emacs, vs7, eclipse)')
|
||||
|
||||
|
@ -68,5 +68,5 @@ def options(opt):
|
||||
"""
|
||||
Add the ``--with-diab-bindir`` command-line options.
|
||||
"""
|
||||
opt.add_option('--with-diab-bindir', type='string', dest='diabbindir', help = 'Specify alternate diab bin folder', default="")
|
||||
opt.add_option('--with-diab-bindir', type=str, dest='diabbindir', help = 'Specify alternate diab bin folder', default="")
|
||||
|
||||
|
@ -32,7 +32,7 @@ from waflib.Configure import conf
|
||||
|
||||
|
||||
def options(opt):
|
||||
opt.add_option('--fi-path', type='string', default='', dest='fi_path',
|
||||
opt.add_option('--fi-path', type=str, default='', dest='fi_path',
|
||||
help='''path to the FreeImage directory \
|
||||
where the files are e.g. /FreeImage/Dist''')
|
||||
opt.add_option('--fip', action='store_true', default=False, dest='fip',
|
||||
|
@ -454,9 +454,9 @@ def make_picture(producer):
|
||||
def options(opt):
|
||||
opt.add_option('--dtitle', action='store', default='Parallel build representation for %r' % ' '.join(sys.argv),
|
||||
help='title for the svg diagram', dest='dtitle')
|
||||
opt.add_option('--dwidth', action='store', type='int', help='diagram width', default=800, dest='dwidth')
|
||||
opt.add_option('--dtime', action='store', type='float', help='recording interval in seconds', default=0.009, dest='dtime')
|
||||
opt.add_option('--dband', action='store', type='int', help='band width', default=22, dest='dband')
|
||||
opt.add_option('--dmaxtime', action='store', type='float', help='maximum time, for drawing fair comparisons', default=0, dest='dmaxtime')
|
||||
opt.add_option('--dwidth', action='store', type=int, help='diagram width', default=800, dest='dwidth')
|
||||
opt.add_option('--dtime', action='store', type=float, help='recording interval in seconds', default=0.009, dest='dtime')
|
||||
opt.add_option('--dband', action='store', type=int, help='band width', default=22, dest='dband')
|
||||
opt.add_option('--dmaxtime', action='store', type=float, help='maximum time, for drawing fair comparisons', default=0, dest='dmaxtime')
|
||||
opt.add_option('--dnotooltip', action='store_true', help='disable tooltips', default=False, dest='dnotooltip')
|
||||
|
||||
|
@ -683,13 +683,13 @@ def options(opt):
|
||||
opt.add_option('--want-rpath', action='store_true', default=False, dest='want_rpath', help='enable the rpath for qt libraries')
|
||||
|
||||
opt.add_option('--header-ext',
|
||||
type='string',
|
||||
type=str,
|
||||
default='',
|
||||
help='header extension for moc files',
|
||||
dest='qt_header_ext')
|
||||
|
||||
for i in 'qtdir qtbin qtlibs'.split():
|
||||
opt.add_option('--'+i, type='string', default='', dest=i)
|
||||
opt.add_option('--'+i, type=str, default='', dest=i)
|
||||
|
||||
opt.add_option('--translate', action="store_true", help="collect translation strings", dest="trans_qt4", default=False)
|
||||
|
||||
|
@ -160,16 +160,16 @@ def ti_dsplink_set_platform_flags(cfg, splat, dsp, dspbios_ver, board):
|
||||
|
||||
|
||||
def options(opt):
|
||||
opt.add_option('--with-ti-cgt', type='string', dest='ti-cgt-dir', help = 'Specify alternate cgt root folder', default="")
|
||||
opt.add_option('--with-ti-biosutils', type='string', dest='ti-biosutils-dir', help = 'Specify alternate biosutils folder', default="")
|
||||
opt.add_option('--with-ti-dspbios', type='string', dest='ti-dspbios-dir', help = 'Specify alternate dspbios folder', default="")
|
||||
opt.add_option('--with-ti-dsplink', type='string', dest='ti-dsplink-dir', help = 'Specify alternate dsplink folder', default="")
|
||||
opt.add_option('--with-ti-xdctools', type='string', dest='ti-xdctools-dir', help = 'Specify alternate xdctools folder', default="")
|
||||
opt.add_option('--with-ti-cgt', type=str, dest='ti-cgt-dir', help = 'Specify alternate cgt root folder', default="")
|
||||
opt.add_option('--with-ti-biosutils', type=str, dest='ti-biosutils-dir', help = 'Specify alternate biosutils folder', default="")
|
||||
opt.add_option('--with-ti-dspbios', type=str, dest='ti-dspbios-dir', help = 'Specify alternate dspbios folder', default="")
|
||||
opt.add_option('--with-ti-dsplink', type=str, dest='ti-dsplink-dir', help = 'Specify alternate dsplink folder', default="")
|
||||
opt.add_option('--with-ti-xdctools', type=str, dest='ti-xdctools-dir', help = 'Specify alternate xdctools folder', default="")
|
||||
|
||||
class ti_cprogram(cprogram):
|
||||
"""
|
||||
Link object files into a c program
|
||||
|
||||
|
||||
Changes:
|
||||
|
||||
- the linked executable to have a relative path (because we can)
|
||||
|
@ -38,7 +38,7 @@ EXTS_CXX = ('.cpp','.cc','.cxx','.C','.c++')
|
||||
|
||||
def options(opt):
|
||||
global MAX_BATCH
|
||||
opt.add_option('--batchsize', action='store', dest='batchsize', type='int', default=MAX_BATCH,
|
||||
opt.add_option('--batchsize', action='store', dest='batchsize', type=int, default=MAX_BATCH,
|
||||
help='default unity batch size (0 disables unity builds)')
|
||||
|
||||
@TaskGen.taskgen_method
|
||||
|
Loading…
Reference in New Issue
Block a user