diff --git a/ChangeLog b/ChangeLog index b4933f4d..b5ea7b99 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,7 @@ NEW IN WAF 1.9 - Enable ut_str to process scriptlet expressions for C/C++ unit tests - Minimize the amount of paths added to unit test environment variable - Restore configuration values with Configure.autoconfig='clobber' #1758 + - Rebuilds are applied on file contents so that update_outputs is no longer needed * Performance highlights: - Reduce the key size in bld.task_sigs by adding bld.node_sigs and bld.imp_sigs @@ -39,7 +40,7 @@ NEW IN WAF 1.9 * API changes: - The minimum Python version required is Python 2.5 - Add Task.get_cwd() - - Remove the command called "update" + - Remove the command called 'update' - Remove unused variables and functions: - TaskBase.attr() - Build.POST_BOTH diff --git a/README.md b/README.md index c7f93b51..22612f73 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ $ ./waf-light --make-waf --tools=compat15,/comp/waf/aba.py --prelude=$'\tfrom wa Or, to avoid regenerating the waf file all the time, just set the `WAFDIR` environment variable to the directory containing "waflib". -## HOW TO TRY THE EXAMPLES +## HOW TO RUN THE EXAMPLES Try this: ```sh diff --git a/waflib/Build.py b/waflib/Build.py index 302df824..f15d2d34 100644 --- a/waflib/Build.py +++ b/waflib/Build.py @@ -295,9 +295,9 @@ class BuildContext(Context.Context): except EnvironmentError: pass else: - if env['version'] < Context.HEXVERSION: + if env.version < Context.HEXVERSION: raise Errors.WafError('Version mismatch! reconfigure the project') - for t in env['tools']: + for t in env.tools: self.setup(**t) dbfn = os.path.join(self.variant_dir, Context.DBFILE) diff --git a/waflib/Configure.py b/waflib/Configure.py index 8ff4df95..409b00ed 100644 --- a/waflib/Configure.py +++ b/waflib/Configure.py @@ -167,9 +167,9 @@ class ConfigurationContext(Context.Context): # consider the current path as the root directory (see prepare_impl). # to remove: use 'waf distclean' env = ConfigSet.ConfigSet() - env['argv'] = sys.argv - env['options'] = Options.options.__dict__ - env['config_cmd'] = self.cmd + env.argv = sys.argv + env.options = Options.options.__dict__ + env.config_cmd = self.cmd env.run_dir = Context.run_dir env.top_dir = Context.top_dir @@ -177,9 +177,9 @@ class ConfigurationContext(Context.Context): # conf.hash & conf.files hold wscript files paths and hash # (used only by Configure.autoconfig) - env['hash'] = self.hash - env['files'] = self.files - env['environ'] = dict(self.environ) + env.hash = self.hash + env.files = self.files + env.environ = dict(self.environ) if not self.env.NO_LOCK_IN_RUN and not getattr(Options.options, 'no_lock_in_run'): env.store(os.path.join(Context.run_dir, Options.lockfile)) diff --git a/waflib/Scripting.py b/waflib/Scripting.py index a71fdcc0..5854f24d 100644 --- a/waflib/Scripting.py +++ b/waflib/Scripting.py @@ -591,12 +591,12 @@ def autoconfigure(execute_method): do_config = True else: h = 0 - for f in env['files']: + for f in env.files: h = Utils.h_list((h, Utils.readf(f, 'rb'))) do_config = h != env.hash if do_config: - cmd = env['config_cmd'] or 'configure' + cmd = env.config_cmd or 'configure' if Configure.autoconfig == 'clobber': tmp = Options.options.__dict__ Options.options.__dict__ = env.options diff --git a/waflib/Tools/bison.py b/waflib/Tools/bison.py index 18384599..2235f8ec 100644 --- a/waflib/Tools/bison.py +++ b/waflib/Tools/bison.py @@ -22,7 +22,7 @@ def big_bison(self, node): """ Creates a bison task, which must be executed from the directory of the output file. """ - has_h = '-d' in self.env['BISONFLAGS'] + has_h = '-d' in self.env.BISONFLAGS outs = [] if node.name.endswith('.yc'): diff --git a/waflib/Tools/c_config.py b/waflib/Tools/c_config.py index 694a556e..0e639f74 100644 --- a/waflib/Tools/c_config.py +++ b/waflib/Tools/c_config.py @@ -484,7 +484,7 @@ def validate_c(self, kw): if not 'compiler' in kw and not 'features' in kw: kw['compiler'] = 'c' - if env['CXX_NAME'] and Task.classes.get('cxx'): + if env.CXX_NAME and Task.classes.get('cxx'): kw['compiler'] = 'cxx' if not self.env.CXX: self.fatal('a c++ compiler is required') @@ -820,7 +820,7 @@ def define(self, key, val, quote=True, comment=''): app = s % (key, str(val)) ban = key + '=' - lst = self.env['DEFINES'] + lst = self.env.DEFINES for x in lst: if x.startswith(ban): lst[lst.index(x)] = app @@ -842,8 +842,8 @@ def undefine(self, key, comment=''): assert key and isinstance(key, str) ban = key + '=' - lst = [x for x in self.env['DEFINES'] if not x.startswith(ban)] - self.env['DEFINES'] = lst + lst = [x for x in self.env.DEFINES if not x.startswith(ban)] + self.env.DEFINES = lst self.env.append_unique(DEFKEYS, key) self.set_define_comment(key, comment) @@ -881,7 +881,7 @@ def is_defined(self, key): assert key and isinstance(key, str) ban = key + '=' - for x in self.env['DEFINES']: + for x in self.env.DEFINES: if x.startswith(ban): return True return False @@ -896,7 +896,7 @@ def get_define(self, key): assert key and isinstance(key, str) ban = key + '=' - for x in self.env['DEFINES']: + for x in self.env.DEFINES: if x.startswith(ban): return x[len(ban):] return None @@ -993,7 +993,7 @@ def get_config_header(self, defines=True, headers=False, define_prefix=''): if defines: tbl = {} - for k in self.env['DEFINES']: + for k in self.env.DEFINES: a, _, b = k.partition('=') tbl[a] = b @@ -1125,13 +1125,13 @@ def get_cc_version(conf, cc, gcc=False, icc=False, clang=False): Logs.debug('ccroot: dest platform: ' + ' '.join([conf.env[x] or '?' for x in ('DEST_OS', 'DEST_BINFMT', 'DEST_CPU')])) if icc: ver = k['__INTEL_COMPILER'] - conf.env['CC_VERSION'] = (ver[:-2], ver[-2], ver[-1]) + conf.env.CC_VERSION = (ver[:-2], ver[-2], ver[-1]) else: if isD('__clang__') and isD('__clang_major__'): - conf.env['CC_VERSION'] = (k['__clang_major__'], k['__clang_minor__'], k['__clang_patchlevel__']) + conf.env.CC_VERSION = (k['__clang_major__'], k['__clang_minor__'], k['__clang_patchlevel__']) else: # older clang versions and gcc - conf.env['CC_VERSION'] = (k['__GNUC__'], k['__GNUC_MINOR__'], k.get('__GNUC_PATCHLEVEL__', '0')) + conf.env.CC_VERSION = (k['__GNUC__'], k['__GNUC_MINOR__'], k.get('__GNUC_PATCHLEVEL__', '0')) return k @conf @@ -1150,7 +1150,7 @@ def get_xlc_version(conf, cc): match = version_re(out or err) if match: k = match.groupdict() - conf.env['CC_VERSION'] = (k['major'], k['minor']) + conf.env.CC_VERSION = (k['major'], k['minor']) break else: conf.fatal('Could not determine the XLC version.') @@ -1179,7 +1179,7 @@ def get_suncc_version(conf, cc): match = version_re(version) if match: k = match.groupdict() - conf.env['CC_VERSION'] = (k['major'], k['minor']) + conf.env.CC_VERSION = (k['major'], k['minor']) else: conf.fatal('Could not determine the suncc version.') diff --git a/waflib/Tools/c_osx.py b/waflib/Tools/c_osx.py index 93ff1db6..261e8575 100644 --- a/waflib/Tools/c_osx.py +++ b/waflib/Tools/c_osx.py @@ -37,8 +37,8 @@ def set_macosx_deployment_target(self): """ see WAF issue 285 and also and also http://trac.macports.org/ticket/17059 """ - if self.env['MACOSX_DEPLOYMENT_TARGET']: - os.environ['MACOSX_DEPLOYMENT_TARGET'] = self.env['MACOSX_DEPLOYMENT_TARGET'] + if self.env.MACOSX_DEPLOYMENT_TARGET: + os.environ['MACOSX_DEPLOYMENT_TARGET'] = self.env.MACOSX_DEPLOYMENT_TARGET elif 'MACOSX_DEPLOYMENT_TARGET' not in os.environ: if Utils.unversioned_sys_platform() == 'darwin': os.environ['MACOSX_DEPLOYMENT_TARGET'] = '.'.join(platform.mac_ver()[0].split('.')[:2]) @@ -78,7 +78,7 @@ def create_task_macapp(self): bld.env.MACAPP = True bld.shlib(source='a.c', target='foo') """ - if self.env['MACAPP'] or getattr(self, 'mac_app', False): + if self.env.MACAPP or getattr(self, 'mac_app', False): out = self.link_task.outputs[0] name = bundle_name_for_output(out) @@ -114,7 +114,7 @@ def create_task_macplist(self): """ Creates a :py:class:`waflib.Tools.c_osx.macplist` instance. """ - if self.env['MACAPP'] or getattr(self, 'mac_app', False): + if self.env.MACAPP or getattr(self, 'mac_app', False): out = self.link_task.outputs[0] name = bundle_name_for_output(out) @@ -158,9 +158,9 @@ def apply_bundle(self): bld.env.MACBUNDLE = True bld.shlib(source='a.c', target='foo') """ - if self.env['MACBUNDLE'] or getattr(self, 'mac_bundle', False): - self.env['LINKFLAGS_cshlib'] = self.env['LINKFLAGS_cxxshlib'] = [] # disable the '-dynamiclib' flag - self.env['cshlib_PATTERN'] = self.env['cxxshlib_PATTERN'] = self.env['macbundle_PATTERN'] + if self.env.MACBUNDLE or getattr(self, 'mac_bundle', False): + self.env.LINKFLAGS_cshlib = self.env.LINKFLAGS_cxxshlib = [] # disable the '-dynamiclib' flag + self.env.cshlib_PATTERN = self.env.cxxshlib_PATTERN = self.env.macbundle_PATTERN use = self.use = self.to_list(getattr(self, 'use', [])) if not 'MACBUNDLE' in use: use.append('MACBUNDLE') diff --git a/waflib/Tools/ccroot.py b/waflib/Tools/ccroot.py index 1401b95c..5fb7c47c 100644 --- a/waflib/Tools/ccroot.py +++ b/waflib/Tools/ccroot.py @@ -118,10 +118,10 @@ def apply_incpaths(self): and the list of include paths in ``tg.env.INCLUDES``. """ - lst = self.to_incnodes(self.to_list(getattr(self, 'includes', [])) + self.env['INCLUDES']) + lst = self.to_incnodes(self.to_list(getattr(self, 'includes', [])) + self.env.INCLUDES) self.includes_nodes = lst cwd = self.get_cwd() - self.env['INCPATHS'] = [x.path_from(cwd) for x in lst] + self.env.INCPATHS = [x.path_from(cwd) for x in lst] class link_task(Task.Task): """ @@ -498,9 +498,9 @@ def apply_implib(self): name = self.target.name else: name = os.path.split(self.target)[1] - implib = self.env['implib_PATTERN'] % name + implib = self.env.implib_PATTERN % name implib = dll.parent.find_or_declare(implib) - self.env.append_value('LINKFLAGS', self.env['IMPLIB_ST'] % implib.bldpath()) + self.env.append_value('LINKFLAGS', self.env.IMPLIB_ST % implib.bldpath()) self.link_task.outputs.append(implib) if getattr(self, 'defs', None) and self.env.DEST_BINFMT == 'pe': @@ -608,7 +608,7 @@ def apply_vnum(self): else: self.vnum_install_task = (t1, t3) - if '-dynamiclib' in self.env['LINKFLAGS']: + if '-dynamiclib' in self.env.LINKFLAGS: # this requires after(propagate_uselib_vars) try: inst_to = self.install_path diff --git a/waflib/Tools/d.py b/waflib/Tools/d.py index 46490492..12f2634a 100644 --- a/waflib/Tools/d.py +++ b/waflib/Tools/d.py @@ -57,7 +57,7 @@ def d_hook(self, node): if getattr(self, 'generate_headers', None): tsk = create_compiled_task(self, 'd_with_header', node) - tsk.outputs.append(node.change_ext(self.env['DHEADER_ext'])) + tsk.outputs.append(node.change_ext(self.env.DHEADER_ext)) else: tsk = create_compiled_task(self, 'd', node) return tsk diff --git a/waflib/Tools/d_config.py b/waflib/Tools/d_config.py index e5cff630..e46b21fc 100644 --- a/waflib/Tools/d_config.py +++ b/waflib/Tools/d_config.py @@ -8,24 +8,24 @@ from waflib.Configure import conf @conf def d_platform_flags(self): """ - Set the extensions dll/so for d programs and libraries + Sets the extensions dll/so for d programs and libraries """ v = self.env if not v.DEST_OS: v.DEST_OS = Utils.unversioned_sys_platform() binfmt = Utils.destos_to_binfmt(self.env.DEST_OS) if binfmt == 'pe': - v['dprogram_PATTERN'] = '%s.exe' - v['dshlib_PATTERN'] = 'lib%s.dll' - v['dstlib_PATTERN'] = 'lib%s.a' + v.dprogram_PATTERN = '%s.exe' + v.dshlib_PATTERN = 'lib%s.dll' + v.dstlib_PATTERN = 'lib%s.a' elif binfmt == 'mac-o': - v['dprogram_PATTERN'] = '%s' - v['dshlib_PATTERN'] = 'lib%s.dylib' - v['dstlib_PATTERN'] = 'lib%s.a' + v.dprogram_PATTERN = '%s' + v.dshlib_PATTERN = 'lib%s.dylib' + v.dstlib_PATTERN = 'lib%s.a' else: - v['dprogram_PATTERN'] = '%s' - v['dshlib_PATTERN'] = 'lib%s.so' - v['dstlib_PATTERN'] = 'lib%s.a' + v.dprogram_PATTERN = '%s' + v.dshlib_PATTERN = 'lib%s.so' + v.dstlib_PATTERN = 'lib%s.a' DLIB = ''' version(D_Version2) { diff --git a/waflib/Tools/dmd.py b/waflib/Tools/dmd.py index 7f49d625..ff46c704 100644 --- a/waflib/Tools/dmd.py +++ b/waflib/Tools/dmd.py @@ -10,7 +10,7 @@ from waflib.Configure import conf @conf def find_dmd(conf): """ - Find the program *dmd*, *dmd2*, or *ldc* and set the variable *D* + Finds the program *dmd*, *dmd2*, or *ldc* and set the variable *D* """ conf.find_program(['dmd', 'dmd2', 'ldc'], var='D') @@ -24,48 +24,40 @@ def find_dmd(conf): @conf def common_flags_ldc(conf): """ - Set the D flags required by *ldc* + Sets the D flags required by *ldc* """ v = conf.env - v['DFLAGS'] = ['-d-version=Posix'] - v['LINKFLAGS'] = [] - v['DFLAGS_dshlib'] = ['-relocation-model=pic'] + v.DFLAGS = ['-d-version=Posix'] + v.LINKFLAGS = [] + v.DFLAGS_dshlib = ['-relocation-model=pic'] @conf def common_flags_dmd(conf): """ Set the flags required by *dmd* or *dmd2* """ - v = conf.env - # _DFLAGS _DIMPORTFLAGS + v.D_SRC_F = ['-c'] + v.D_TGT_F = '-of%s' - # Compiler is dmd so 'gdc' part will be ignored, just - # ensure key is there, so wscript can append flags to it - #v['DFLAGS'] = ['-version=Posix'] + v.D_LINKER = v.D + v.DLNK_SRC_F = '' + v.DLNK_TGT_F = '-of%s' + v.DINC_ST = '-I%s' - v['D_SRC_F'] = ['-c'] - v['D_TGT_F'] = '-of%s' + v.DSHLIB_MARKER = v.DSTLIB_MARKER = '' + v.DSTLIB_ST = v.DSHLIB_ST = '-L-l%s' + v.DSTLIBPATH_ST = v.DLIBPATH_ST = '-L-L%s' - # linker - v['D_LINKER'] = v['D'] - v['DLNK_SRC_F'] = '' - v['DLNK_TGT_F'] = '-of%s' - v['DINC_ST'] = '-I%s' + v.LINKFLAGS_dprogram= ['-quiet'] - v['DSHLIB_MARKER'] = v['DSTLIB_MARKER'] = '' - v['DSTLIB_ST'] = v['DSHLIB_ST'] = '-L-l%s' - v['DSTLIBPATH_ST'] = v['DLIBPATH_ST'] = '-L-L%s' + v.DFLAGS_dshlib = ['-fPIC'] + v.LINKFLAGS_dshlib = ['-L-shared'] - v['LINKFLAGS_dprogram']= ['-quiet'] - - v['DFLAGS_dshlib'] = ['-fPIC'] - v['LINKFLAGS_dshlib'] = ['-L-shared'] - - v['DHEADER_ext'] = '.di' + v.DHEADER_ext = '.di' v.DFLAGS_d_with_header = ['-H', '-Hf'] - v['D_HDR_F'] = '%s' + v.D_HDR_F = '%s' def configure(conf): """ @@ -75,7 +67,7 @@ def configure(conf): if sys.platform == 'win32': out = conf.cmd_and_log(conf.env.D + ['--help']) - if out.find("D Compiler v2.") > -1: + if out.find('D Compiler v2.') > -1: conf.fatal('dmd2 on Windows is not supported, use gdc or ldc2 instead') conf.load('ar') diff --git a/waflib/Tools/fc_config.py b/waflib/Tools/fc_config.py index a07fa68e..84ae6bc6 100644 --- a/waflib/Tools/fc_config.py +++ b/waflib/Tools/fc_config.py @@ -21,29 +21,31 @@ def fc_flags(conf): """ v = conf.env - v['FC_SRC_F'] = [] - v['FC_TGT_F'] = ['-c', '-o'] - v['FCINCPATH_ST'] = '-I%s' - v['FCDEFINES_ST'] = '-D%s' + v.FC_SRC_F = [] + v.FC_TGT_F = ['-c', '-o'] + v.FCINCPATH_ST = '-I%s' + v.FCDEFINES_ST = '-D%s' - if not v['LINK_FC']: v['LINK_FC'] = v['FC'] - v['FCLNK_SRC_F'] = [] - v['FCLNK_TGT_F'] = ['-o'] + if not v.LINK_FC: + v.LINK_FC = v.FC - v['FCFLAGS_fcshlib'] = ['-fpic'] - v['LINKFLAGS_fcshlib'] = ['-shared'] - v['fcshlib_PATTERN'] = 'lib%s.so' + v.FCLNK_SRC_F = [] + v.FCLNK_TGT_F = ['-o'] - v['fcstlib_PATTERN'] = 'lib%s.a' + v.FCFLAGS_fcshlib = ['-fpic'] + v.LINKFLAGS_fcshlib = ['-shared'] + v.fcshlib_PATTERN = 'lib%s.so' - v['FCLIB_ST'] = '-l%s' - v['FCLIBPATH_ST'] = '-L%s' - v['FCSTLIB_ST'] = '-l%s' - v['FCSTLIBPATH_ST'] = '-L%s' - v['FCSTLIB_MARKER'] = '-Wl,-Bstatic' - v['FCSHLIB_MARKER'] = '-Wl,-Bdynamic' + v.fcstlib_PATTERN = 'lib%s.a' - v['SONAME_ST'] = '-Wl,-h,%s' + v.FCLIB_ST = '-l%s' + v.FCLIBPATH_ST = '-L%s' + v.FCSTLIB_ST = '-l%s' + v.FCSTLIBPATH_ST = '-L%s' + v.FCSTLIB_MARKER = '-Wl,-Bstatic' + v.FCSHLIB_MARKER = '-Wl,-Bdynamic' + + v.SONAME_ST = '-Wl,-h,%s' @conf def fc_add_flags(conf): @@ -92,30 +94,30 @@ def fortran_modifier_darwin(conf): Define fortran flags and extensions for the OSX systems """ v = conf.env - v['FCFLAGS_fcshlib'] = ['-fPIC'] - v['LINKFLAGS_fcshlib'] = ['-dynamiclib'] - v['fcshlib_PATTERN'] = 'lib%s.dylib' - v['FRAMEWORKPATH_ST'] = '-F%s' - v['FRAMEWORK_ST'] = '-framework %s' + v.FCFLAGS_fcshlib = ['-fPIC'] + v.LINKFLAGS_fcshlib = ['-dynamiclib'] + v.fcshlib_PATTERN = 'lib%s.dylib' + v.FRAMEWORKPATH_ST = '-F%s' + v.FRAMEWORK_ST = '-framework %s' - v['LINKFLAGS_fcstlib'] = [] + v.LINKFLAGS_fcstlib = [] - v['FCSHLIB_MARKER'] = '' - v['FCSTLIB_MARKER'] = '' - v['SONAME_ST'] = '' + v.FCSHLIB_MARKER = '' + v.FCSTLIB_MARKER = '' + v.SONAME_ST = '' @conf def fortran_modifier_win32(conf): """Define fortran flags for the windows platforms""" v = conf.env - v['fcprogram_PATTERN'] = v['fcprogram_test_PATTERN'] = '%s.exe' + v.fcprogram_PATTERN = v.fcprogram_test_PATTERN = '%s.exe' - v['fcshlib_PATTERN'] = '%s.dll' - v['implib_PATTERN'] = 'lib%s.dll.a' - v['IMPLIB_ST'] = '-Wl,--out-implib,%s' + v.fcshlib_PATTERN = '%s.dll' + v.implib_PATTERN = 'lib%s.dll.a' + v.IMPLIB_ST = '-Wl,--out-implib,%s' - v['FCFLAGS_fcshlib'] = [] + v.FCFLAGS_fcshlib = [] # Auto-import is enabled by default even without this option, # but enabling it explicitly has the nice effect of suppressing the rather boring, debug-level messages @@ -127,9 +129,9 @@ def fortran_modifier_cygwin(conf): """Define fortran flags for use on cygwin""" fortran_modifier_win32(conf) v = conf.env - v['fcshlib_PATTERN'] = 'cyg%s.dll' + v.fcshlib_PATTERN = 'cyg%s.dll' v.append_value('LINKFLAGS_fcshlib', ['-Wl,--enable-auto-image-base']) - v['FCFLAGS_fcshlib'] = [] + v.FCFLAGS_fcshlib = [] # ------------------------------------------------------------------------ @conf @@ -445,7 +447,7 @@ def check_fortran_mangling(self, *k, **kw): @before_method('propagate_uselib_vars', 'apply_link') def set_lib_pat(self): """Set the fortran flags for linking with the python library""" - self.env['fcshlib_PATTERN'] = self.env['pyext_PATTERN'] + self.env.fcshlib_PATTERN = self.env.pyext_PATTERN @conf def detect_openmp(self): diff --git a/waflib/Tools/flex.py b/waflib/Tools/flex.py index 59a82792..59147a0e 100644 --- a/waflib/Tools/flex.py +++ b/waflib/Tools/flex.py @@ -23,8 +23,8 @@ def flexfun(tsk): if isinstance(xx, str): return [xx] return xx tsk.last_cmd = lst = [] - lst.extend(to_list(env['FLEX'])) - lst.extend(to_list(env['FLEXFLAGS'])) + lst.extend(to_list(env.FLEX)) + lst.extend(to_list(env.FLEXFLAGS)) inputs = [a.path_from(tsk.get_cwd()) for a in tsk.inputs] if env.FLEX_MSYS: inputs = [x.replace(os.sep, '/') for x in inputs] diff --git a/waflib/Tools/g95.py b/waflib/Tools/g95.py index e6408bab..46e9aced 100644 --- a/waflib/Tools/g95.py +++ b/waflib/Tools/g95.py @@ -17,9 +17,9 @@ def find_g95(conf): @conf def g95_flags(conf): v = conf.env - v['FCFLAGS_fcshlib'] = ['-fPIC'] - v['FORTRANMODFLAG'] = ['-fmod=', ''] # template for module path - v['FCFLAGS_DEBUG'] = ['-Werror'] # why not + v.FCFLAGS_fcshlib = ['-fPIC'] + v.FORTRANMODFLAG = ['-fmod=', ''] # template for module path + v.FCFLAGS_DEBUG = ['-Werror'] # why not @conf def g95_modifier_win32(conf): @@ -35,7 +35,7 @@ def g95_modifier_darwin(conf): @conf def g95_modifier_platform(conf): - dest_os = conf.env['DEST_OS'] or Utils.unversioned_sys_platform() + dest_os = conf.env.DEST_OS or Utils.unversioned_sys_platform() g95_modifier_func = getattr(conf, 'g95_modifier_' + dest_os, None) if g95_modifier_func: g95_modifier_func() @@ -54,7 +54,7 @@ def get_g95_version(conf, fc): if not match: conf.fatal('cannot determine g95 version') k = match.groupdict() - conf.env['FC_VERSION'] = (k['major'], k['minor']) + conf.env.FC_VERSION = (k['major'], k['minor']) def configure(conf): conf.find_g95() diff --git a/waflib/Tools/gcc.py b/waflib/Tools/gcc.py index 237de0b4..73820228 100644 --- a/waflib/Tools/gcc.py +++ b/waflib/Tools/gcc.py @@ -27,54 +27,51 @@ def gcc_common_flags(conf): """ v = conf.env - v['CC_SRC_F'] = [] - v['CC_TGT_F'] = ['-c', '-o'] + v.CC_SRC_F = [] + v.CC_TGT_F = ['-c', '-o'] - # linker - if not v['LINK_CC']: v['LINK_CC'] = v['CC'] - v['CCLNK_SRC_F'] = [] - v['CCLNK_TGT_F'] = ['-o'] - v['CPPPATH_ST'] = '-I%s' - v['DEFINES_ST'] = '-D%s' + if not v.LINK_CC: + v.LINK_CC = v.CC - v['LIB_ST'] = '-l%s' # template for adding libs - v['LIBPATH_ST'] = '-L%s' # template for adding libpaths - v['STLIB_ST'] = '-l%s' - v['STLIBPATH_ST'] = '-L%s' - v['RPATH_ST'] = '-Wl,-rpath,%s' + v.CCLNK_SRC_F = [] + v.CCLNK_TGT_F = ['-o'] + v.CPPPATH_ST = '-I%s' + v.DEFINES_ST = '-D%s' - v['SONAME_ST'] = '-Wl,-h,%s' - v['SHLIB_MARKER'] = '-Wl,-Bdynamic' - v['STLIB_MARKER'] = '-Wl,-Bstatic' + v.LIB_ST = '-l%s' # template for adding libs + v.LIBPATH_ST = '-L%s' # template for adding libpaths + v.STLIB_ST = '-l%s' + v.STLIBPATH_ST = '-L%s' + v.RPATH_ST = '-Wl,-rpath,%s' - # program - v['cprogram_PATTERN'] = '%s' + v.SONAME_ST = '-Wl,-h,%s' + v.SHLIB_MARKER = '-Wl,-Bdynamic' + v.STLIB_MARKER = '-Wl,-Bstatic' - # shared librar - v['CFLAGS_cshlib'] = ['-fPIC'] - v['LINKFLAGS_cshlib'] = ['-shared'] - v['cshlib_PATTERN'] = 'lib%s.so' + v.cprogram_PATTERN = '%s' - # static lib - v['LINKFLAGS_cstlib'] = ['-Wl,-Bstatic'] - v['cstlib_PATTERN'] = 'lib%s.a' + v.CFLAGS_cshlib = ['-fPIC'] + v.LINKFLAGS_cshlib = ['-shared'] + v.cshlib_PATTERN = 'lib%s.so' - # osx stuff - v['LINKFLAGS_MACBUNDLE'] = ['-bundle', '-undefined', 'dynamic_lookup'] - v['CFLAGS_MACBUNDLE'] = ['-fPIC'] - v['macbundle_PATTERN'] = '%s.bundle' + v.LINKFLAGS_cstlib = ['-Wl,-Bstatic'] + v.cstlib_PATTERN = 'lib%s.a' + + v.LINKFLAGS_MACBUNDLE = ['-bundle', '-undefined', 'dynamic_lookup'] + v.CFLAGS_MACBUNDLE = ['-fPIC'] + v.macbundle_PATTERN = '%s.bundle' @conf def gcc_modifier_win32(conf): """Configuration flags for executing gcc on Windows""" v = conf.env - v['cprogram_PATTERN'] = '%s.exe' + v.cprogram_PATTERN = '%s.exe' - v['cshlib_PATTERN'] = '%s.dll' - v['implib_PATTERN'] = 'lib%s.dll.a' - v['IMPLIB_ST'] = '-Wl,--out-implib,%s' + v.cshlib_PATTERN = '%s.dll' + v.implib_PATTERN = 'lib%s.dll.a' + v.IMPLIB_ST = '-Wl,--out-implib,%s' - v['CFLAGS_cshlib'] = [] + v.CFLAGS_cshlib = [] # Auto-import is enabled by default even without this option, # but enabling it explicitly has the nice effect of suppressing the rather boring, debug-level messages @@ -86,42 +83,42 @@ def gcc_modifier_cygwin(conf): """Configuration flags for executing gcc on Cygwin""" gcc_modifier_win32(conf) v = conf.env - v['cshlib_PATTERN'] = 'cyg%s.dll' + v.cshlib_PATTERN = 'cyg%s.dll' v.append_value('LINKFLAGS_cshlib', ['-Wl,--enable-auto-image-base']) - v['CFLAGS_cshlib'] = [] + v.CFLAGS_cshlib = [] @conf def gcc_modifier_darwin(conf): """Configuration flags for executing gcc on MacOS""" v = conf.env - v['CFLAGS_cshlib'] = ['-fPIC'] - v['LINKFLAGS_cshlib'] = ['-dynamiclib'] - v['cshlib_PATTERN'] = 'lib%s.dylib' - v['FRAMEWORKPATH_ST'] = '-F%s' - v['FRAMEWORK_ST'] = ['-framework'] - v['ARCH_ST'] = ['-arch'] + v.CFLAGS_cshlib = ['-fPIC'] + v.LINKFLAGS_cshlib = ['-dynamiclib'] + v.cshlib_PATTERN = 'lib%s.dylib' + v.FRAMEWORKPATH_ST = '-F%s' + v.FRAMEWORK_ST = ['-framework'] + v.ARCH_ST = ['-arch'] - v['LINKFLAGS_cstlib'] = [] + v.LINKFLAGS_cstlib = [] - v['SHLIB_MARKER'] = [] - v['STLIB_MARKER'] = [] - v['SONAME_ST'] = [] + v.SHLIB_MARKER = [] + v.STLIB_MARKER = [] + v.SONAME_ST = [] @conf def gcc_modifier_aix(conf): """Configuration flags for executing gcc on AIX""" v = conf.env - v['LINKFLAGS_cprogram'] = ['-Wl,-brtl'] - v['LINKFLAGS_cshlib'] = ['-shared','-Wl,-brtl,-bexpfull'] - v['SHLIB_MARKER'] = [] + v.LINKFLAGS_cprogram = ['-Wl,-brtl'] + v.LINKFLAGS_cshlib = ['-shared','-Wl,-brtl,-bexpfull'] + v.SHLIB_MARKER = [] @conf def gcc_modifier_hpux(conf): v = conf.env - v['SHLIB_MARKER'] = [] - v['STLIB_MARKER'] = [] - v['CFLAGS_cshlib'] = ['-fPIC','-DPIC'] - v['cshlib_PATTERN'] = 'lib%s.sl' + v.SHLIB_MARKER = [] + v.STLIB_MARKER = [] + v.CFLAGS_cshlib = ['-fPIC','-DPIC'] + v.cshlib_PATTERN = 'lib%s.sl' @conf def gcc_modifier_openbsd(conf): @@ -130,9 +127,9 @@ def gcc_modifier_openbsd(conf): @conf def gcc_modifier_osf1V(conf): v = conf.env - v['SHLIB_MARKER'] = [] - v['STLIB_MARKER'] = [] - v['SONAME_ST'] = [] + v.SHLIB_MARKER = [] + v.STLIB_MARKER = [] + v.SONAME_ST = [] @conf def gcc_modifier_platform(conf): @@ -156,4 +153,3 @@ def configure(conf): conf.cc_add_flags() conf.link_add_flags() - diff --git a/waflib/Tools/gdc.py b/waflib/Tools/gdc.py index 813468b6..d89a66d3 100644 --- a/waflib/Tools/gdc.py +++ b/waflib/Tools/gdc.py @@ -8,7 +8,7 @@ from waflib.Configure import conf @conf def find_gdc(conf): """ - Find the program gdc and set the variable *D* + Finds the program gdc and set the variable *D* """ conf.find_program('gdc', var='D') @@ -19,33 +19,29 @@ def find_gdc(conf): @conf def common_flags_gdc(conf): """ - Set the flags required by *gdc* + Sets the flags required by *gdc* """ v = conf.env - # _DFLAGS _DIMPORTFLAGS + v.DFLAGS = [] - # for mory info about the meaning of this dict see dmd.py - v['DFLAGS'] = [] + v.D_SRC_F = ['-c'] + v.D_TGT_F = '-o%s' - v['D_SRC_F'] = ['-c'] - v['D_TGT_F'] = '-o%s' + v.D_LINKER = v.D + v.DLNK_SRC_F = '' + v.DLNK_TGT_F = '-o%s' + v.DINC_ST = '-I%s' - # linker - v['D_LINKER'] = v['D'] - v['DLNK_SRC_F'] = '' - v['DLNK_TGT_F'] = '-o%s' - v['DINC_ST'] = '-I%s' + v.DSHLIB_MARKER = v.DSTLIB_MARKER = '' + v.DSTLIB_ST = v.DSHLIB_ST = '-l%s' + v.DSTLIBPATH_ST = v.DLIBPATH_ST = '-L%s' - v['DSHLIB_MARKER'] = v['DSTLIB_MARKER'] = '' - v['DSTLIB_ST'] = v['DSHLIB_ST'] = '-l%s' - v['DSTLIBPATH_ST'] = v['DLIBPATH_ST'] = '-L%s' + v.LINKFLAGS_dshlib = ['-shared'] - v['LINKFLAGS_dshlib'] = ['-shared'] - - v['DHEADER_ext'] = '.di' + v.DHEADER_ext = '.di' v.DFLAGS_d_with_header = '-fintfc' - v['D_HDR_F'] = '-fintfc-file=%s' + v.D_HDR_F = '-fintfc-file=%s' def configure(conf): """ diff --git a/waflib/Tools/gfortran.py b/waflib/Tools/gfortran.py index 3ed9cba1..fb3a1624 100644 --- a/waflib/Tools/gfortran.py +++ b/waflib/Tools/gfortran.py @@ -19,9 +19,9 @@ def find_gfortran(conf): @conf def gfortran_flags(conf): v = conf.env - v['FCFLAGS_fcshlib'] = ['-fPIC'] - v['FORTRANMODFLAG'] = ['-J', ''] # template for module path - v['FCFLAGS_DEBUG'] = ['-Werror'] # why not + v.FCFLAGS_fcshlib = ['-fPIC'] + v.FORTRANMODFLAG = ['-J', ''] # template for module path + v.FCFLAGS_DEBUG = ['-Werror'] # why not @conf def gfortran_modifier_win32(conf): @@ -37,7 +37,7 @@ def gfortran_modifier_darwin(conf): @conf def gfortran_modifier_platform(conf): - dest_os = conf.env['DEST_OS'] or Utils.unversioned_sys_platform() + dest_os = conf.env.DEST_OS or Utils.unversioned_sys_platform() gfortran_modifier_func = getattr(conf, 'gfortran_modifier_' + dest_os, None) if gfortran_modifier_func: gfortran_modifier_func() @@ -79,7 +79,7 @@ def get_gfortran_version(conf, fc): def isT(var): return var in k and k[var] != '0' - conf.env['FC_VERSION'] = (k['__GNUC__'], k['__GNUC_MINOR__'], k['__GNUC_PATCHLEVEL__']) + conf.env.FC_VERSION = (k['__GNUC__'], k['__GNUC_MINOR__'], k['__GNUC_PATCHLEVEL__']) def configure(conf): conf.find_gfortran() diff --git a/waflib/Tools/glib2.py b/waflib/Tools/glib2.py index bd93718a..36fe203e 100644 --- a/waflib/Tools/glib2.py +++ b/waflib/Tools/glib2.py @@ -167,7 +167,7 @@ def process_enums(self): raise Errors.WafError('missing source ' + str(enum)) source_list = [self.path.find_resource(k) for k in source_list] inputs += source_list - env['GLIB_MKENUMS_SOURCE'] = [k.abspath() for k in source_list] + env.GLIB_MKENUMS_SOURCE = [k.abspath() for k in source_list] # find the target if not enum['target']: @@ -175,7 +175,7 @@ def process_enums(self): tgt_node = self.path.find_or_declare(enum['target']) if tgt_node.name.endswith('.c'): self.source.append(tgt_node) - env['GLIB_MKENUMS_TARGET'] = tgt_node.abspath() + env.GLIB_MKENUMS_TARGET = tgt_node.abspath() options = [] @@ -196,7 +196,7 @@ def process_enums(self): if enum[param]: options.append('%s %r' % (option, enum[param])) - env['GLIB_MKENUMS_OPTIONS'] = ' '.join(options) + env.GLIB_MKENUMS_OPTIONS = ' '.join(options) # update the task instance task.set_inputs(inputs) @@ -257,7 +257,7 @@ def process_settings(self): install_files = [] settings_schema_files = getattr(self, 'settings_schema_files', []) - if settings_schema_files and not self.env['GLIB_COMPILE_SCHEMAS']: + if settings_schema_files and not self.env.GLIB_COMPILE_SCHEMAS: raise Errors.WafError ("Unable to process GSettings schemas - glib-compile-schemas was not found during configure") # 1. process gsettings_enum_files (generate .enums.xml) @@ -268,18 +268,18 @@ def process_settings(self): source_list = self.settings_enum_files source_list = [self.path.find_resource(k) for k in source_list] enums_task.set_inputs(source_list) - enums_task.env['GLIB_MKENUMS_SOURCE'] = [k.abspath() for k in source_list] + enums_task.env.GLIB_MKENUMS_SOURCE = [k.abspath() for k in source_list] target = self.settings_enum_namespace + '.enums.xml' tgt_node = self.path.find_or_declare(target) enums_task.set_outputs(tgt_node) - enums_task.env['GLIB_MKENUMS_TARGET'] = tgt_node.abspath() + enums_task.env.GLIB_MKENUMS_TARGET = tgt_node.abspath() enums_tgt_node = [tgt_node] install_files.append(tgt_node) options = '--comments "" --fhead "" --vhead " <@type@ id=\\"%s.@EnumName@\\">" --vprod " " --vtail " " --ftail "" ' % (self.settings_enum_namespace) - enums_task.env['GLIB_MKENUMS_OPTIONS'] = options + enums_task.env.GLIB_MKENUMS_OPTIONS = options # 2. process gsettings_schema_files (validate .gschema.xml files) # @@ -293,11 +293,11 @@ def process_settings(self): source_list = enums_tgt_node + [schema_node] schema_task.set_inputs (source_list) - schema_task.env['GLIB_COMPILE_SCHEMAS_OPTIONS'] = [("--schema-file=" + k.abspath()) for k in source_list] + schema_task.env.GLIB_COMPILE_SCHEMAS_OPTIONS = [("--schema-file=" + k.abspath()) for k in source_list] target_node = schema_node.change_ext('.xml.valid') schema_task.set_outputs (target_node) - schema_task.env['GLIB_VALIDATE_SCHEMA_OUTPUT'] = target_node.abspath() + schema_task.env.GLIB_VALIDATE_SCHEMA_OUTPUT = target_node.abspath() # 3. schemas install task def compile_schemas_callback(bld): @@ -307,11 +307,11 @@ def process_settings(self): self.bld.exec_command(command) if self.bld.is_install: - if not self.env['GSETTINGSSCHEMADIR']: + if not self.env.GSETTINGSSCHEMADIR: raise Errors.WafError ('GSETTINGSSCHEMADIR not defined (should have been set up automatically during configure)') if install_files: - self.add_install_files(install_to=self.env['GSETTINGSSCHEMADIR'], install_from=install_files) + self.add_install_files(install_to=self.env.GSETTINGSSCHEMADIR, install_from=install_files) if not hasattr(self.bld, '_compile_schemas_registered'): self.bld.add_post_fun(compile_schemas_callback) self.bld._compile_schemas_registered = True @@ -330,7 +330,7 @@ def process_gresource_source(self, node): """ Hook to process .gresource.xml to generate C source files """ - if not self.env['GLIB_COMPILE_RESOURCES']: + if not self.env.GLIB_COMPILE_RESOURCES: raise Errors.WafError ("Unable to process GResource file - glib-compile-resources was not found during configure") if 'gresource' in self.features: @@ -445,11 +445,11 @@ def find_glib_compile_schemas(conf): if not gsettingsschemadir: datadir = getstr('DATADIR') if not datadir: - prefix = conf.env['PREFIX'] + prefix = conf.env.PREFIX datadir = os.path.join(prefix, 'share') gsettingsschemadir = os.path.join(datadir, 'glib-2.0', 'schemas') - conf.env['GSETTINGSSCHEMADIR'] = gsettingsschemadir + conf.env.GSETTINGSSCHEMADIR = gsettingsschemadir @conf def find_glib_compile_resources(conf): diff --git a/waflib/Tools/gxx.py b/waflib/Tools/gxx.py index 2967adb8..ecbcd38a 100644 --- a/waflib/Tools/gxx.py +++ b/waflib/Tools/gxx.py @@ -14,7 +14,7 @@ from waflib.Configure import conf @conf def find_gxx(conf): """ - Find the program g++, and if present, try to detect its version number + Finds the program g++, and if present, try to detect its version number """ cxx = conf.find_program(['g++', 'c++'], var='CXX') conf.get_cc_version(cxx, gcc=True) @@ -27,54 +27,51 @@ def gxx_common_flags(conf): """ v = conf.env - v['CXX_SRC_F'] = [] - v['CXX_TGT_F'] = ['-c', '-o'] + v.CXX_SRC_F = [] + v.CXX_TGT_F = ['-c', '-o'] - # linker - if not v['LINK_CXX']: v['LINK_CXX'] = v['CXX'] - v['CXXLNK_SRC_F'] = [] - v['CXXLNK_TGT_F'] = ['-o'] - v['CPPPATH_ST'] = '-I%s' - v['DEFINES_ST'] = '-D%s' + if not v.LINK_CXX: + v.LINK_CXX = v.CXX - v['LIB_ST'] = '-l%s' # template for adding libs - v['LIBPATH_ST'] = '-L%s' # template for adding libpaths - v['STLIB_ST'] = '-l%s' - v['STLIBPATH_ST'] = '-L%s' - v['RPATH_ST'] = '-Wl,-rpath,%s' + v.CXXLNK_SRC_F = [] + v.CXXLNK_TGT_F = ['-o'] + v.CPPPATH_ST = '-I%s' + v.DEFINES_ST = '-D%s' - v['SONAME_ST'] = '-Wl,-h,%s' - v['SHLIB_MARKER'] = '-Wl,-Bdynamic' - v['STLIB_MARKER'] = '-Wl,-Bstatic' + v.LIB_ST = '-l%s' # template for adding libs + v.LIBPATH_ST = '-L%s' # template for adding libpaths + v.STLIB_ST = '-l%s' + v.STLIBPATH_ST = '-L%s' + v.RPATH_ST = '-Wl,-rpath,%s' - # program - v['cxxprogram_PATTERN'] = '%s' + v.SONAME_ST = '-Wl,-h,%s' + v.SHLIB_MARKER = '-Wl,-Bdynamic' + v.STLIB_MARKER = '-Wl,-Bstatic' - # shared library - v['CXXFLAGS_cxxshlib'] = ['-fPIC'] - v['LINKFLAGS_cxxshlib'] = ['-shared'] - v['cxxshlib_PATTERN'] = 'lib%s.so' + v.cxxprogram_PATTERN = '%s' - # static lib - v['LINKFLAGS_cxxstlib'] = ['-Wl,-Bstatic'] - v['cxxstlib_PATTERN'] = 'lib%s.a' + v.CXXFLAGS_cxxshlib = ['-fPIC'] + v.LINKFLAGS_cxxshlib = ['-shared'] + v.cxxshlib_PATTERN = 'lib%s.so' - # osx stuff - v['LINKFLAGS_MACBUNDLE'] = ['-bundle', '-undefined', 'dynamic_lookup'] - v['CXXFLAGS_MACBUNDLE'] = ['-fPIC'] - v['macbundle_PATTERN'] = '%s.bundle' + v.LINKFLAGS_cxxstlib = ['-Wl,-Bstatic'] + v.cxxstlib_PATTERN = 'lib%s.a' + + v.LINKFLAGS_MACBUNDLE = ['-bundle', '-undefined', 'dynamic_lookup'] + v.CXXFLAGS_MACBUNDLE = ['-fPIC'] + v.macbundle_PATTERN = '%s.bundle' @conf def gxx_modifier_win32(conf): """Configuration flags for executing gcc on Windows""" v = conf.env - v['cxxprogram_PATTERN'] = '%s.exe' + v.cxxprogram_PATTERN = '%s.exe' - v['cxxshlib_PATTERN'] = '%s.dll' - v['implib_PATTERN'] = 'lib%s.dll.a' - v['IMPLIB_ST'] = '-Wl,--out-implib,%s' + v.cxxshlib_PATTERN = '%s.dll' + v.implib_PATTERN = 'lib%s.dll.a' + v.IMPLIB_ST = '-Wl,--out-implib,%s' - v['CXXFLAGS_cxxshlib'] = [] + v.CXXFLAGS_cxxshlib = [] # Auto-import is enabled by default even without this option, # but enabling it explicitly has the nice effect of suppressing the rather boring, debug-level messages @@ -86,43 +83,43 @@ def gxx_modifier_cygwin(conf): """Configuration flags for executing g++ on Cygwin""" gxx_modifier_win32(conf) v = conf.env - v['cxxshlib_PATTERN'] = 'cyg%s.dll' + v.cxxshlib_PATTERN = 'cyg%s.dll' v.append_value('LINKFLAGS_cxxshlib', ['-Wl,--enable-auto-image-base']) - v['CXXFLAGS_cxxshlib'] = [] + v.CXXFLAGS_cxxshlib = [] @conf def gxx_modifier_darwin(conf): """Configuration flags for executing g++ on MacOS""" v = conf.env - v['CXXFLAGS_cxxshlib'] = ['-fPIC'] - v['LINKFLAGS_cxxshlib'] = ['-dynamiclib'] - v['cxxshlib_PATTERN'] = 'lib%s.dylib' - v['FRAMEWORKPATH_ST'] = '-F%s' - v['FRAMEWORK_ST'] = ['-framework'] - v['ARCH_ST'] = ['-arch'] + v.CXXFLAGS_cxxshlib = ['-fPIC'] + v.LINKFLAGS_cxxshlib = ['-dynamiclib'] + v.cxxshlib_PATTERN = 'lib%s.dylib' + v.FRAMEWORKPATH_ST = '-F%s' + v.FRAMEWORK_ST = ['-framework'] + v.ARCH_ST = ['-arch'] - v['LINKFLAGS_cxxstlib'] = [] + v.LINKFLAGS_cxxstlib = [] - v['SHLIB_MARKER'] = [] - v['STLIB_MARKER'] = [] - v['SONAME_ST'] = [] + v.SHLIB_MARKER = [] + v.STLIB_MARKER = [] + v.SONAME_ST = [] @conf def gxx_modifier_aix(conf): """Configuration flags for executing g++ on AIX""" v = conf.env - v['LINKFLAGS_cxxprogram']= ['-Wl,-brtl'] + v.LINKFLAGS_cxxprogram= ['-Wl,-brtl'] - v['LINKFLAGS_cxxshlib'] = ['-shared', '-Wl,-brtl,-bexpfull'] - v['SHLIB_MARKER'] = [] + v.LINKFLAGS_cxxshlib = ['-shared', '-Wl,-brtl,-bexpfull'] + v.SHLIB_MARKER = [] @conf def gxx_modifier_hpux(conf): v = conf.env - v['SHLIB_MARKER'] = [] - v['STLIB_MARKER'] = [] - v['CFLAGS_cxxshlib'] = ['-fPIC','-DPIC'] - v['cxxshlib_PATTERN'] = 'lib%s.sl' + v.SHLIB_MARKER = [] + v.STLIB_MARKER = [] + v.CFLAGS_cxxshlib = ['-fPIC','-DPIC'] + v.cxxshlib_PATTERN = 'lib%s.sl' @conf def gxx_modifier_openbsd(conf): @@ -131,9 +128,9 @@ def gxx_modifier_openbsd(conf): @conf def gcc_modifier_osf1V(conf): v = conf.env - v['SHLIB_MARKER'] = [] - v['STLIB_MARKER'] = [] - v['SONAME_ST'] = [] + v.SHLIB_MARKER = [] + v.STLIB_MARKER = [] + v.SONAME_ST = [] @conf def gxx_modifier_platform(conf): diff --git a/waflib/Tools/icc.py b/waflib/Tools/icc.py index dbfe9957..14f9fe5d 100644 --- a/waflib/Tools/icc.py +++ b/waflib/Tools/icc.py @@ -4,7 +4,7 @@ # Thomas Nagy 2009-2016 (ita) """ -Detect the Intel C compiler +Detects the Intel C compiler """ import sys @@ -14,11 +14,8 @@ from waflib.Configure import conf @conf def find_icc(conf): """ - Find the program icc and execute it to ensure it really is icc + Finds the program icc and execute it to ensure it really is icc """ - if sys.platform == 'cygwin': - conf.fatal('The Intel compiler does not work on Cygwin') - cc = conf.find_program(['icc', 'ICL'], var='CC') conf.get_cc_version(cc, icc=True) conf.env.CC_NAME = 'icc' diff --git a/waflib/Tools/icpc.py b/waflib/Tools/icpc.py index d9b93d34..1997121c 100644 --- a/waflib/Tools/icpc.py +++ b/waflib/Tools/icpc.py @@ -3,7 +3,7 @@ # Thomas Nagy 2009-2016 (ita) """ -Detect the Intel C++ compiler +Detects the Intel C++ compiler """ import sys @@ -13,11 +13,8 @@ from waflib.Configure import conf @conf def find_icpc(conf): """ - Find the program icpc, and execute it to ensure it really is icpc + Finds the program icpc, and execute it to ensure it really is icpc """ - if sys.platform == 'cygwin': - conf.fatal('The Intel compiler does not work on Cygwin') - cxx = conf.find_program('icpc', var='CXX') conf.get_cc_version(cxx, icc=True) conf.env.CXX_NAME = 'icc' diff --git a/waflib/Tools/ifort.py b/waflib/Tools/ifort.py index 60fdbb1e..94d66f7d 100644 --- a/waflib/Tools/ifort.py +++ b/waflib/Tools/ifort.py @@ -68,7 +68,7 @@ def get_ifort_version(conf, fc): if not match: conf.fatal('cannot determine ifort version.') k = match.groupdict() - conf.env['FC_VERSION'] = (k['major'], k['minor']) + conf.env.FC_VERSION = (k['major'], k['minor']) def configure(conf): if Utils.is_win32: @@ -158,8 +158,8 @@ def setup_ifort(conf, versiondict): :return: the compiler, revision, path, include dirs, library paths and target architecture :rtype: tuple of strings """ - platforms = Utils.to_list(conf.env['MSVC_TARGETS']) or [i for i,j in all_ifort_platforms] - desired_versions = conf.env['MSVC_VERSIONS'] or list(reversed(list(versiondict.keys()))) + platforms = Utils.to_list(conf.env.MSVC_TARGETS) or [i for i,j in all_ifort_platforms] + desired_versions = conf.env.MSVC_VERSIONS or list(reversed(list(versiondict.keys()))) for version in desired_versions: try: targets = versiondict[version] @@ -317,9 +317,9 @@ def _get_prog_names(self, compiler): def find_ifort_win32(conf): # the autodetection is supposed to be performed before entering in this method v = conf.env - path = v['PATH'] - compiler = v['MSVC_COMPILER'] - version = v['MSVC_VERSION'] + path = v.PATH + compiler = v.MSVC_COMPILER + version = v.MSVC_VERSION compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler) v.IFORT_MANIFEST = (compiler == 'intel' and version >= 11) @@ -333,21 +333,19 @@ def find_ifort_win32(conf): if not conf.cmd_and_log(fc + ['/nologo', '/help'], env=env): conf.fatal('not intel fortran compiler could not be identified') - v['FC_NAME'] = 'IFORT' + v.FC_NAME = 'IFORT' - # linker - if not v['LINK_FC']: + if not v.LINK_FC: conf.find_program(linker_name, var='LINK_FC', path_list=path, mandatory=True) - # staticlib linker - if not v['AR']: + if not v.AR: conf.find_program(lib_name, path_list=path, var='AR', mandatory=True) - v['ARFLAGS'] = ['/nologo'] + v.ARFLAGS = ['/nologo'] # manifest tool. Not required for VS 2003 and below. Must have for VS 2005 and later if v.IFORT_MANIFEST: conf.find_program('MT', path_list=path, var='MT') - v['MTFLAGS'] = ['/nologo'] + v.MTFLAGS = ['/nologo'] try: conf.load('winres') diff --git a/waflib/Tools/irixcc.py b/waflib/Tools/irixcc.py index 55eb70be..706ec496 100644 --- a/waflib/Tools/irixcc.py +++ b/waflib/Tools/irixcc.py @@ -1,9 +1,9 @@ #! /usr/bin/env python +# encoding: utf-8 # imported from samba """ -compiler definition for irix/MIPSpro cc compiler -based on suncc.py from waf +Compiler definition for irix/MIPSpro cc compiler """ from waflib.Tools import ccroot, ar @@ -13,41 +13,46 @@ from waflib.Configure import conf def find_irixcc(conf): v = conf.env cc = None - if v['CC']: cc = v['CC'] - elif 'CC' in conf.environ: cc = conf.environ['CC'] - if not cc: cc = conf.find_program('cc', var='CC') - if not cc: conf.fatal('irixcc was not found') + if v.CC: + cc = v.CC + elif 'CC' in conf.environ: + cc = conf.environ['CC'] + if not cc: + cc = conf.find_program('cc', var='CC') + if not cc: + conf.fatal('irixcc was not found') try: conf.cmd_and_log(cc + ['-version']) except Exception: conf.fatal('%r -version could not be executed' % cc) - v['CC'] = cc - v['CC_NAME'] = 'irix' + v.CC = cc + v.CC_NAME = 'irix' @conf def irixcc_common_flags(conf): v = conf.env - v['CC_SRC_F'] = '' - v['CC_TGT_F'] = ['-c', '-o'] - v['CPPPATH_ST'] = '-I%s' - v['DEFINES_ST'] = '-D%s' + v.CC_SRC_F = '' + v.CC_TGT_F = ['-c', '-o'] + v.CPPPATH_ST = '-I%s' + v.DEFINES_ST = '-D%s' - # linker - if not v['LINK_CC']: v['LINK_CC'] = v['CC'] - v['CCLNK_SRC_F'] = '' - v['CCLNK_TGT_F'] = ['-o'] + if not v.LINK_CC: + v.LINK_CC = v.CC - v['LIB_ST'] = '-l%s' # template for adding libs - v['LIBPATH_ST'] = '-L%s' # template for adding libpaths - v['STLIB_ST'] = '-l%s' - v['STLIBPATH_ST'] = '-L%s' + v.CCLNK_SRC_F = '' + v.CCLNK_TGT_F = ['-o'] - v['cprogram_PATTERN'] = '%s' - v['cshlib_PATTERN'] = 'lib%s.so' - v['cstlib_PATTERN'] = 'lib%s.a' + v.LIB_ST = '-l%s' # template for adding libs + v.LIBPATH_ST = '-L%s' # template for adding libpaths + v.STLIB_ST = '-l%s' + v.STLIBPATH_ST = '-L%s' + + v.cprogram_PATTERN = '%s' + v.cshlib_PATTERN = 'lib%s.so' + v.cstlib_PATTERN = 'lib%s.a' def configure(conf): conf.find_irixcc() diff --git a/waflib/Tools/javaw.py b/waflib/Tools/javaw.py index bbe00cb9..feef821a 100644 --- a/waflib/Tools/javaw.py +++ b/waflib/Tools/javaw.py @@ -77,7 +77,7 @@ def apply_java(self): outdir = self.path.get_bld() outdir.mkdir() self.outdir = outdir - self.env['OUTDIR'] = outdir.abspath() + self.env.OUTDIR = outdir.abspath() self.javac_task = tsk = self.create_task('javac') tmp = [] @@ -185,8 +185,8 @@ def jar_files(self): jaropts.append(basedir.bldpath()) jaropts.append('.') - tsk.env['JAROPTS'] = jaropts - tsk.env['JARCREATE'] = jarcreate + tsk.env.JAROPTS = jaropts + tsk.env.JARCREATE = jarcreate if getattr(self, 'javac_task', None): tsk.set_run_after(self.javac_task) @@ -318,7 +318,7 @@ class javadoc(Task.Task): classpath = "".join(classpath) self.last_cmd = lst = [] - lst.extend(Utils.to_list(env['JAVADOC'])) + lst.extend(Utils.to_list(env.JAVADOC)) lst.extend(['-d', self.generator.javadoc_output.abspath()]) lst.extend(['-sourcepath', srcpath]) lst.extend(['-classpath', classpath]) @@ -344,19 +344,21 @@ def configure(self): if 'JAVA_HOME' in self.environ: java_path = [os.path.join(self.environ['JAVA_HOME'], 'bin')] + java_path - self.env['JAVA_HOME'] = [self.environ['JAVA_HOME']] + self.env.JAVA_HOME = [self.environ['JAVA_HOME']] for x in 'javac java jar javadoc'.split(): self.find_program(x, var=x.upper(), path_list=java_path) if 'CLASSPATH' in self.environ: - v['CLASSPATH'] = self.environ['CLASSPATH'] + v.CLASSPATH = self.environ['CLASSPATH'] - if not v['JAR']: self.fatal('jar is required for making java packages') - if not v['JAVAC']: self.fatal('javac is required for compiling java classes') + if not v.JAR: + self.fatal('jar is required for making java packages') + if not v.JAVAC: + self.fatal('javac is required for compiling java classes') - v['JARCREATE'] = 'cf' # can use cvf - v['JAVACFLAGS'] = [] + v.JARCREATE = 'cf' # can use cvf + v.JAVACFLAGS = [] @conf def check_java_class(self, classname, with_classpath=None): @@ -368,12 +370,11 @@ def check_java_class(self, classname, with_classpath=None): :param with_classpath: additional classpath to give :type with_classpath: string """ - javatestdir = '.waf-javatest' classpath = javatestdir - if self.env['CLASSPATH']: - classpath += os.pathsep + self.env['CLASSPATH'] + if self.env.CLASSPATH: + classpath += os.pathsep + self.env.CLASSPATH if isinstance(with_classpath, str): classpath += os.pathsep + with_classpath @@ -383,10 +384,10 @@ def check_java_class(self, classname, with_classpath=None): Utils.writef(os.path.join(javatestdir, 'Test.java'), class_check_source) # Compile the source - self.exec_command(self.env['JAVAC'] + [os.path.join(javatestdir, 'Test.java')], shell=False) + self.exec_command(self.env.JAVAC + [os.path.join(javatestdir, 'Test.java')], shell=False) # Try to run the app - cmd = self.env['JAVA'] + ['-cp', classpath, 'Test', classname] + cmd = self.env.JAVA + ['-cp', classpath, 'Test', classname] self.to_log("%s\n" % str(cmd)) found = self.exec_command(cmd, shell=False) @@ -419,7 +420,7 @@ def check_jni_headers(conf): conf.fatal('set JAVA_HOME in the system environment') # jni requires the jvm - javaHome = conf.env['JAVA_HOME'][0] + javaHome = conf.env.JAVA_HOME[0] dir = conf.root.find_dir(conf.env.JAVA_HOME[0] + '/include') if dir is None: diff --git a/waflib/Tools/ldc2.py b/waflib/Tools/ldc2.py index 35855220..a51c344b 100644 --- a/waflib/Tools/ldc2.py +++ b/waflib/Tools/ldc2.py @@ -8,9 +8,8 @@ from waflib.Configure import conf @conf def find_ldc2(conf): """ - Find the program *ldc2* and set the variable *D* + Finds the program *ldc2* and set the variable *D* """ - conf.find_program(['ldc2'], var='D') out = conf.cmd_and_log(conf.env.D + ['-version']) @@ -20,39 +19,38 @@ def find_ldc2(conf): @conf def common_flags_ldc2(conf): """ - Set the D flags required by *ldc2* + Sets the D flags required by *ldc2* """ - v = conf.env - v['D_SRC_F'] = ['-c'] - v['D_TGT_F'] = '-of%s' + v.D_SRC_F = ['-c'] + v.D_TGT_F = '-of%s' - v['D_LINKER'] = v['D'] - v['DLNK_SRC_F'] = '' - v['DLNK_TGT_F'] = '-of%s' - v['DINC_ST'] = '-I%s' + v.D_LINKER = v.D + v.DLNK_SRC_F = '' + v.DLNK_TGT_F = '-of%s' + v.DINC_ST = '-I%s' - v['DSHLIB_MARKER'] = v['DSTLIB_MARKER'] = '' - v['DSTLIB_ST'] = v['DSHLIB_ST'] = '-L-l%s' - v['DSTLIBPATH_ST'] = v['DLIBPATH_ST'] = '-L-L%s' + v.DSHLIB_MARKER = v.DSTLIB_MARKER = '' + v.DSTLIB_ST = v.DSHLIB_ST = '-L-l%s' + v.DSTLIBPATH_ST = v.DLIBPATH_ST = '-L-L%s' - v['LINKFLAGS_dshlib'] = ['-L-shared'] + v.LINKFLAGS_dshlib = ['-L-shared'] - v['DHEADER_ext'] = '.di' - v['DFLAGS_d_with_header'] = ['-H', '-Hf'] - v['D_HDR_F'] = '%s' + v.DHEADER_ext = '.di' + v.DFLAGS_d_with_header = ['-H', '-Hf'] + v.D_HDR_F = '%s' - v['LINKFLAGS'] = [] - v['DFLAGS_dshlib'] = ['-relocation-model=pic'] + v.LINKFLAGS = [] + v.DFLAGS_dshlib = ['-relocation-model=pic'] def configure(conf): """ Configuration for *ldc2* """ - conf.find_ldc2() conf.load('ar') conf.load('d') conf.common_flags_ldc2() conf.d_platform_flags() + diff --git a/waflib/Tools/msvc.py b/waflib/Tools/msvc.py index e0266b24..9d65cc15 100644 --- a/waflib/Tools/msvc.py +++ b/waflib/Tools/msvc.py @@ -15,8 +15,8 @@ Usage:: or:: def configure(conf): - conf.env['MSVC_VERSIONS'] = ['msvc 10.0', 'msvc 9.0', 'msvc 8.0', 'msvc 7.1', 'msvc 7.0', 'msvc 6.0', 'wsdk 7.0', 'intel 11', 'PocketPC 9.0', 'Smartphone 8.0'] - conf.env['MSVC_TARGETS'] = ['x64'] + conf.env.MSVC_VERSIONS = ['msvc 10.0', 'msvc 9.0', 'msvc 8.0', 'msvc 7.1', 'msvc 7.0', 'msvc 6.0', 'wsdk 7.0', 'intel 11', 'PocketPC 9.0', 'Smartphone 8.0'] + conf.env.MSVC_TARGETS = ['x64'] conf.load('msvc') or:: @@ -32,7 +32,7 @@ Platforms and targets will be tested in the order they appear; the first good configuration will be used. To force testing all the configurations that are not used, use the ``--no-msvc-lazy`` option -or set ``conf.env['MSVC_LAZY_AUTODETECT']=False``. +or set ``conf.env.MSVC_LAZY_AUTODETECT=False``. Supported platforms: ia64, x64, x86, x86_amd64, x86_ia64, x86_arm, amd64_x86, amd64_arm @@ -108,14 +108,14 @@ def setup_msvc(conf, versiondict): """ platforms = getattr(Options.options, 'msvc_targets', '').split(',') if platforms == ['']: - platforms=Utils.to_list(conf.env['MSVC_TARGETS']) or [i for i,j in all_msvc_platforms+all_icl_platforms+all_wince_platforms] + platforms=Utils.to_list(conf.env.MSVC_TARGETS) or [i for i,j in all_msvc_platforms+all_icl_platforms+all_wince_platforms] desired_versions = getattr(Options.options, 'msvc_version', '').split(',') if desired_versions == ['']: - desired_versions = conf.env['MSVC_VERSIONS'] or list(reversed(list(versiondict.keys()))) + desired_versions = conf.env.MSVC_VERSIONS or list(reversed(list(versiondict.keys()))) # Override lazy detection by evaluating after the fact. lazy_detect = getattr(Options.options, 'msvc_lazy', True) - if conf.env['MSVC_LAZY_AUTODETECT'] is False: + if conf.env.MSVC_LAZY_AUTODETECT is False: lazy_detect = False if not lazy_detect: @@ -125,7 +125,7 @@ def setup_msvc(conf, versiondict): cfg.evaluate() if not cfg.is_valid: del val[arch] - conf.env['MSVC_INSTALLED_VERSIONS'] = versiondict + conf.env.MSVC_INSTALLED_VERSIONS = versiondict for version in desired_versions: try: @@ -608,7 +608,7 @@ def find_lt_names_msvc(self, libname, is_static=False): '%s.la' % libname, ] - for path in self.env['LIBPATH']: + for path in self.env.LIBPATH: for la in lt_names: laf=os.path.join(path,la) dll=None @@ -655,9 +655,9 @@ def libname_msvc(self, libname, is_static=False): return os.path.join(lt_path,lt_libname) if lt_path != None: - _libpaths=[lt_path] + self.env['LIBPATH'] + _libpaths = [lt_path] + self.env.LIBPATH else: - _libpaths=self.env['LIBPATH'] + _libpaths = self.env.LIBPATH static_libs=[ 'lib%ss.lib' % lib, @@ -695,7 +695,7 @@ def check_lib_msvc(self, libname, is_static=False, uselib_store=None): """ Ideally we should be able to place the lib in the right env var, either STLIB or LIB, but we don't distinguish static libs from shared libs. - This is ok since msvc doesn't have any special linker flag to select static libs (no env['STLIB_MARKER']) + This is ok since msvc doesn't have any special linker flag to select static libs (no env.STLIB_MARKER) """ libn = self.libname_msvc(libname, is_static) @@ -739,16 +739,16 @@ def autodetect(conf, arch=False): compiler, version, path, includes, libdirs, cpu = conf.detect_msvc() if arch: - v['DEST_CPU'] = cpu + v.DEST_CPU = cpu - v['PATH'] = path - v['INCLUDES'] = includes - v['LIBPATH'] = libdirs - v['MSVC_COMPILER'] = compiler + v.PATH = path + v.INCLUDES = includes + v.LIBPATH = libdirs + v.MSVC_COMPILER = compiler try: - v['MSVC_VERSION'] = float(version) + v.MSVC_VERSION = float(version) except TypeError: - v['MSVC_VERSION'] = float(version[:-3]) + v.MSVC_VERSION = float(version[:-3]) def _get_prog_names(conf, compiler): if compiler == 'intel': @@ -770,9 +770,9 @@ def find_msvc(conf): # the autodetection is supposed to be performed before entering in this method v = conf.env - path = v['PATH'] - compiler = v['MSVC_COMPILER'] - version = v['MSVC_VERSION'] + path = v.PATH + compiler = v.MSVC_COMPILER + version = v.MSVC_VERSION compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler) v.MSVC_MANIFEST = (compiler == 'msvc' and version >= 8) or (compiler == 'wsdk' and version >= 6) or (compiler == 'intel' and version >= 11) @@ -787,27 +787,28 @@ def find_msvc(conf): conf.fatal('the msvc compiler could not be identified') # c/c++ compiler - v['CC'] = v['CXX'] = cxx - v['CC_NAME'] = v['CXX_NAME'] = 'msvc' + v.CC = v.CXX = cxx + v.CC_NAME = v.CXX_NAME = 'msvc' # linker - if not v['LINK_CXX']: + if not v.LINK_CXX: # TODO: var=LINK_CXX to let so that LINK_CXX can be overridden? v.LINK_CXX = conf.find_program(linker_name, path_list=path, errmsg='%s was not found (linker)' % linker_name) - if not v['LINK_CC']: - v['LINK_CC'] = v['LINK_CXX'] + if not v.LINK_CC: + v.LINK_CC = v.LINK_CXX # staticlib linker - if not v['AR']: + if not v.AR: stliblink = conf.find_program(lib_name, path_list=path, var='AR') - if not stliblink: return - v['ARFLAGS'] = ['/nologo'] + if not stliblink: + return + v.ARFLAGS = ['/nologo'] # manifest tool. Not required for VS 2003 and below. Must have for VS 2005 and later if v.MSVC_MANIFEST: conf.find_program('MT', path_list=path, var='MT') - v['MTFLAGS'] = ['/nologo'] + v.MTFLAGS = ['/nologo'] try: conf.load('winres') @@ -830,62 +831,58 @@ def msvc_common_flags(conf): """ v = conf.env - v['DEST_BINFMT'] = 'pe' + v.DEST_BINFMT = 'pe' v.append_value('CFLAGS', ['/nologo']) v.append_value('CXXFLAGS', ['/nologo']) v.append_value('LINKFLAGS', ['/nologo']) - v['DEFINES_ST'] = '/D%s' + v.DEFINES_ST = '/D%s' - v['CC_SRC_F'] = '' - v['CC_TGT_F'] = ['/c', '/Fo'] - v['CXX_SRC_F'] = '' - v['CXX_TGT_F'] = ['/c', '/Fo'] + v.CC_SRC_F = '' + v.CC_TGT_F = ['/c', '/Fo'] + v.CXX_SRC_F = '' + v.CXX_TGT_F = ['/c', '/Fo'] if (v.MSVC_COMPILER == 'msvc' and v.MSVC_VERSION >= 8) or (v.MSVC_COMPILER == 'wsdk' and v.MSVC_VERSION >= 6): - v['CC_TGT_F']= ['/FC'] + v['CC_TGT_F'] - v['CXX_TGT_F']= ['/FC'] + v['CXX_TGT_F'] + v.CC_TGT_F = ['/FC'] + v.CC_TGT_F + v.CXX_TGT_F = ['/FC'] + v.CXX_TGT_F - v['CPPPATH_ST'] = '/I%s' # template for adding include paths + v.CPPPATH_ST = '/I%s' # template for adding include paths - v['AR_TGT_F'] = v['CCLNK_TGT_F'] = v['CXXLNK_TGT_F'] = '/OUT:' + v.AR_TGT_F = v.CCLNK_TGT_F = v.CXXLNK_TGT_F = '/OUT:' # Subsystem specific flags - v['CFLAGS_CONSOLE'] = v['CXXFLAGS_CONSOLE'] = ['/SUBSYSTEM:CONSOLE'] - v['CFLAGS_NATIVE'] = v['CXXFLAGS_NATIVE'] = ['/SUBSYSTEM:NATIVE'] - v['CFLAGS_POSIX'] = v['CXXFLAGS_POSIX'] = ['/SUBSYSTEM:POSIX'] - v['CFLAGS_WINDOWS'] = v['CXXFLAGS_WINDOWS'] = ['/SUBSYSTEM:WINDOWS'] - v['CFLAGS_WINDOWSCE'] = v['CXXFLAGS_WINDOWSCE'] = ['/SUBSYSTEM:WINDOWSCE'] + v.CFLAGS_CONSOLE = v.CXXFLAGS_CONSOLE = ['/SUBSYSTEM:CONSOLE'] + v.CFLAGS_NATIVE = v.CXXFLAGS_NATIVE = ['/SUBSYSTEM:NATIVE'] + v.CFLAGS_POSIX = v.CXXFLAGS_POSIX = ['/SUBSYSTEM:POSIX'] + v.CFLAGS_WINDOWS = v.CXXFLAGS_WINDOWS = ['/SUBSYSTEM:WINDOWS'] + v.CFLAGS_WINDOWSCE = v.CXXFLAGS_WINDOWSCE = ['/SUBSYSTEM:WINDOWSCE'] # CRT specific flags - v['CFLAGS_CRT_MULTITHREADED'] = v['CXXFLAGS_CRT_MULTITHREADED'] = ['/MT'] - v['CFLAGS_CRT_MULTITHREADED_DLL'] = v['CXXFLAGS_CRT_MULTITHREADED_DLL'] = ['/MD'] + v.CFLAGS_CRT_MULTITHREADED = v.CXXFLAGS_CRT_MULTITHREADED = ['/MT'] + v.CFLAGS_CRT_MULTITHREADED_DLL = v.CXXFLAGS_CRT_MULTITHREADED_DLL = ['/MD'] - v['CFLAGS_CRT_MULTITHREADED_DBG'] = v['CXXFLAGS_CRT_MULTITHREADED_DBG'] = ['/MTd'] - v['CFLAGS_CRT_MULTITHREADED_DLL_DBG'] = v['CXXFLAGS_CRT_MULTITHREADED_DLL_DBG'] = ['/MDd'] + v.CFLAGS_CRT_MULTITHREADED_DBG = v.CXXFLAGS_CRT_MULTITHREADED_DBG = ['/MTd'] + v.CFLAGS_CRT_MULTITHREADED_DLL_DBG = v.CXXFLAGS_CRT_MULTITHREADED_DLL_DBG = ['/MDd'] - # linker - v['LIB_ST'] = '%s.lib' # template for adding shared libs - v['LIBPATH_ST'] = '/LIBPATH:%s' # template for adding libpaths - v['STLIB_ST'] = '%s.lib' - v['STLIBPATH_ST'] = '/LIBPATH:%s' + v.LIB_ST = '%s.lib' # template for adding shared libs + v.LIBPATH_ST = '/LIBPATH:%s' # template for adding libpaths + v.STLIB_ST = '%s.lib' + v.STLIBPATH_ST = '/LIBPATH:%s' - if v['MSVC_MANIFEST']: + if v.MSVC_MANIFEST: v.append_value('LINKFLAGS', ['/MANIFEST']) - # shared library - v['CFLAGS_cshlib'] = [] - v['CXXFLAGS_cxxshlib'] = [] - v['LINKFLAGS_cshlib'] = v['LINKFLAGS_cxxshlib'] = ['/DLL'] - v['cshlib_PATTERN'] = v['cxxshlib_PATTERN'] = '%s.dll' - v['implib_PATTERN'] = '%s.lib' - v['IMPLIB_ST'] = '/IMPLIB:%s' + v.CFLAGS_cshlib = [] + v.CXXFLAGS_cxxshlib = [] + v.LINKFLAGS_cshlib = v.LINKFLAGS_cxxshlib = ['/DLL'] + v.cshlib_PATTERN = v.cxxshlib_PATTERN = '%s.dll' + v.implib_PATTERN = '%s.lib' + v.IMPLIB_ST = '/IMPLIB:%s' - # static library - v['LINKFLAGS_cstlib'] = [] - v['cstlib_PATTERN'] = v['cxxstlib_PATTERN'] = '%s.lib' + v.LINKFLAGS_cstlib = [] + v.cstlib_PATTERN = v.cxxstlib_PATTERN = '%s.lib' - # program - v['cprogram_PATTERN'] = v['cxxprogram_PATTERN'] = '%s.exe' + v.cprogram_PATTERN = v.cxxprogram_PATTERN = '%s.exe' ####################################################################################################### diff --git a/waflib/Tools/perl.py b/waflib/Tools/perl.py index e513332e..fc2b09a3 100644 --- a/waflib/Tools/perl.py +++ b/waflib/Tools/perl.py @@ -37,7 +37,7 @@ def init_perlext(self): """ self.uselib = self.to_list(getattr(self, 'uselib', [])) if not 'PERLEXT' in self.uselib: self.uselib.append('PERLEXT') - self.env['cshlib_PATTERN'] = self.env['cxxshlib_PATTERN'] = self.env['perlext_PATTERN'] + self.env.cshlib_PATTERN = self.env.cxxshlib_PATTERN = self.env.perlext_PATTERN @extension('.xs') def xsubpp_file(self, node): @@ -80,7 +80,7 @@ def check_perl_version(self, minver=None): if ver < minver: res = False - self.end_msg(version, color=res and "GREEN" or "YELLOW") + self.end_msg(version, color=res and 'GREEN' or 'YELLOW') return res @conf @@ -133,18 +133,18 @@ def check_perl_ext_devel(self): return xsubpp return self.find_program('xsubpp') - env['LINKFLAGS_PERLEXT'] = cfg_lst('$Config{lddlflags}') - env['INCLUDES_PERLEXT'] = cfg_lst('$Config{archlib}/CORE') - env['CFLAGS_PERLEXT'] = cfg_lst('$Config{ccflags} $Config{cccdlflags}') - env['EXTUTILS_TYPEMAP'] = cfg_lst('$Config{privlib}/ExtUtils/typemap') - env['XSUBPP'] = find_xsubpp() + env.LINKFLAGS_PERLEXT = cfg_lst('$Config{lddlflags}') + env.INCLUDES_PERLEXT = cfg_lst('$Config{archlib}/CORE') + env.CFLAGS_PERLEXT = cfg_lst('$Config{ccflags} $Config{cccdlflags}') + env.EXTUTILS_TYPEMAP = cfg_lst('$Config{privlib}/ExtUtils/typemap') + env.XSUBPP = find_xsubpp() if not getattr(Options.options, 'perlarchdir', None): - env['ARCHDIR_PERL'] = cfg_str('$Config{sitearch}') + env.ARCHDIR_PERL = cfg_str('$Config{sitearch}') else: - env['ARCHDIR_PERL'] = getattr(Options.options, 'perlarchdir') + env.ARCHDIR_PERL = getattr(Options.options, 'perlarchdir') - env['perlext_PATTERN'] = '%s.' + cfg_str('$Config{dlext}') + env.perlext_PATTERN = '%s.' + cfg_str('$Config{dlext}') def options(opt): """ @@ -152,3 +152,4 @@ def options(opt): """ 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) + diff --git a/waflib/Tools/python.py b/waflib/Tools/python.py index a42b915e..c9d0afc4 100644 --- a/waflib/Tools/python.py +++ b/waflib/Tools/python.py @@ -287,14 +287,14 @@ def check_python_headers(conf, features='pyembed pyext'): features = Utils.to_list(features) assert ('pyembed' in features) or ('pyext' in features), "check_python_headers features must include 'pyembed' and/or 'pyext'" env = conf.env - if not env['CC_NAME'] and not env['CXX_NAME']: + if not env.CC_NAME and not env.CXX_NAME: conf.fatal('load a compiler first (gcc, g++, ..)') # bypass all the code below for cross-compilation if conf.python_cross_compile(features): return - if not env['PYTHON_VERSION']: + if not env.PYTHON_VERSION: conf.check_python_version() pybin = env.PYTHON @@ -315,11 +315,11 @@ def check_python_headers(conf, features='pyembed pyext'): x = 'MACOSX_DEPLOYMENT_TARGET' if dct[x]: env[x] = conf.environ[x] = dct[x] - env['pyext_PATTERN'] = '%s' + dct['SO'] # not a mistake + env.pyext_PATTERN = '%s' + dct['SO'] # not a mistake # Try to get pythonX.Y-config - num = '.'.join(env['PYTHON_VERSION'].split('.')[:2]) + num = '.'.join(env.PYTHON_VERSION.split('.')[:2]) conf.find_program([''.join(pybin) + '-config', 'python%s-config' % num, 'python-config-%s' % num, 'python%sm-config' % num], var='PYTHON_CONFIG', msg="python-config", mandatory=False) if env.PYTHON_CONFIG: @@ -370,14 +370,14 @@ def check_python_headers(conf, features='pyembed pyext'): result = None if not dct["LDVERSION"]: - dct["LDVERSION"] = env['PYTHON_VERSION'] + dct["LDVERSION"] = env.PYTHON_VERSION # further simplification will be complicated - for name in ('python' + dct['LDVERSION'], 'python' + env['PYTHON_VERSION'] + 'm', 'python' + env['PYTHON_VERSION'].replace('.', '')): + for name in ('python' + dct['LDVERSION'], 'python' + env.PYTHON_VERSION + 'm', 'python' + env.PYTHON_VERSION.replace('.', '')): # LIBPATH_PYEMBED is already set; see if it works. - if not result and env['LIBPATH_PYEMBED']: - path = env['LIBPATH_PYEMBED'] + if not result and env.LIBPATH_PYEMBED: + path = env.LIBPATH_PYEMBED conf.to_log("\n\n# Trying default LIBPATH_PYEMBED: %r\n" % path) result = conf.check(lib=name, uselib='PYEMBED', libpath=path, mandatory=False, msg='Checking for library %s in LIBPATH_PYEMBED' % name) @@ -400,7 +400,7 @@ def check_python_headers(conf, features='pyembed pyext'): break # do not forget to set LIBPATH_PYEMBED if result: - env['LIBPATH_PYEMBED'] = path + env.LIBPATH_PYEMBED = path env.append_value('LIB_PYEMBED', [name]) else: conf.to_log("\n\n### LIB NOT FOUND\n") @@ -408,18 +408,18 @@ def check_python_headers(conf, features='pyembed pyext'): # under certain conditions, python extensions must link to # python libraries, not just python embedding programs. if Utils.is_win32 or dct['Py_ENABLE_SHARED']: - env['LIBPATH_PYEXT'] = env['LIBPATH_PYEMBED'] - env['LIB_PYEXT'] = env['LIB_PYEMBED'] + env.LIBPATH_PYEXT = env.LIBPATH_PYEMBED + env.LIB_PYEXT = env.LIB_PYEMBED conf.to_log("Include path for Python extensions (found via distutils module): %r\n" % (dct['INCLUDEPY'],)) - env['INCLUDES_PYEXT'] = [dct['INCLUDEPY']] - env['INCLUDES_PYEMBED'] = [dct['INCLUDEPY']] + env.INCLUDES_PYEXT = [dct['INCLUDEPY']] + env.INCLUDES_PYEMBED = [dct['INCLUDEPY']] # Code using the Python API needs to be compiled with -fno-strict-aliasing - if env['CC_NAME'] == 'gcc': + if env.CC_NAME == 'gcc': env.append_value('CFLAGS_PYEMBED', ['-fno-strict-aliasing']) env.append_value('CFLAGS_PYEXT', ['-fno-strict-aliasing']) - if env['CXX_NAME'] == 'gcc': + if env.CXX_NAME == 'gcc': env.append_value('CXXFLAGS_PYEMBED', ['-fno-strict-aliasing']) env.append_value('CXXFLAGS_PYEXT', ['-fno-strict-aliasing']) @@ -450,7 +450,7 @@ def check_python_version(conf, minver=None): :type minver: tuple of int """ assert minver is None or isinstance(minver, tuple) - pybin = conf.env['PYTHON'] + pybin = conf.env.PYTHON if not pybin: conf.fatal('could not find the python executable') @@ -467,11 +467,11 @@ def check_python_version(conf, minver=None): if result: # define useful environment variables pyver = '.'.join([str(x) for x in pyver_tuple[:2]]) - conf.env['PYTHON_VERSION'] = pyver + conf.env.PYTHON_VERSION = pyver if 'PYTHONDIR' in conf.env: # Check if --pythondir was specified - pydir = conf.env['PYTHONDIR'] + pydir = conf.env.PYTHONDIR elif 'PYTHONDIR' in conf.environ: # Check environment for PYTHONDIR pydir = conf.environ['PYTHONDIR'] @@ -485,14 +485,14 @@ def check_python_version(conf, minver=None): python_LIBDEST = None (pydir,) = conf.get_python_variables( ["get_python_lib(standard_lib=0, prefix=%r) or ''" % conf.env.PREFIX]) if python_LIBDEST is None: - if conf.env['LIBDIR']: - python_LIBDEST = os.path.join(conf.env['LIBDIR'], "python" + pyver) + if conf.env.LIBDIR: + python_LIBDEST = os.path.join(conf.env.LIBDIR, 'python' + pyver) else: - python_LIBDEST = os.path.join(conf.env['PREFIX'], "lib", "python" + pyver) + python_LIBDEST = os.path.join(conf.env.PREFIX, 'lib', 'python' + pyver) if 'PYTHONARCHDIR' in conf.env: # Check if --pythonarchdir was specified - pyarchdir = conf.env['PYTHONARCHDIR'] + pyarchdir = conf.env.PYTHONARCHDIR elif 'PYTHONARCHDIR' in conf.environ: # Check environment for PYTHONDIR pyarchdir = conf.environ['PYTHONARCHDIR'] @@ -506,8 +506,8 @@ def check_python_version(conf, minver=None): conf.define('PYTHONDIR', pydir) conf.define('PYTHONARCHDIR', pyarchdir) - conf.env['PYTHONDIR'] = pydir - conf.env['PYTHONARCHDIR'] = pyarchdir + conf.env.PYTHONDIR = pydir + conf.env.PYTHONARCHDIR = pyarchdir # Feedback pyver_full = '.'.join(map(str, pyver_tuple[:3])) @@ -546,7 +546,7 @@ def check_python_module(conf, module_name, condition=''): msg = '%s (%s)' % (msg, condition) conf.start_msg(msg) try: - ret = conf.cmd_and_log(conf.env['PYTHON'] + ['-c', PYTHON_MODULE_TEMPLATE % module_name]) + ret = conf.cmd_and_log(conf.env.PYTHON + ['-c', PYTHON_MODULE_TEMPLATE % module_name]) except Exception: conf.end_msg(False) conf.fatal('Could not find the python module %r' % module_name) @@ -579,17 +579,17 @@ def configure(conf): """ v = conf.env if Options.options.pythondir: - v['PYTHONDIR'] = Options.options.pythondir + v.PYTHONDIR = Options.options.pythondir if Options.options.pythonarchdir: - v['PYTHONARCHDIR'] = Options.options.pythonarchdir + v.PYTHONARCHDIR = Options.options.pythonarchdir conf.find_program('python', var='PYTHON', value=Options.options.pythondir or sys.executable) - v['PYFLAGS'] = '' - v['PYFLAGS_OPT'] = '-O' + v.PYFLAGS = '' + v.PYFLAGS_OPT = '-O' - v['PYC'] = getattr(Options.options, 'pyc', 1) - v['PYO'] = getattr(Options.options, 'pyo', 1) + v.PYC = getattr(Options.options, 'pyc', 1) + v.PYO = getattr(Options.options, 'pyo', 1) try: v.PYTAG = conf.cmd_and_log(conf.env.PYTHON + ['-c', "import imp;print(imp.get_tag())"]).strip() diff --git a/waflib/Tools/qt5.py b/waflib/Tools/qt5.py index 2d7459d2..ce8bf87d 100644 --- a/waflib/Tools/qt5.py +++ b/waflib/Tools/qt5.py @@ -298,7 +298,7 @@ def create_rcc_task(self, node): def create_uic_task(self, node): "hook for uic tasks" uictask = self.create_task('ui5', node) - uictask.outputs = [node.parent.find_or_declare(self.env['ui_PATTERN'] % node.name[:-3])] + uictask.outputs = [node.parent.find_or_declare(self.env.ui_PATTERN % node.name[:-3])] @extension('.ts') def add_lang(self, node): @@ -368,7 +368,7 @@ def apply_qt5(self): self.link_task.inputs.append(k.outputs[0]) lst = [] - for flag in self.to_list(self.env['CXXFLAGS']): + for flag in self.to_list(self.env.CXXFLAGS): if len(flag) < 2: continue f = flag[0:2] if f in ('-D', '-I', '/D', '/I'): @@ -610,10 +610,10 @@ def find_qt5_binaries(self): find_bin(['lrelease-qt5', 'lrelease'], 'QT_LRELEASE') find_bin(['lupdate-qt5', 'lupdate'], 'QT_LUPDATE') - env['UIC_ST'] = '%s -o %s' - env['MOC_ST'] = '-o' - env['ui_PATTERN'] = 'ui_%s.h' - env['QT_LRELEASE_FLAGS'] = ['-silent'] + env.UIC_ST = '%s -o %s' + env.MOC_ST = '-o' + env.ui_PATTERN = 'ui_%s.h' + env.QT_LRELEASE_FLAGS = ['-silent'] env.MOCCPPPATH_ST = '-I%s' env.MOCDEFINES_ST = '-D%s' diff --git a/waflib/Tools/ruby.py b/waflib/Tools/ruby.py index ec327d80..4ceed3bc 100644 --- a/waflib/Tools/ruby.py +++ b/waflib/Tools/ruby.py @@ -46,7 +46,7 @@ def apply_ruby_so_name(self): """ Strip the *lib* prefix from ruby extensions """ - self.env['cshlib_PATTERN'] = self.env['cxxshlib_PATTERN'] = self.env['rubyext_PATTERN'] + self.env.cshlib_PATTERN = self.env.cxxshlib_PATTERN = self.env.rubyext_PATTERN @conf def check_ruby_version(self, minver=()): @@ -171,7 +171,7 @@ class run_ruby(Task.Task): ctx.check_ruby_version() def build(bld): - bld.env['RBFLAGS'] = '-e puts "hello world"' + bld.env.RBFLAGS = '-e puts "hello world"' bld(source='a_ruby_file.rb') """ run_str = '${RUBY} ${RBFLAGS} -I ${SRC[0].parent.abspath()} ${SRC}' diff --git a/waflib/Tools/suncc.py b/waflib/Tools/suncc.py index 295dcad2..5da3d577 100644 --- a/waflib/Tools/suncc.py +++ b/waflib/Tools/suncc.py @@ -9,11 +9,10 @@ from waflib.Configure import conf @conf def find_scc(conf): """ - Detect the Sun C compiler + Detects the Sun C compiler """ v = conf.env cc = conf.find_program('cc', var='CC') - try: conf.cmd_and_log(cc + ['-flags']) except Exception: @@ -28,36 +27,34 @@ def scc_common_flags(conf): """ v = conf.env - v['CC_SRC_F'] = [] - v['CC_TGT_F'] = ['-c', '-o', ''] + v.CC_SRC_F = [] + v.CC_TGT_F = ['-c', '-o', ''] - # linker - if not v['LINK_CC']: v['LINK_CC'] = v['CC'] - v['CCLNK_SRC_F'] = '' - v['CCLNK_TGT_F'] = ['-o', ''] - v['CPPPATH_ST'] = '-I%s' - v['DEFINES_ST'] = '-D%s' + if not v.LINK_CC: + v.LINK_CC = v.CC - v['LIB_ST'] = '-l%s' # template for adding libs - v['LIBPATH_ST'] = '-L%s' # template for adding libpaths - v['STLIB_ST'] = '-l%s' - v['STLIBPATH_ST'] = '-L%s' + v.CCLNK_SRC_F = '' + v.CCLNK_TGT_F = ['-o', ''] + v.CPPPATH_ST = '-I%s' + v.DEFINES_ST = '-D%s' - v['SONAME_ST'] = '-Wl,-h,%s' - v['SHLIB_MARKER'] = '-Bdynamic' - v['STLIB_MARKER'] = '-Bstatic' + v.LIB_ST = '-l%s' # template for adding libs + v.LIBPATH_ST = '-L%s' # template for adding libpaths + v.STLIB_ST = '-l%s' + v.STLIBPATH_ST = '-L%s' - # program - v['cprogram_PATTERN'] = '%s' + v.SONAME_ST = '-Wl,-h,%s' + v.SHLIB_MARKER = '-Bdynamic' + v.STLIB_MARKER = '-Bstatic' - # shared library - v['CFLAGS_cshlib'] = ['-xcode=pic32', '-DPIC'] - v['LINKFLAGS_cshlib'] = ['-G'] - v['cshlib_PATTERN'] = 'lib%s.so' + v.cprogram_PATTERN = '%s' - # static lib - v['LINKFLAGS_cstlib'] = ['-Bstatic'] - v['cstlib_PATTERN'] = 'lib%s.a' + v.CFLAGS_cshlib = ['-xcode=pic32', '-DPIC'] + v.LINKFLAGS_cshlib = ['-G'] + v.cshlib_PATTERN = 'lib%s.so' + + v.LINKFLAGS_cstlib = ['-Bstatic'] + v.cstlib_PATTERN = 'lib%s.a' def configure(conf): conf.find_scc() @@ -66,3 +63,4 @@ def configure(conf): conf.cc_load_tools() conf.cc_add_flags() conf.link_add_flags() + diff --git a/waflib/Tools/suncxx.py b/waflib/Tools/suncxx.py index e2fc7b2c..bd778204 100644 --- a/waflib/Tools/suncxx.py +++ b/waflib/Tools/suncxx.py @@ -9,7 +9,7 @@ from waflib.Configure import conf @conf def find_sxx(conf): """ - Detect the sun C++ compiler + Detects the sun C++ compiler """ v = conf.env cc = conf.find_program(['CC', 'c++'], var='CXX') @@ -27,36 +27,34 @@ def sxx_common_flags(conf): """ v = conf.env - v['CXX_SRC_F'] = [] - v['CXX_TGT_F'] = ['-c', '-o', ''] + v.CXX_SRC_F = [] + v.CXX_TGT_F = ['-c', '-o', ''] - # linker - if not v['LINK_CXX']: v['LINK_CXX'] = v['CXX'] - v['CXXLNK_SRC_F'] = [] - v['CXXLNK_TGT_F'] = ['-o', ''] - v['CPPPATH_ST'] = '-I%s' - v['DEFINES_ST'] = '-D%s' + if not v.LINK_CXX: + v.LINK_CXX = v.CXX - v['LIB_ST'] = '-l%s' # template for adding libs - v['LIBPATH_ST'] = '-L%s' # template for adding libpaths - v['STLIB_ST'] = '-l%s' - v['STLIBPATH_ST'] = '-L%s' + v.CXXLNK_SRC_F = [] + v.CXXLNK_TGT_F = ['-o', ''] + v.CPPPATH_ST = '-I%s' + v.DEFINES_ST = '-D%s' - v['SONAME_ST'] = '-Wl,-h,%s' - v['SHLIB_MARKER'] = '-Bdynamic' - v['STLIB_MARKER'] = '-Bstatic' + v.LIB_ST = '-l%s' # template for adding libs + v.LIBPATH_ST = '-L%s' # template for adding libpaths + v.STLIB_ST = '-l%s' + v.STLIBPATH_ST = '-L%s' - # program - v['cxxprogram_PATTERN'] = '%s' + v.SONAME_ST = '-Wl,-h,%s' + v.SHLIB_MARKER = '-Bdynamic' + v.STLIB_MARKER = '-Bstatic' - # shared library - v['CXXFLAGS_cxxshlib'] = ['-xcode=pic32', '-DPIC'] - v['LINKFLAGS_cxxshlib'] = ['-G'] - v['cxxshlib_PATTERN'] = 'lib%s.so' + v.cxxprogram_PATTERN = '%s' - # static lib - v['LINKFLAGS_cxxstlib'] = ['-Bstatic'] - v['cxxstlib_PATTERN'] = 'lib%s.a' + v.CXXFLAGS_cxxshlib = ['-xcode=pic32', '-DPIC'] + v.LINKFLAGS_cxxshlib = ['-G'] + v.cxxshlib_PATTERN = 'lib%s.so' + + v.LINKFLAGS_cxxstlib = ['-Bstatic'] + v.cxxstlib_PATTERN = 'lib%s.a' def configure(conf): conf.find_sxx() diff --git a/waflib/Tools/tex.py b/waflib/Tools/tex.py index 186d101b..0ef7fc1d 100644 --- a/waflib/Tools/tex.py +++ b/waflib/Tools/tex.py @@ -20,7 +20,7 @@ Example:: outs = 'ps', # 'pdf' or 'ps pdf' deps = 'crossreferencing.lst', # to give dependencies directly prompt = 1, # 0 for the batch mode - ) + ) Notes: @@ -28,10 +28,9 @@ Notes: $ PDFLATEX=luatex waf configure -- This tool doesn't use the target attribute of the task generator +- This tool does not use the target attribute of the task generator (``bld(target=...)``); the target file name is built from the source - base name and the out type(s) - + base name and the output type(s) """ import os, re @@ -41,7 +40,7 @@ from waflib.TaskGen import feature, before_method re_bibunit = re.compile(r'\\(?Pputbib)\[(?P[^\[\]]*)\]',re.M) def bibunitscan(self): """ - Parse the inputs and try to find the *bibunit* dependencies + Parses TeX inputs and try to find the *bibunit* file dependencies :return: list of bibunit files :rtype: list of :py:class:`waflib.Node.Node` @@ -52,7 +51,6 @@ def bibunitscan(self): if not node: return nodes code = node.read() - for match in re_bibunit.finditer(code): path = match.group('file') if path: @@ -66,7 +64,7 @@ def bibunitscan(self): else: Logs.debug('tex: could not find %s', path) - Logs.debug("tex: found the following bibunit files: %s", nodes) + Logs.debug('tex: found the following bibunit files: %s', nodes) return nodes exts_deps_tex = ['', '.ltx', '.tex', '.bib', '.pdf', '.png', '.eps', '.ps', '.sty'] @@ -86,7 +84,7 @@ g_glossaries_re = re.compile('\\@newglossary', re.M) class tex(Task.Task): """ - Compile a tex/latex file. + Compiles a tex/latex file. .. inheritance-diagram:: waflib.Tools.tex.latex waflib.Tools.tex.xelatex waflib.Tools.tex.pdflatex """ @@ -108,7 +106,7 @@ class tex(Task.Task): def exec_command(self, cmd, **kw): """ - Override :py:meth:`waflib.Task.Task.exec_command` to execute the command without buffering (latex may prompt for inputs) + Executes TeX commands without buffering (latex may prompt for inputs) :return: the return code :rtype: int @@ -118,7 +116,7 @@ class tex(Task.Task): def scan_aux(self, node): """ - A recursive regex-based scanner that finds included auxiliary files. + Recursive regex-based scanner that finds included auxiliary files. """ nodes = [node] re_aux = re.compile(r'\\@input{(?P[^{}]*)}', re.M) @@ -132,13 +130,12 @@ class tex(Task.Task): Logs.debug('tex: found aux node %r', found) nodes.append(found) parse_node(found) - parse_node(node) return nodes def scan(self): """ - A recursive regex-based scanner that finds latex dependencies. It uses :py:attr:`waflib.Tools.tex.re_tex` + Recursive regex-based scanner that finds latex dependencies. It uses :py:attr:`waflib.Tools.tex.re_tex` Depending on your needs you might want: @@ -220,7 +217,7 @@ class tex(Task.Task): def check_status(self, msg, retcode): """ - Check an exit status and raise an error with a particular message + Checks an exit status and raise an error with a particular message :param msg: message to display if the code is non-zero :type msg: string @@ -228,12 +225,12 @@ class tex(Task.Task): :type retcode: boolean """ if retcode != 0: - raise Errors.WafError("%r command exit status %r" % (msg, retcode)) + raise Errors.WafError('%r command exit status %r' % (msg, retcode)) def bibfile(self): """ - Parse the *.aux* files to find bibfiles to process. - If yes, execute :py:meth:`waflib.Tools.tex.tex.bibtex_fun` + Parses *.aux* files to find bibfiles to process. + If present, execute :py:meth:`waflib.Tools.tex.tex.bibtex_fun` """ for aux_node in self.aux_nodes: try: @@ -260,8 +257,8 @@ class tex(Task.Task): def bibunits(self): """ - Parse the *.aux* file to find bibunit files. If there are bibunit files, - execute :py:meth:`waflib.Tools.tex.tex.bibtex_fun`. + Parses *.aux* file to find bibunit files. If there are bibunit files, + runs :py:meth:`waflib.Tools.tex.tex.bibtex_fun`. """ try: bibunits = bibunitscan(self) @@ -280,8 +277,8 @@ class tex(Task.Task): def makeindex(self): """ - Look on the filesystem if there is a *.idx* file to process. If yes, execute - :py:meth:`waflib.Tools.tex.tex.makeindex_fun` + Searches the filesystem for *.idx* files to process. If present, + runs :py:meth:`waflib.Tools.tex.tex.makeindex_fun` """ self.idx_node = self.inputs[0].change_ext('.idx') try: @@ -298,13 +295,16 @@ class tex(Task.Task): def bibtopic(self): """ - Additional .aux files from the bibtopic package + Lists additional .aux files from the bibtopic package """ p = self.inputs[0].parent.get_bld() if os.path.exists(os.path.join(p.abspath(), 'btaux.aux')): self.aux_nodes += p.ant_glob('*[0-9].aux') def makeglossaries(self): + """ + Lists additional glossaries from .aux files. If present, runs the makeglossaries program. + """ src_file = self.inputs[0].abspath() base_file = os.path.basename(src_file) base, _ = os.path.splitext(base_file) @@ -324,21 +324,24 @@ class tex(Task.Task): return def texinputs(self): + """ + Returns the list of texinput nodes as a string suitable for the TEXINPUTS environment variables + + :rtype: string + """ return os.pathsep.join([k.abspath() for k in self.texinputs_nodes]) + os.pathsep def run(self): """ - Runs the TeX build process. + Runs the whole TeX build process - It may require multiple passes, depending on the usage of cross-references, - bibliographies, content susceptible of needing such passes. + Multiple passes are required depending on the usage of cross-references, + bibliographies, glossaries, indexes and additional contents The appropriate TeX compiler is called until the *.aux* files stop changing. - - Makeindex and bibtex are called if necessary. """ env = self.env - if not env['PROMPT_LATEX']: + if not env.PROMPT_LATEX: env.append_value('LATEXFLAGS', '-interaction=batchmode') env.append_value('PDFLATEXFLAGS', '-interaction=batchmode') env.append_value('XELATEXFLAGS', '-interaction=batchmode') @@ -376,6 +379,11 @@ class tex(Task.Task): self.call_latex() def hash_aux_nodes(self): + """ + Returns a hash of the .aux file contents + + :rtype: string or bytes + """ try: self.aux_nodes except AttributeError: @@ -386,31 +394,41 @@ class tex(Task.Task): return Utils.h_list([Utils.h_file(x.abspath()) for x in self.aux_nodes]) def call_latex(self): + """ + Runs the TeX compiler once + """ self.env.env = {} self.env.env.update(os.environ) self.env.env.update({'TEXINPUTS': self.texinputs()}) self.env.SRCFILE = self.inputs[0].abspath() self.check_status('error when calling latex', self.texfun()) - class latex(tex): + "Compiles LaTeX files" texfun, vars = Task.compile_fun('${LATEX} ${LATEXFLAGS} ${SRCFILE}', shell=False) + class pdflatex(tex): + "Compiles PdfLaTeX files" texfun, vars = Task.compile_fun('${PDFLATEX} ${PDFLATEXFLAGS} ${SRCFILE}', shell=False) + class xelatex(tex): + "XeLaTeX files" texfun, vars = Task.compile_fun('${XELATEX} ${XELATEXFLAGS} ${SRCFILE}', shell=False) class dvips(Task.Task): + "Converts dvi files to postscript" run_str = '${DVIPS} ${DVIPSFLAGS} ${SRC} -o ${TGT}' color = 'BLUE' after = ['latex', 'pdflatex', 'xelatex'] class dvipdf(Task.Task): + "Converts dvi files to pdf" run_str = '${DVIPDF} ${DVIPDFFLAGS} ${SRC} ${TGT}' color = 'BLUE' after = ['latex', 'pdflatex', 'xelatex'] class pdf2ps(Task.Task): + "Converts pdf files to postscript" run_str = '${PDF2PS} ${PDF2PSFLAGS} ${SRC} ${TGT}' color = 'BLUE' after = ['latex', 'pdflatex', 'xelatex'] @@ -419,7 +437,8 @@ class pdf2ps(Task.Task): @before_method('process_source') def apply_tex(self): """ - Create :py:class:`waflib.Tools.tex.tex` objects, and dvips/dvipdf/pdf2ps tasks if necessary (outs='ps', etc). + Creates :py:class:`waflib.Tools.tex.tex` objects, and + dvips/dvipdf/pdf2ps tasks if necessary (outs='ps', etc). """ if not getattr(self, 'type', None) in ('latex', 'pdflatex', 'xelatex'): self.type = 'pdflatex' @@ -427,7 +446,7 @@ def apply_tex(self): outs = Utils.to_list(getattr(self, 'outs', [])) # prompt for incomplete files (else the batchmode is used) - self.env['PROMPT_LATEX'] = getattr(self, 'prompt', 1) + self.env.PROMPT_LATEX = getattr(self, 'prompt', 1) deps_lst = [] @@ -444,7 +463,6 @@ def apply_tex(self): deps_lst.append(dep) for node in self.to_nodes(self.source): - if self.type == 'latex': task = self.create_task('latex', node, node.change_ext('.dvi')) elif self.type == 'pdflatex': @@ -495,8 +513,7 @@ def apply_tex(self): def configure(self): """ - Try to find the programs tex, latex and others. Do not raise any error if they - are not found. + Find the programs tex, latex and others without raising errors. """ v = self.env for p in 'tex latex pdflatex xelatex bibtex dvips dvipdf ps2pdf makeindex pdf2ps makeglossaries'.split(): @@ -504,5 +521,5 @@ def configure(self): self.find_program(p, var=p.upper()) except self.errors.ConfigurationError: pass - v['DVIPSFLAGS'] = '-Ppdf' + v.DVIPSFLAGS = '-Ppdf' diff --git a/waflib/Tools/vala.py b/waflib/Tools/vala.py index d9955639..d6687dce 100644 --- a/waflib/Tools/vala.py +++ b/waflib/Tools/vala.py @@ -124,7 +124,7 @@ def init_vala_task(self): valatask.install_path = getattr(self, 'install_path', '') valatask.vapi_path = getattr(self, 'vapi_path', '${DATAROOTDIR}/vala/vapi') - valatask.pkg_name = getattr(self, 'pkg_name', self.env['PACKAGE']) + valatask.pkg_name = getattr(self, 'pkg_name', self.env.PACKAGE) valatask.header_path = getattr(self, 'header_path', '${INCLUDEDIR}/%s-%s' % (valatask.pkg_name, _get_api_version())) valatask.install_binding = getattr(self, 'install_binding', True) @@ -275,7 +275,7 @@ def find_valac(self, valac_name, min_version): if valac and valac_version < min_version: self.fatal("%s version %r is too old, need >= %r" % (valac_name, valac_version, min_version)) - self.env['VALAC_VERSION'] = valac_version + self.env.VALAC_VERSION = valac_version return valac @conf @@ -305,7 +305,7 @@ def check_vala_deps(self): """ Load the gobject and gthread packages if they are missing. """ - if not self.env['HAVE_GOBJECT']: + if not self.env.HAVE_GOBJECT: pkg_args = {'package': 'gobject-2.0', 'uselib_store': 'GOBJECT', 'args': '--cflags --libs'} @@ -313,7 +313,7 @@ def check_vala_deps(self): pkg_args['atleast_version'] = Options.options.vala_target_glib self.check_cfg(**pkg_args) - if not self.env['HAVE_GTHREAD']: + if not self.env.HAVE_GTHREAD: pkg_args = {'package': 'gthread-2.0', 'uselib_store': 'GTHREAD', 'args': '--cflags --libs'} diff --git a/waflib/Tools/xlc.py b/waflib/Tools/xlc.py index 600ac5cf..70bb72c0 100644 --- a/waflib/Tools/xlc.py +++ b/waflib/Tools/xlc.py @@ -11,7 +11,7 @@ from waflib.Configure import conf @conf def find_xlc(conf): """ - Detect the Aix C compiler + Detects the Aix C compiler """ cc = conf.find_program(['xlc_r', 'xlc'], var='CC') conf.get_xlc_version(cc) @@ -24,38 +24,36 @@ def xlc_common_flags(conf): """ v = conf.env - v['CC_SRC_F'] = [] - v['CC_TGT_F'] = ['-c', '-o'] + v.CC_SRC_F = [] + v.CC_TGT_F = ['-c', '-o'] - # linker - if not v['LINK_CC']: v['LINK_CC'] = v['CC'] - v['CCLNK_SRC_F'] = [] - v['CCLNK_TGT_F'] = ['-o'] - v['CPPPATH_ST'] = '-I%s' - v['DEFINES_ST'] = '-D%s' + if not v.LINK_CC: + v.LINK_CC = v.CC - v['LIB_ST'] = '-l%s' # template for adding libs - v['LIBPATH_ST'] = '-L%s' # template for adding libpaths - v['STLIB_ST'] = '-l%s' - v['STLIBPATH_ST'] = '-L%s' - v['RPATH_ST'] = '-Wl,-rpath,%s' + v.CCLNK_SRC_F = [] + v.CCLNK_TGT_F = ['-o'] + v.CPPPATH_ST = '-I%s' + v.DEFINES_ST = '-D%s' - v['SONAME_ST'] = [] - v['SHLIB_MARKER'] = [] - v['STLIB_MARKER'] = [] + v.LIB_ST = '-l%s' # template for adding libs + v.LIBPATH_ST = '-L%s' # template for adding libpaths + v.STLIB_ST = '-l%s' + v.STLIBPATH_ST = '-L%s' + v.RPATH_ST = '-Wl,-rpath,%s' - # program - v['LINKFLAGS_cprogram'] = ['-Wl,-brtl'] - v['cprogram_PATTERN'] = '%s' + v.SONAME_ST = [] + v.SHLIB_MARKER = [] + v.STLIB_MARKER = [] - # shared library - v['CFLAGS_cshlib'] = ['-fPIC'] - v['LINKFLAGS_cshlib'] = ['-G', '-Wl,-brtl,-bexpfull'] - v['cshlib_PATTERN'] = 'lib%s.so' + v.LINKFLAGS_cprogram = ['-Wl,-brtl'] + v.cprogram_PATTERN = '%s' - # static lib - v['LINKFLAGS_cstlib'] = [] - v['cstlib_PATTERN'] = 'lib%s.a' + v.CFLAGS_cshlib = ['-fPIC'] + v.LINKFLAGS_cshlib = ['-G', '-Wl,-brtl,-bexpfull'] + v.cshlib_PATTERN = 'lib%s.so' + + v.LINKFLAGS_cstlib = [] + v.cstlib_PATTERN = 'lib%s.a' def configure(conf): conf.find_xlc() diff --git a/waflib/Tools/xlcxx.py b/waflib/Tools/xlcxx.py index cececfc8..19093cc2 100644 --- a/waflib/Tools/xlcxx.py +++ b/waflib/Tools/xlcxx.py @@ -11,7 +11,7 @@ from waflib.Configure import conf @conf def find_xlcxx(conf): """ - Detect the Aix C++ compiler + Detects the Aix C++ compiler """ cxx = conf.find_program(['xlc++_r', 'xlc++'], var='CXX') conf.get_xlc_version(cxx) @@ -24,38 +24,36 @@ def xlcxx_common_flags(conf): """ v = conf.env - v['CXX_SRC_F'] = [] - v['CXX_TGT_F'] = ['-c', '-o'] + v.CXX_SRC_F = [] + v.CXX_TGT_F = ['-c', '-o'] - # linker - if not v['LINK_CXX']: v['LINK_CXX'] = v['CXX'] - v['CXXLNK_SRC_F'] = [] - v['CXXLNK_TGT_F'] = ['-o'] - v['CPPPATH_ST'] = '-I%s' - v['DEFINES_ST'] = '-D%s' + if not v.LINK_CXX: + v.LINK_CXX = v.CXX - v['LIB_ST'] = '-l%s' # template for adding libs - v['LIBPATH_ST'] = '-L%s' # template for adding libpaths - v['STLIB_ST'] = '-l%s' - v['STLIBPATH_ST'] = '-L%s' - v['RPATH_ST'] = '-Wl,-rpath,%s' + v.CXXLNK_SRC_F = [] + v.CXXLNK_TGT_F = ['-o'] + v.CPPPATH_ST = '-I%s' + v.DEFINES_ST = '-D%s' - v['SONAME_ST'] = [] - v['SHLIB_MARKER'] = [] - v['STLIB_MARKER'] = [] + v.LIB_ST = '-l%s' # template for adding libs + v.LIBPATH_ST = '-L%s' # template for adding libpaths + v.STLIB_ST = '-l%s' + v.STLIBPATH_ST = '-L%s' + v.RPATH_ST = '-Wl,-rpath,%s' - # program - v['LINKFLAGS_cxxprogram']= ['-Wl,-brtl'] - v['cxxprogram_PATTERN'] = '%s' + v.SONAME_ST = [] + v.SHLIB_MARKER = [] + v.STLIB_MARKER = [] - # shared library - v['CXXFLAGS_cxxshlib'] = ['-fPIC'] - v['LINKFLAGS_cxxshlib'] = ['-G', '-Wl,-brtl,-bexpfull'] - v['cxxshlib_PATTERN'] = 'lib%s.so' + v.LINKFLAGS_cxxprogram= ['-Wl,-brtl'] + v.cxxprogram_PATTERN = '%s' - # static lib - v['LINKFLAGS_cxxstlib'] = [] - v['cxxstlib_PATTERN'] = 'lib%s.a' + v.CXXFLAGS_cxxshlib = ['-fPIC'] + v.LINKFLAGS_cxxshlib = ['-G', '-Wl,-brtl,-bexpfull'] + v.cxxshlib_PATTERN = 'lib%s.so' + + v.LINKFLAGS_cxxstlib = [] + v.cxxstlib_PATTERN = 'lib%s.a' def configure(conf): conf.find_xlcxx()