diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2010-04-05 08:12:25 +0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-04-05 08:12:25 +0400 |
commit | 01f7d4484e5aa079155c0affc35210eee6959f99 (patch) | |
tree | c0f97c1490c5a4162384e1d3dd92164f9bbd33be /tools | |
parent | ec0266a56cca10c5faa92c54baf2d3bb447ece65 (diff) |
Upgrade to WAF 1.5.15
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/waf-light | 2 | ||||
-rw-r--r-- | tools/wafadmin/Build.py | 9 | ||||
-rw-r--r-- | tools/wafadmin/Configure.py | 2 | ||||
-rw-r--r-- | tools/wafadmin/Constants.py | 6 | ||||
-rw-r--r-- | tools/wafadmin/Node.py | 7 | ||||
-rw-r--r-- | tools/wafadmin/Runner.py | 8 | ||||
-rw-r--r-- | tools/wafadmin/Scripting.py | 10 | ||||
-rw-r--r-- | tools/wafadmin/Task.py | 45 | ||||
-rw-r--r-- | tools/wafadmin/TaskGen.py | 3 | ||||
-rw-r--r-- | tools/wafadmin/Tools/config_c.py | 7 | ||||
-rw-r--r-- | tools/wafadmin/Tools/d.py | 10 | ||||
-rw-r--r-- | tools/wafadmin/Tools/gas.py | 1 | ||||
-rw-r--r-- | tools/wafadmin/Tools/gnu_dirs.py | 2 | ||||
-rw-r--r-- | tools/wafadmin/Tools/msvc.py | 14 | ||||
-rw-r--r-- | tools/wafadmin/Tools/preproc.py | 6 | ||||
-rw-r--r-- | tools/wafadmin/Tools/python.py | 4 | ||||
-rw-r--r-- | tools/wafadmin/Tools/qt4.py | 45 | ||||
-rw-r--r-- | tools/wafadmin/Tools/suncc.py | 3 | ||||
-rw-r--r-- | tools/wafadmin/Tools/suncxx.py | 10 | ||||
-rw-r--r-- | tools/wafadmin/Tools/vala.py | 56 | ||||
-rw-r--r-- | tools/wafadmin/Utils.py | 35 | ||||
-rw-r--r-- | tools/wafadmin/py3kfixes.py | 2 |
22 files changed, 192 insertions, 95 deletions
diff --git a/tools/waf-light b/tools/waf-light index 1fb8ce4ab72..2068d4411ce 100755 --- a/tools/waf-light +++ b/tools/waf-light @@ -37,7 +37,7 @@ if 'PSYCOWAF' in os.environ: try:import psyco;psyco.full() except:pass -VERSION="1.5.14" +VERSION="1.5.15" REVISION="x" INSTALL="x" C1='x' diff --git a/tools/wafadmin/Build.py b/tools/wafadmin/Build.py index f28b80dbb61..83c044ba055 100644 --- a/tools/wafadmin/Build.py +++ b/tools/wafadmin/Build.py @@ -681,8 +681,13 @@ class BuildContext(Utils.Context): for i in xrange(len(self.task_manager.groups)): g = self.task_manager.groups[i] self.task_manager.current_group = i + if Logs.verbose: + Logs.debug('group: group %s' % ([x for x in self.task_manager.groups_names if id(self.task_manager.groups_names[x]) == id(g)][0])) + for tg in g.tasks_gen: if id(tg) in to_compile: + if Logs.verbose: + Logs.debug('group: %s' % tg) tg.post() else: @@ -702,9 +707,13 @@ class BuildContext(Utils.Context): for i in xrange(len(self.task_manager.groups)): g = self.task_manager.groups[i] self.task_manager.current_group = i + if Logs.verbose: + Logs.debug('group: group %s' % ([x for x in self.task_manager.groups_names if id(self.task_manager.groups_names[x]) == id(g)][0])) for tg in g.tasks_gen: if not tg.path.is_child_of(ln): continue + if Logs.verbose: + Logs.debug('group: %s' % tg) tg.post() def env_of_name(self, name): diff --git a/tools/wafadmin/Configure.py b/tools/wafadmin/Configure.py index 163b46dc778..7501cb10312 100644 --- a/tools/wafadmin/Configure.py +++ b/tools/wafadmin/Configure.py @@ -125,7 +125,7 @@ class ConfigurationContext(Utils.Context): except (OSError, IOError): self.fatal('could not open %r for writing' % path) - app = getattr(Utils.g_module, 'APPNAME', '') + app = Utils.g_module.APPNAME if app: ver = getattr(Utils.g_module, 'VERSION', '') if ver: diff --git a/tools/wafadmin/Constants.py b/tools/wafadmin/Constants.py index fa1a7293ad7..f1fceac634a 100644 --- a/tools/wafadmin/Constants.py +++ b/tools/wafadmin/Constants.py @@ -9,9 +9,9 @@ maintainer: the version number is updated from the top-level wscript file """ # do not touch these three lines, they are updated automatically -HEXVERSION = 0x105014 -WAFVERSION="1.5.14" -WAFREVISION = "7363M" +HEXVERSION = 0x105015 +WAFVERSION="1.5.15" +WAFREVISION = "7505M" ABI = 7 # permissions diff --git a/tools/wafadmin/Node.py b/tools/wafadmin/Node.py index 26a2113e029..47d3479864f 100644 --- a/tools/wafadmin/Node.py +++ b/tools/wafadmin/Node.py @@ -204,7 +204,7 @@ class Node(object): if node: tp = node.id & 3 if tp != BUILD: - raise Utils.WafError("find_or_declare returns a build node, not a source nor a directory %r" % lst) + raise Utils.WafError('find_or_declare cannot return a build node (build files in the source directory %r?)' % lst) return node node = self.__class__(name, parent, BUILD) return node @@ -461,8 +461,9 @@ class Node(object): "path seen from the build dir default/src/foo.cpp" if self.id & 3 == FILE: return self.relpath_gen(self.__class__.bld.bldnode) - if self.path_to_parent(self.__class__.bld.srcnode) is not '': - return os.path.join(env.variant(), self.path_to_parent(self.__class__.bld.srcnode)) + p = self.path_to_parent(self.__class__.bld.srcnode) + if p is not '': + return env.variant() + os.sep + p return env.variant() def srcpath(self, env=None): diff --git a/tools/wafadmin/Runner.py b/tools/wafadmin/Runner.py index 384b1c68c7e..5237c1abdf2 100644 --- a/tools/wafadmin/Runner.py +++ b/tools/wafadmin/Runner.py @@ -190,11 +190,15 @@ class Parallel(object): try: st = tsk.runnable_status() except Exception, e: - tsk.err_msg = Utils.ex_stack() - tsk.hasrun = EXCEPTION self.processed += 1 + if self.stop and not Options.options.keep: + tsk.hasrun = SKIPPED + self.manager.add_finished(tsk) + continue self.error_handler(tsk) self.manager.add_finished(tsk) + tsk.hasrun = EXCEPTION + tsk.err_msg = Utils.ex_stack() continue if st == ASK_LATER: diff --git a/tools/wafadmin/Scripting.py b/tools/wafadmin/Scripting.py index 203e143c2b3..e3d82c8eb9b 100644 --- a/tools/wafadmin/Scripting.py +++ b/tools/wafadmin/Scripting.py @@ -412,7 +412,7 @@ def build_impl(bld): bld.install() -excludes = '.bzr .bzrignore .git .gitignore .svn CVS .cvsignore .arch-ids {arch} SCCS BitKeeper .hg _MTN _darcs Makefile Makefile.in config.log'.split() +excludes = '.bzr .bzrignore .git .gitignore .svn CVS .cvsignore .arch-ids {arch} SCCS BitKeeper .hg _MTN _darcs Makefile Makefile.in config.log .gitattributes .hgignore .hgtags'.split() dist_exts = '~ .rej .orig .pyc .pyo .bak .tar.bz2 tar.gz .zip .swp'.split() def dont_dist(name, src, build_dir): global excludes, dist_exts @@ -486,8 +486,8 @@ def dist(appname='', version=''): # return return (distdirname, tarballname) import tarfile - if not appname: appname = getattr(Utils.g_module, APPNAME, 'noname') - if not version: version = getattr(Utils.g_module, VERSION, '1.0') + if not appname: appname = Utils.g_module.APPNAME + if not version: version = Utils.g_module.VERSION tmp_folder = appname + '-' + version if g_gz in ['gz', 'bz2']: @@ -545,8 +545,8 @@ def distcheck(appname='', version=''): '''checks if the sources compile (tarball from 'dist')''' import tempfile, tarfile - if not appname: appname = getattr(Utils.g_module, APPNAME, 'noname') - if not version: version = getattr(Utils.g_module, VERSION, '1.0') + if not appname: appname = Utils.g_module.APPNAME + if not version: version = Utils.g_module.VERSION waf = os.path.abspath(sys.argv[0]) tarball = dist(appname, version) diff --git a/tools/wafadmin/Task.py b/tools/wafadmin/Task.py index f9f16a95fa1..e6a37e91ec4 100644 --- a/tools/wafadmin/Task.py +++ b/tools/wafadmin/Task.py @@ -578,22 +578,25 @@ class Task(TaskBase): try: return self.cache_sig[0] except AttributeError: pass - m = md5() + self.m = md5() # explicit deps exp_sig = self.sig_explicit_deps() - m.update(exp_sig) - - # implicit deps - imp_sig = self.scan and self.sig_implicit_deps() or SIG_NIL - m.update(imp_sig) # env vars var_sig = self.sig_vars() - m.update(var_sig) + + # implicit deps + + imp_sig = SIG_NIL + if self.scan: + try: + imp_sig = self.sig_implicit_deps() + except ValueError: + return self.signature() # we now have the signature (first element) and the details (for debugging) - ret = m.digest() + ret = self.m.digest() self.cache_sig = (ret, exp_sig, imp_sig, var_sig) return ret @@ -771,7 +774,7 @@ class Task(TaskBase): def sig_explicit_deps(self): bld = self.generator.bld - m = md5() + up = self.m.update # the inputs for x in self.inputs + getattr(self, 'dep_nodes', []): @@ -780,7 +783,7 @@ class Task(TaskBase): variant = x.variant(self.env) try: - m.update(bld.node_sigs[variant][x.id]) + up(bld.node_sigs[variant][x.id]) except KeyError: raise Utils.WafError('Missing node signature for %r (required by %r)' % (x, self)) @@ -803,29 +806,28 @@ class Task(TaskBase): raise Utils.WafError('Missing node signature for %r (required by %r)' % (v, self)) elif hasattr(v, '__call__'): v = v() # dependency is a function, call it - m.update(v) + up(v) for x in self.deps_nodes: v = bld.node_sigs[x.variant(self.env)][x.id] - m.update(v) + up(v) - return m.digest() + return self.m.digest() def sig_vars(self): - m = md5() bld = self.generator.bld env = self.env # dependencies on the environment vars act_sig = bld.hash_env_vars(env, self.__class__.vars) - m.update(act_sig) + self.m.update(act_sig) # additional variable dependencies, if provided dep_vars = getattr(self, 'dep_vars', None) if dep_vars: - m.update(bld.hash_env_vars(env, dep_vars)) + self.m.update(bld.hash_env_vars(env, dep_vars)) - return m.digest() + return self.m.digest() #def scan(self, node): # """this method returns a tuple containing: @@ -852,6 +854,8 @@ class Task(TaskBase): return prev_sigs[2] except (KeyError, OSError): pass + del bld.task_sigs[key] + raise ValueError('rescan') # no previous run or the signature of the dependencies has changed, rescan the dependencies (nodes, names) = self.scan() @@ -878,8 +882,7 @@ class Task(TaskBase): """it is intended for .cpp and inferred .h files there is a single list (no tree traversal) this is the hot spot so ... do not touch""" - m = md5() - upd = m.update + upd = self.m.update bld = self.generator.bld tstamp = bld.node_sigs @@ -897,7 +900,7 @@ class Task(TaskBase): else: upd(tstamp[env.variant()][k.id]) - return m.digest() + return self.m.digest() def funex(c): dc = {} @@ -1132,7 +1135,7 @@ def extract_deps(tasks): except: # this is on purpose pass - variant = x.env.variant() + v = x.env.variant() key = x.unique_id() for k in x.generator.bld.node_deps.get(x.unique_id(), []): try: dep_to_task[(v, k.id)].append(x) diff --git a/tools/wafadmin/TaskGen.py b/tools/wafadmin/TaskGen.py index 2bd1ba689df..fa16b876946 100644 --- a/tools/wafadmin/TaskGen.py +++ b/tools/wafadmin/TaskGen.py @@ -527,6 +527,9 @@ def exec_rule(self): raise Utils.WafError('input file %r could not be found (%r)' % (x, self.path.abspath())) tsk.inputs.append(y) + if self.allnodes: + tsk.inputs.extend(self.allnodes) + if getattr(self, 'scan', None): cls.scan = self.scan diff --git a/tools/wafadmin/Tools/config_c.py b/tools/wafadmin/Tools/config_c.py index 6008265dda6..1a57566f857 100644 --- a/tools/wafadmin/Tools/config_c.py +++ b/tools/wafadmin/Tools/config_c.py @@ -186,7 +186,8 @@ def exec_cfg(self, kw): vars = Utils.to_list(kw['variables']) for v in vars: val = self.cmd_and_log('%s --variable=%s %s' % (kw['path'], v, kw['package']), kw).strip() - env.append_unique('%s_%s' % (uselib, v), val) + var = '%s_%s' % (uselib, v) + env[var] = val if not 'okmsg' in kw: kw['okmsg'] = 'ok' return @@ -541,10 +542,8 @@ def run_c_code(self, *k, **kw): # if we need to run the program, try to get its result if kw['execute']: - ak = {} # syntax for python < 2.5, don't touch - ak['stdout'] = ak['stderr'] = Utils.pproc.PIPE args = Utils.to_list(kw.get('exec_args', [])) - proc = Utils.pproc.Popen([lastprog], *args, **ak) + proc = Utils.pproc.Popen([lastprog] + args, stdout=Utils.pproc.PIPE, stderr=Utils.pproc.PIPE) (out, err) = proc.communicate() w = self.log.write w(str(out)) diff --git a/tools/wafadmin/Tools/d.py b/tools/wafadmin/Tools/d.py index 4f4bddb749f..602f5af1b49 100644 --- a/tools/wafadmin/Tools/d.py +++ b/tools/wafadmin/Tools/d.py @@ -289,8 +289,8 @@ def apply_d_libs(self): # object has ancestors to process (shared libraries): add them to the end of the list if getattr(y, 'uselib_local', None): lst = y.to_list(y.uselib_local) - if 'dshlib' in y.features or 'cprogram' in y.features: - lst = [x for x in lst if not 'cstaticlib' in self.name_to_obj(x).features] + if 'dshlib' in y.features or 'dprogram' in y.features: + lst = [x for x in lst if not 'dstaticlib' in self.name_to_obj(x).features] tmp.extend(lst) # link task and flags @@ -386,6 +386,12 @@ def apply_d_vars(self): # now process the library paths # apply same path manipulation as used with import paths for path in libpaths: + if not os.path.isabs(path): + node = self.path.find_resource(path) + if not node: + raise Utils.WafError('could not find libpath %r from %r' % (path, self)) + path = node.abspath(self.env) + env.append_unique('DLINKFLAGS', libpath_st % path) # add libraries diff --git a/tools/wafadmin/Tools/gas.py b/tools/wafadmin/Tools/gas.py index fb255966980..c983b0a3959 100644 --- a/tools/wafadmin/Tools/gas.py +++ b/tools/wafadmin/Tools/gas.py @@ -34,4 +34,5 @@ def asm_incflags(self): def detect(conf): conf.find_program(['gas', 'as'], var='AS') if not conf.env.AS: conf.env.AS = conf.env.CC + #conf.env.ASFLAGS = ['-c'] <- may be necesary for .S files diff --git a/tools/wafadmin/Tools/gnu_dirs.py b/tools/wafadmin/Tools/gnu_dirs.py index 3fc452d02dd..856e4a7204b 100644 --- a/tools/wafadmin/Tools/gnu_dirs.py +++ b/tools/wafadmin/Tools/gnu_dirs.py @@ -65,7 +65,7 @@ def detect(conf): env = conf.env env['EXEC_PREFIX'] = get_param('EXEC_PREFIX', env['PREFIX']) - env['PACKAGE'] = getattr(Utils.g_module, 'APPNAME', None) or env['PACKAGE'] + env['PACKAGE'] = Utils.g_module.APPNAME complete = False iter = 0 diff --git a/tools/wafadmin/Tools/msvc.py b/tools/wafadmin/Tools/msvc.py index 64fb05bceeb..94e5da5efd5 100644 --- a/tools/wafadmin/Tools/msvc.py +++ b/tools/wafadmin/Tools/msvc.py @@ -724,7 +724,17 @@ def exec_mf(self): self.do_manifest = False outfile = self.outputs[0].bldpath(env) - manifest = self.outputs[-1].bldpath(env) + + manifest = None + for out_node in self.outputs: + if out_node.name.endswith('.manifest'): + manifest = out_node.bldpath(env) + break + if manifest is None: + # Should never get here. If we do, it means the manifest file was + # never added to the outputs list, thus we don't have a manifest file + # to embed, so we just return. + return 0 # embedding mode. Different for EXE's and DLL's. # see: http://msdn2.microsoft.com/en-us/library/ms235591(VS.80).aspx @@ -738,7 +748,7 @@ def exec_mf(self): #flags = ' '.join(env['MTFLAGS'] or []) lst = [] - lst.extend(Utils.to_list(env['MT'])) + lst.extend([env['MT']]) lst.extend(Utils.to_list(env['MTFLAGS'])) lst.extend(Utils.to_list("-manifest")) lst.extend(Utils.to_list(manifest)) diff --git a/tools/wafadmin/Tools/preproc.py b/tools/wafadmin/Tools/preproc.py index 924bea2227a..1a9b0ff1555 100644 --- a/tools/wafadmin/Tools/preproc.py +++ b/tools/wafadmin/Tools/preproc.py @@ -35,6 +35,10 @@ class PreprocError(Utils.WafError): POPFILE = '-' + +recursion_limit = 100 +"do not loop too much on header inclusion" + go_absolute = 0 "set to 1 to track headers on files in /usr/include - else absolute paths are ignored" @@ -636,7 +640,7 @@ class c_parser(object): filepath = node.abspath(self.env) self.count_files += 1 - if self.count_files > 30000: raise PreprocError("recursion limit exceeded") + if self.count_files > recursion_limit: raise PreprocError("recursion limit exceeded") pc = self.parse_cache debug('preproc: reading file %r', filepath) try: diff --git a/tools/wafadmin/Tools/python.py b/tools/wafadmin/Tools/python.py index d87d1e8ac30..cfa81b0b8d1 100644 --- a/tools/wafadmin/Tools/python.py +++ b/tools/wafadmin/Tools/python.py @@ -55,7 +55,7 @@ def init_pyembed(self): @extension(EXT_PY) def process_py(self, node): - if not (self.bld.is_install or self.install_path): + if not (self.bld.is_install and self.install_path): return def inst_py(ctx): install_pyfile(self, node) @@ -122,7 +122,7 @@ def _get_python_variables(python_exe, variables, imports=['import sys']): except KeyError: pass proc = Utils.pproc.Popen([python_exe, "-c", '\n'.join(program)], stdout=Utils.pproc.PIPE, env=os_env) - output = proc.communicate()[0].split("\n") + output = proc.communicate()[0].split("\n") # do not touch, python3 if proc.returncode: if Options.options.verbose: warn("Python program to extract python configuration variables failed:\n%s" diff --git a/tools/wafadmin/Tools/qt4.py b/tools/wafadmin/Tools/qt4.py index 0a60b861230..f63365a28ed 100644 --- a/tools/wafadmin/Tools/qt4.py +++ b/tools/wafadmin/Tools/qt4.py @@ -96,31 +96,25 @@ class qxx_task(Task.Task): if d in mocfiles: error("paranoia owns") continue + # process that base.moc only once mocfiles.append(d) - # find the extension - this search is done only once - ext = '' - try: ext = Options.options.qt_header_ext - except AttributeError: pass - - if not ext: - base2 = d[:-4] - paths = [node.parent.srcpath(self.env), node.parent.bldpath(self.env)] - poss = [(x, y) for x in MOC_H for y in paths] - for (i, path) in poss: - try: - # TODO we could use find_resource - os.stat(os.path.join(path, base2+i)) - except OSError: - pass - else: - ext = i + # find the extension (performed only when the .cpp has changes) + base2 = d[:-4] + for path in [node.parent] + self.generator.env['INC_PATHS']: + tree.rescan(path) + vals = getattr(Options.options, 'qt_header_ext', '') or MOC_H + for ex in vals: + h_node = path.find_resource(base2 + ex) + if h_node: break - if not ext: raise Utils.WafError("no header found for %s which is a moc file" % str(d)) + else: + continue + break + else: + raise Utils.WafError("no header found for %s which is a moc file" % str(d)) - # next time we will not search for the extension (look at the 'for' loop below) - h_node = node.parent.find_resource(base2+i) m_node = h_node.change_ext('.moc') tree.node_deps[(self.inputs[0].parent.id, self.env.variant(), m_node.name)] = h_node @@ -246,7 +240,8 @@ def apply_qt4(self): if update: trans.append(t.inputs[0]) - if update and Options.options.trans_qt4: + trans_qt4 = getattr(Options.options, 'trans_qt4', False) + if update and trans_qt4: # we need the cpp files given, except the rcc task we create after # FIXME may be broken u = Task.TaskCmd(translation_update, self.env, 2) @@ -426,6 +421,11 @@ def detect_qt4(conf): env.append_unique(kind + 'LIB_' + uselib, lib + d + ext) conf.check_message_2('ok ' + path, 'GREEN') break + path = os.path.join(qtbin, pat % (lib + d + ext)) + if os.path.exists(path): + env.append_unique(kind + 'LIB_' + uselib, lib + d + ext) + conf.check_message_2('ok ' + path, 'GREEN') + break else: conf.check_message_2('not found', 'YELLOW') continue @@ -461,7 +461,8 @@ def detect_qt4(conf): process_lib(vars_debug, 'LIBPATH_QTCORE_DEBUG') # rpath if wanted - if Options.options.want_rpath: + want_rpath = getattr(Options.options, 'want_rpath', 1) + if want_rpath: def process_rpath(vars_, coreval): for d in vars_: var = d.upper() diff --git a/tools/wafadmin/Tools/suncc.py b/tools/wafadmin/Tools/suncc.py index 0aa430556c8..138722978aa 100644 --- a/tools/wafadmin/Tools/suncc.py +++ b/tools/wafadmin/Tools/suncc.py @@ -17,9 +17,10 @@ def find_scc(conf): #if not cc: cc = conf.find_program('gcc', var='CC') if not cc: cc = conf.find_program('cc', var='CC') if not cc: conf.fatal('suncc was not found') + cc = conf.cmd_to_list(cc) try: - if not Utils.cmd_output('%s -flags' % cc): + if not Utils.cmd_output(cc + ['-flags']): conf.fatal('suncc %r was not found' % cc) except ValueError: conf.fatal('suncc -flags could not be executed') diff --git a/tools/wafadmin/Tools/suncxx.py b/tools/wafadmin/Tools/suncxx.py index f168502e00a..b6e9ef8562a 100644 --- a/tools/wafadmin/Tools/suncxx.py +++ b/tools/wafadmin/Tools/suncxx.py @@ -14,10 +14,16 @@ def find_sxx(conf): cc = None if v['CXX']: cc = v['CXX'] elif 'CXX' in conf.environ: cc = conf.environ['CXX'] - #if not cc: cc = conf.find_program('g++', var='CXX') if not cc: cc = conf.find_program('c++', var='CXX') - if not cc: cc = conf.find_program('CC', var='CXX') #studio if not cc: conf.fatal('sunc++ was not found') + cc = conf.cmd_to_list(cc) + + try: + if not Utils.cmd_output(cc + ['-flags']): + conf.fatal('sunc++ %r was not found' % cc) + except ValueError: + conf.fatal('sunc++ -flags could not be executed') + v['CXX'] = cc v['CXX_NAME'] = 'sun' diff --git a/tools/wafadmin/Tools/vala.py b/tools/wafadmin/Tools/vala.py index 43b802c33e6..806f2f4b0f1 100644 --- a/tools/wafadmin/Tools/vala.py +++ b/tools/wafadmin/Tools/vala.py @@ -3,7 +3,7 @@ # Ali Sabil, 2007 import os.path, shutil -import Task, Runner, Utils, Logs, Build, Node +import Task, Runner, Utils, Logs, Build, Node, Options from TaskGen import extension, after, before EXT_VALA = ['.vala', '.gs'] @@ -29,6 +29,9 @@ class valac_task(Task.Task): if self.threading: cmd.append('--thread') + if self.profile: + cmd.append('--profile=%s' % self.profile) + if self.target_glib: cmd.append('--target-glib=%s' % self.target_glib) @@ -134,13 +137,15 @@ def vala_file(self, node): valatask = self.create_task('valac') self.valatask = valatask self.includes = Utils.to_list(getattr(self, 'includes', [])) + self.uselib = self.to_list(self.uselib) valatask.packages = [] valatask.packages_private = Utils.to_list(getattr(self, 'packages_private', [])) valatask.vapi_dirs = [] valatask.target = self.target valatask.threading = False valatask.install_path = self.install_path - valatask.target_glib = None + valatask.profile = getattr (self, 'profile', 'gobject') + valatask.target_glib = None #Deprecated packages = Utils.to_list(getattr(self, 'packages', [])) vapi_dirs = Utils.to_list(getattr(self, 'vapi_dirs', [])) @@ -197,14 +202,24 @@ def vala_file(self, node): except AttributeError: Logs.warn("Unable to locate include directory: '%s'" % include) - if hasattr(self, 'threading'): - valatask.threading = self.threading - self.uselib = self.to_list(self.uselib) - if not 'GTHREAD' in self.uselib: - self.uselib.append('GTHREAD') + if valatask.profile == 'gobject': + if hasattr(self, 'target_glib'): + Logs.warn ('target_glib on vala tasks is deprecated --vala-target-glib=MAJOR.MINOR from the vala tool options') + + if getattr(Options.options, 'vala_target_glib', None): + valatask.target_glib = Options.options.vala_target_glib - if hasattr(self, 'target_glib'): - valatask.target_glib = self.target_glib + if not 'GOBJECT' in self.uselib: + self.uselib.append('GOBJECT') + + if hasattr(self, 'threading'): + if valatask.profile == 'gobject': + valatask.threading = self.threading + if not 'GTHREAD' in self.uselib: + self.uselib.append('GTHREAD') + else: + #Vala doesn't have threading support for dova nor posix + Logs.warn("Profile %s does not have threading support" % valatask.profile) if hasattr(self, 'gir'): valatask.gir = self.gir @@ -244,8 +259,23 @@ def detect(conf): valac = conf.find_program('valac', var='VALAC', mandatory=True) + if not conf.env["HAVE_GOBJECT"]: + pkg_args = {'package': 'gobject-2.0', + 'uselib_store': 'GOBJECT', + 'args': '--cflags --libs'} + if getattr(Options.options, 'vala_target_glib', None): + pkg_args['atleast_version'] = Options.options.vala_target_glib + + conf.check_cfg(**pkg_args) + if not conf.env["HAVE_GTHREAD"]: - conf.check_cfg(package='gthread-2.0', uselib_store='GTHREAD', args='--cflags --libs') + pkg_args = {'package': 'gthread-2.0', + 'uselib_store': 'GTHREAD', + 'args': '--cflags --libs'} + if getattr(Options.options, 'vala_target_glib', None): + pkg_args['atleast_version'] = Options.options.vala_target_glib + + conf.check_cfg(**pkg_args) try: output = Utils.cmd_output(valac + " --version", silent=True) @@ -269,3 +299,9 @@ def detect(conf): conf.env['VALAC_VERSION'] = valac_version conf.env['VALAFLAGS'] = '' +def set_options (opt): + valaopts = opt.add_option_group('Vala Compiler Options') + valaopts.add_option ('--vala-target-glib', default=None, + dest='vala_target_glib', metavar='MAJOR.MINOR', + help='Target version of glib for Vala GObject code generation') + diff --git a/tools/wafadmin/Utils.py b/tools/wafadmin/Utils.py index 1d1b2009c1a..e03126e8d5b 100644 --- a/tools/wafadmin/Utils.py +++ b/tools/wafadmin/Utils.py @@ -130,18 +130,22 @@ try: except ImportError: try: - from hashlib import md5 + try: + from hashlib import md5 + except ImportError: + from md5 import md5 + + def h_file(filename): + f = open(filename, 'rb') + m = md5() + while (filename): + filename = f.read(100000) + m.update(filename) + f.close() + return m.digest() except ImportError: - from md5 import md5 - - def h_file(filename): - f = open(filename, 'rb') - m = md5() - while (filename): - filename = f.read(100000) - m.update(filename) - f.close() - return m.digest() + # portability fixes may be added elsewhere (although, md5 should be everywhere by now) + md5 = None class ordered_dict(UserDict): def __init__(self, dict = None): @@ -282,6 +286,15 @@ def set_main_module(file_path): g_module = load_module(file_path, 'wscript_main') g_module.root_path = file_path + try: + g_module.APPNAME + except: + g_module.APPNAME = 'noname' + try: + g_module.VERSION + except: + g_module.VERSION = '1.0' + # note: to register the module globally, use the following: # sys.modules['wscript_main'] = g_module diff --git a/tools/wafadmin/py3kfixes.py b/tools/wafadmin/py3kfixes.py index ebfeaae77fe..6aeb26b64ae 100644 --- a/tools/wafadmin/py3kfixes.py +++ b/tools/wafadmin/py3kfixes.py @@ -100,7 +100,7 @@ def r7(code): @subst('Tools/python.py') def r8(code): - code = code.replace('p.communicate()[0]', 'p.communicate()[0].decode("utf-8")') + code = code.replace('proc.communicate()[0]', 'proc.communicate()[0].decode("utf-8")') return code @subst('Tools/glib2.py') |