Browse Source

Upgrade to WAF 1.5.15

v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
01f7d4484e
  1. 2
      bin/node-waf
  2. 2
      tools/waf-light
  3. 9
      tools/wafadmin/Build.py
  4. 2
      tools/wafadmin/Configure.py
  5. 6
      tools/wafadmin/Constants.py
  6. 7
      tools/wafadmin/Node.py
  7. 8
      tools/wafadmin/Runner.py
  8. 10
      tools/wafadmin/Scripting.py
  9. 45
      tools/wafadmin/Task.py
  10. 3
      tools/wafadmin/TaskGen.py
  11. 7
      tools/wafadmin/Tools/config_c.py
  12. 10
      tools/wafadmin/Tools/d.py
  13. 1
      tools/wafadmin/Tools/gas.py
  14. 2
      tools/wafadmin/Tools/gnu_dirs.py
  15. 14
      tools/wafadmin/Tools/msvc.py
  16. 6
      tools/wafadmin/Tools/preproc.py
  17. 4
      tools/wafadmin/Tools/python.py
  18. 41
      tools/wafadmin/Tools/qt4.py
  19. 3
      tools/wafadmin/Tools/suncc.py
  20. 10
      tools/wafadmin/Tools/suncxx.py
  21. 50
      tools/wafadmin/Tools/vala.py
  22. 13
      tools/wafadmin/Utils.py
  23. 2
      tools/wafadmin/py3kfixes.py

2
bin/node-waf

@ -12,6 +12,6 @@ t = join(w, 'Tools')
sys.path = [w, t] + sys.path sys.path = [w, t] + sys.path
import Scripting import Scripting
VERSION="1.5.14" VERSION="1.5.15"
Scripting.prepare(t, os.getcwd(), VERSION, wafdir) Scripting.prepare(t, os.getcwd(), VERSION, wafdir)
sys.exit(0) sys.exit(0)

2
tools/waf-light

@ -37,7 +37,7 @@ if 'PSYCOWAF' in os.environ:
try:import psyco;psyco.full() try:import psyco;psyco.full()
except:pass except:pass
VERSION="1.5.14" VERSION="1.5.15"
REVISION="x" REVISION="x"
INSTALL="x" INSTALL="x"
C1='x' C1='x'

9
tools/wafadmin/Build.py

@ -681,8 +681,13 @@ class BuildContext(Utils.Context):
for i in xrange(len(self.task_manager.groups)): for i in xrange(len(self.task_manager.groups)):
g = self.task_manager.groups[i] g = self.task_manager.groups[i]
self.task_manager.current_group = 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: for tg in g.tasks_gen:
if id(tg) in to_compile: if id(tg) in to_compile:
if Logs.verbose:
Logs.debug('group: %s' % tg)
tg.post() tg.post()
else: else:
@ -702,9 +707,13 @@ class BuildContext(Utils.Context):
for i in xrange(len(self.task_manager.groups)): for i in xrange(len(self.task_manager.groups)):
g = self.task_manager.groups[i] g = self.task_manager.groups[i]
self.task_manager.current_group = 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: for tg in g.tasks_gen:
if not tg.path.is_child_of(ln): if not tg.path.is_child_of(ln):
continue continue
if Logs.verbose:
Logs.debug('group: %s' % tg)
tg.post() tg.post()
def env_of_name(self, name): def env_of_name(self, name):

2
tools/wafadmin/Configure.py

@ -125,7 +125,7 @@ class ConfigurationContext(Utils.Context):
except (OSError, IOError): except (OSError, IOError):
self.fatal('could not open %r for writing' % path) self.fatal('could not open %r for writing' % path)
app = getattr(Utils.g_module, 'APPNAME', '') app = Utils.g_module.APPNAME
if app: if app:
ver = getattr(Utils.g_module, 'VERSION', '') ver = getattr(Utils.g_module, 'VERSION', '')
if ver: if ver:

6
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 # do not touch these three lines, they are updated automatically
HEXVERSION = 0x105014 HEXVERSION = 0x105015
WAFVERSION="1.5.14" WAFVERSION="1.5.15"
WAFREVISION = "7363M" WAFREVISION = "7505M"
ABI = 7 ABI = 7
# permissions # permissions

7
tools/wafadmin/Node.py

@ -204,7 +204,7 @@ class Node(object):
if node: if node:
tp = node.id & 3 tp = node.id & 3
if tp != BUILD: 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 return node
node = self.__class__(name, parent, BUILD) node = self.__class__(name, parent, BUILD)
return node return node
@ -461,8 +461,9 @@ class Node(object):
"path seen from the build dir default/src/foo.cpp" "path seen from the build dir default/src/foo.cpp"
if self.id & 3 == FILE: if self.id & 3 == FILE:
return self.relpath_gen(self.__class__.bld.bldnode) return self.relpath_gen(self.__class__.bld.bldnode)
if self.path_to_parent(self.__class__.bld.srcnode) is not '': p = self.path_to_parent(self.__class__.bld.srcnode)
return os.path.join(env.variant(), self.path_to_parent(self.__class__.bld.srcnode)) if p is not '':
return env.variant() + os.sep + p
return env.variant() return env.variant()
def srcpath(self, env=None): def srcpath(self, env=None):

8
tools/wafadmin/Runner.py

@ -190,11 +190,15 @@ class Parallel(object):
try: try:
st = tsk.runnable_status() st = tsk.runnable_status()
except Exception, e: except Exception, e:
tsk.err_msg = Utils.ex_stack()
tsk.hasrun = EXCEPTION
self.processed += 1 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.error_handler(tsk)
self.manager.add_finished(tsk) self.manager.add_finished(tsk)
tsk.hasrun = EXCEPTION
tsk.err_msg = Utils.ex_stack()
continue continue
if st == ASK_LATER: if st == ASK_LATER:

10
tools/wafadmin/Scripting.py

@ -412,7 +412,7 @@ def build_impl(bld):
bld.install() 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() dist_exts = '~ .rej .orig .pyc .pyo .bak .tar.bz2 tar.gz .zip .swp'.split()
def dont_dist(name, src, build_dir): def dont_dist(name, src, build_dir):
global excludes, dist_exts global excludes, dist_exts
@ -486,8 +486,8 @@ def dist(appname='', version=''):
# return return (distdirname, tarballname) # return return (distdirname, tarballname)
import tarfile import tarfile
if not appname: appname = getattr(Utils.g_module, APPNAME, 'noname') if not appname: appname = Utils.g_module.APPNAME
if not version: version = getattr(Utils.g_module, VERSION, '1.0') if not version: version = Utils.g_module.VERSION
tmp_folder = appname + '-' + version tmp_folder = appname + '-' + version
if g_gz in ['gz', 'bz2']: if g_gz in ['gz', 'bz2']:
@ -545,8 +545,8 @@ def distcheck(appname='', version=''):
'''checks if the sources compile (tarball from 'dist')''' '''checks if the sources compile (tarball from 'dist')'''
import tempfile, tarfile import tempfile, tarfile
if not appname: appname = getattr(Utils.g_module, APPNAME, 'noname') if not appname: appname = Utils.g_module.APPNAME
if not version: version = getattr(Utils.g_module, VERSION, '1.0') if not version: version = Utils.g_module.VERSION
waf = os.path.abspath(sys.argv[0]) waf = os.path.abspath(sys.argv[0])
tarball = dist(appname, version) tarball = dist(appname, version)

45
tools/wafadmin/Task.py

@ -578,22 +578,25 @@ class Task(TaskBase):
try: return self.cache_sig[0] try: return self.cache_sig[0]
except AttributeError: pass except AttributeError: pass
m = md5() self.m = md5()
# explicit deps # explicit deps
exp_sig = self.sig_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 # env vars
var_sig = self.sig_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) # 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) self.cache_sig = (ret, exp_sig, imp_sig, var_sig)
return ret return ret
@ -771,7 +774,7 @@ class Task(TaskBase):
def sig_explicit_deps(self): def sig_explicit_deps(self):
bld = self.generator.bld bld = self.generator.bld
m = md5() up = self.m.update
# the inputs # the inputs
for x in self.inputs + getattr(self, 'dep_nodes', []): for x in self.inputs + getattr(self, 'dep_nodes', []):
@ -780,7 +783,7 @@ class Task(TaskBase):
variant = x.variant(self.env) variant = x.variant(self.env)
try: try:
m.update(bld.node_sigs[variant][x.id]) up(bld.node_sigs[variant][x.id])
except KeyError: except KeyError:
raise Utils.WafError('Missing node signature for %r (required by %r)' % (x, self)) 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)) raise Utils.WafError('Missing node signature for %r (required by %r)' % (v, self))
elif hasattr(v, '__call__'): elif hasattr(v, '__call__'):
v = v() # dependency is a function, call it v = v() # dependency is a function, call it
m.update(v) up(v)
for x in self.deps_nodes: for x in self.deps_nodes:
v = bld.node_sigs[x.variant(self.env)][x.id] 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): def sig_vars(self):
m = md5()
bld = self.generator.bld bld = self.generator.bld
env = self.env env = self.env
# dependencies on the environment vars # dependencies on the environment vars
act_sig = bld.hash_env_vars(env, self.__class__.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 # additional variable dependencies, if provided
dep_vars = getattr(self, 'dep_vars', None) dep_vars = getattr(self, 'dep_vars', None)
if dep_vars: 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): #def scan(self, node):
# """this method returns a tuple containing: # """this method returns a tuple containing:
@ -852,6 +854,8 @@ class Task(TaskBase):
return prev_sigs[2] return prev_sigs[2]
except (KeyError, OSError): except (KeyError, OSError):
pass pass
del bld.task_sigs[key]
raise ValueError('rescan')
# no previous run or the signature of the dependencies has changed, rescan the dependencies # no previous run or the signature of the dependencies has changed, rescan the dependencies
(nodes, names) = self.scan() (nodes, names) = self.scan()
@ -878,8 +882,7 @@ class Task(TaskBase):
"""it is intended for .cpp and inferred .h files """it is intended for .cpp and inferred .h files
there is a single list (no tree traversal) there is a single list (no tree traversal)
this is the hot spot so ... do not touch""" this is the hot spot so ... do not touch"""
m = md5() upd = self.m.update
upd = m.update
bld = self.generator.bld bld = self.generator.bld
tstamp = bld.node_sigs tstamp = bld.node_sigs
@ -897,7 +900,7 @@ class Task(TaskBase):
else: else:
upd(tstamp[env.variant()][k.id]) upd(tstamp[env.variant()][k.id])
return m.digest() return self.m.digest()
def funex(c): def funex(c):
dc = {} dc = {}
@ -1132,7 +1135,7 @@ def extract_deps(tasks):
except: # this is on purpose except: # this is on purpose
pass pass
variant = x.env.variant() v = x.env.variant()
key = x.unique_id() key = x.unique_id()
for k in x.generator.bld.node_deps.get(x.unique_id(), []): for k in x.generator.bld.node_deps.get(x.unique_id(), []):
try: dep_to_task[(v, k.id)].append(x) try: dep_to_task[(v, k.id)].append(x)

3
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())) raise Utils.WafError('input file %r could not be found (%r)' % (x, self.path.abspath()))
tsk.inputs.append(y) tsk.inputs.append(y)
if self.allnodes:
tsk.inputs.extend(self.allnodes)
if getattr(self, 'scan', None): if getattr(self, 'scan', None):
cls.scan = self.scan cls.scan = self.scan

7
tools/wafadmin/Tools/config_c.py

@ -186,7 +186,8 @@ def exec_cfg(self, kw):
vars = Utils.to_list(kw['variables']) vars = Utils.to_list(kw['variables'])
for v in vars: for v in vars:
val = self.cmd_and_log('%s --variable=%s %s' % (kw['path'], v, kw['package']), kw).strip() 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: if not 'okmsg' in kw:
kw['okmsg'] = 'ok' kw['okmsg'] = 'ok'
return 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 we need to run the program, try to get its result
if kw['execute']: 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', [])) 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() (out, err) = proc.communicate()
w = self.log.write w = self.log.write
w(str(out)) w(str(out))

10
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 # object has ancestors to process (shared libraries): add them to the end of the list
if getattr(y, 'uselib_local', None): if getattr(y, 'uselib_local', None):
lst = y.to_list(y.uselib_local) lst = y.to_list(y.uselib_local)
if 'dshlib' in y.features or 'cprogram' in y.features: if 'dshlib' in y.features or 'dprogram' in y.features:
lst = [x for x in lst if not 'cstaticlib' in self.name_to_obj(x).features] lst = [x for x in lst if not 'dstaticlib' in self.name_to_obj(x).features]
tmp.extend(lst) tmp.extend(lst)
# link task and flags # link task and flags
@ -386,6 +386,12 @@ def apply_d_vars(self):
# now process the library paths # now process the library paths
# apply same path manipulation as used with import paths # apply same path manipulation as used with import paths
for path in libpaths: 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) env.append_unique('DLINKFLAGS', libpath_st % path)
# add libraries # add libraries

1
tools/wafadmin/Tools/gas.py

@ -34,4 +34,5 @@ def asm_incflags(self):
def detect(conf): def detect(conf):
conf.find_program(['gas', 'as'], var='AS') conf.find_program(['gas', 'as'], var='AS')
if not conf.env.AS: conf.env.AS = conf.env.CC if not conf.env.AS: conf.env.AS = conf.env.CC
#conf.env.ASFLAGS = ['-c'] <- may be necesary for .S files

2
tools/wafadmin/Tools/gnu_dirs.py

@ -65,7 +65,7 @@ def detect(conf):
env = conf.env env = conf.env
env['EXEC_PREFIX'] = get_param('EXEC_PREFIX', env['PREFIX']) 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 complete = False
iter = 0 iter = 0

14
tools/wafadmin/Tools/msvc.py

@ -724,7 +724,17 @@ def exec_mf(self):
self.do_manifest = False self.do_manifest = False
outfile = self.outputs[0].bldpath(env) 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. # embedding mode. Different for EXE's and DLL's.
# see: http://msdn2.microsoft.com/en-us/library/ms235591(VS.80).aspx # 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 []) #flags = ' '.join(env['MTFLAGS'] or [])
lst = [] lst = []
lst.extend(Utils.to_list(env['MT'])) lst.extend([env['MT']])
lst.extend(Utils.to_list(env['MTFLAGS'])) lst.extend(Utils.to_list(env['MTFLAGS']))
lst.extend(Utils.to_list("-manifest")) lst.extend(Utils.to_list("-manifest"))
lst.extend(Utils.to_list(manifest)) lst.extend(Utils.to_list(manifest))

6
tools/wafadmin/Tools/preproc.py

@ -35,6 +35,10 @@ class PreprocError(Utils.WafError):
POPFILE = '-' POPFILE = '-'
recursion_limit = 100
"do not loop too much on header inclusion"
go_absolute = 0 go_absolute = 0
"set to 1 to track headers on files in /usr/include - else absolute paths are ignored" "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) filepath = node.abspath(self.env)
self.count_files += 1 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 pc = self.parse_cache
debug('preproc: reading file %r', filepath) debug('preproc: reading file %r', filepath)
try: try:

4
tools/wafadmin/Tools/python.py

@ -55,7 +55,7 @@ def init_pyembed(self):
@extension(EXT_PY) @extension(EXT_PY)
def process_py(self, node): 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 return
def inst_py(ctx): def inst_py(ctx):
install_pyfile(self, node) install_pyfile(self, node)
@ -122,7 +122,7 @@ def _get_python_variables(python_exe, variables, imports=['import sys']):
except KeyError: except KeyError:
pass pass
proc = Utils.pproc.Popen([python_exe, "-c", '\n'.join(program)], stdout=Utils.pproc.PIPE, env=os_env) 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 proc.returncode:
if Options.options.verbose: if Options.options.verbose:
warn("Python program to extract python configuration variables failed:\n%s" warn("Python program to extract python configuration variables failed:\n%s"

41
tools/wafadmin/Tools/qt4.py

@ -96,31 +96,25 @@ class qxx_task(Task.Task):
if d in mocfiles: if d in mocfiles:
error("paranoia owns") error("paranoia owns")
continue continue
# process that base.moc only once # process that base.moc only once
mocfiles.append(d) mocfiles.append(d)
# find the extension - this search is done only once # find the extension (performed only when the .cpp has changes)
ext = ''
try: ext = Options.options.qt_header_ext
except AttributeError: pass
if not ext:
base2 = d[:-4] base2 = d[:-4]
paths = [node.parent.srcpath(self.env), node.parent.bldpath(self.env)] for path in [node.parent] + self.generator.env['INC_PATHS']:
poss = [(x, y) for x in MOC_H for y in paths] tree.rescan(path)
for (i, path) in poss: vals = getattr(Options.options, 'qt_header_ext', '') or MOC_H
try: for ex in vals:
# TODO we could use find_resource h_node = path.find_resource(base2 + ex)
os.stat(os.path.join(path, base2+i)) if h_node:
except OSError: break
pass
else: else:
ext = i continue
break break
if not ext: raise Utils.WafError("no header found for %s which is a moc file" % str(d)) 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') m_node = h_node.change_ext('.moc')
tree.node_deps[(self.inputs[0].parent.id, self.env.variant(), m_node.name)] = h_node 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: if update:
trans.append(t.inputs[0]) 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 # we need the cpp files given, except the rcc task we create after
# FIXME may be broken # FIXME may be broken
u = Task.TaskCmd(translation_update, self.env, 2) 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) env.append_unique(kind + 'LIB_' + uselib, lib + d + ext)
conf.check_message_2('ok ' + path, 'GREEN') conf.check_message_2('ok ' + path, 'GREEN')
break 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: else:
conf.check_message_2('not found', 'YELLOW') conf.check_message_2('not found', 'YELLOW')
continue continue
@ -461,7 +461,8 @@ def detect_qt4(conf):
process_lib(vars_debug, 'LIBPATH_QTCORE_DEBUG') process_lib(vars_debug, 'LIBPATH_QTCORE_DEBUG')
# rpath if wanted # rpath if wanted
if Options.options.want_rpath: want_rpath = getattr(Options.options, 'want_rpath', 1)
if want_rpath:
def process_rpath(vars_, coreval): def process_rpath(vars_, coreval):
for d in vars_: for d in vars_:
var = d.upper() var = d.upper()

3
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('gcc', var='CC')
if not cc: cc = conf.find_program('cc', var='CC') if not cc: cc = conf.find_program('cc', var='CC')
if not cc: conf.fatal('suncc was not found') if not cc: conf.fatal('suncc was not found')
cc = conf.cmd_to_list(cc)
try: try:
if not Utils.cmd_output('%s -flags' % cc): if not Utils.cmd_output(cc + ['-flags']):
conf.fatal('suncc %r was not found' % cc) conf.fatal('suncc %r was not found' % cc)
except ValueError: except ValueError:
conf.fatal('suncc -flags could not be executed') conf.fatal('suncc -flags could not be executed')

10
tools/wafadmin/Tools/suncxx.py

@ -14,10 +14,16 @@ def find_sxx(conf):
cc = None cc = None
if v['CXX']: cc = v['CXX'] if v['CXX']: cc = v['CXX']
elif 'CXX' in conf.environ: cc = conf.environ['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('c++', var='CXX')
if not cc: cc = conf.find_program('CC', var='CXX') #studio
if not cc: conf.fatal('sunc++ was not found') 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'] = cc
v['CXX_NAME'] = 'sun' v['CXX_NAME'] = 'sun'

50
tools/wafadmin/Tools/vala.py

@ -3,7 +3,7 @@
# Ali Sabil, 2007 # Ali Sabil, 2007
import os.path, shutil 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 from TaskGen import extension, after, before
EXT_VALA = ['.vala', '.gs'] EXT_VALA = ['.vala', '.gs']
@ -29,6 +29,9 @@ class valac_task(Task.Task):
if self.threading: if self.threading:
cmd.append('--thread') cmd.append('--thread')
if self.profile:
cmd.append('--profile=%s' % self.profile)
if self.target_glib: if self.target_glib:
cmd.append('--target-glib=%s' % 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') valatask = self.create_task('valac')
self.valatask = valatask self.valatask = valatask
self.includes = Utils.to_list(getattr(self, 'includes', [])) self.includes = Utils.to_list(getattr(self, 'includes', []))
self.uselib = self.to_list(self.uselib)
valatask.packages = [] valatask.packages = []
valatask.packages_private = Utils.to_list(getattr(self, 'packages_private', [])) valatask.packages_private = Utils.to_list(getattr(self, 'packages_private', []))
valatask.vapi_dirs = [] valatask.vapi_dirs = []
valatask.target = self.target valatask.target = self.target
valatask.threading = False valatask.threading = False
valatask.install_path = self.install_path 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', [])) packages = Utils.to_list(getattr(self, 'packages', []))
vapi_dirs = Utils.to_list(getattr(self, 'vapi_dirs', [])) vapi_dirs = Utils.to_list(getattr(self, 'vapi_dirs', []))
@ -197,14 +202,24 @@ def vala_file(self, node):
except AttributeError: except AttributeError:
Logs.warn("Unable to locate include directory: '%s'" % include) Logs.warn("Unable to locate include directory: '%s'" % include)
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 not 'GOBJECT' in self.uselib:
self.uselib.append('GOBJECT')
if hasattr(self, 'threading'): if hasattr(self, 'threading'):
if valatask.profile == 'gobject':
valatask.threading = self.threading valatask.threading = self.threading
self.uselib = self.to_list(self.uselib)
if not 'GTHREAD' in self.uselib: if not 'GTHREAD' in self.uselib:
self.uselib.append('GTHREAD') self.uselib.append('GTHREAD')
else:
if hasattr(self, 'target_glib'): #Vala doesn't have threading support for dova nor posix
valatask.target_glib = self.target_glib Logs.warn("Profile %s does not have threading support" % valatask.profile)
if hasattr(self, 'gir'): if hasattr(self, 'gir'):
valatask.gir = self.gir valatask.gir = self.gir
@ -244,8 +259,23 @@ def detect(conf):
valac = conf.find_program('valac', var='VALAC', mandatory=True) 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"]: 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: try:
output = Utils.cmd_output(valac + " --version", silent=True) output = Utils.cmd_output(valac + " --version", silent=True)
@ -269,3 +299,9 @@ def detect(conf):
conf.env['VALAC_VERSION'] = valac_version conf.env['VALAC_VERSION'] = valac_version
conf.env['VALAFLAGS'] = '' 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')

13
tools/wafadmin/Utils.py

@ -129,6 +129,7 @@ try:
raise OSError("not a file" + filename) raise OSError("not a file" + filename)
except ImportError: except ImportError:
try:
try: try:
from hashlib import md5 from hashlib import md5
except ImportError: except ImportError:
@ -142,6 +143,9 @@ except ImportError:
m.update(filename) m.update(filename)
f.close() f.close()
return m.digest() return m.digest()
except ImportError:
# portability fixes may be added elsewhere (although, md5 should be everywhere by now)
md5 = None
class ordered_dict(UserDict): class ordered_dict(UserDict):
def __init__(self, dict = None): 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 = load_module(file_path, 'wscript_main')
g_module.root_path = file_path 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: # note: to register the module globally, use the following:
# sys.modules['wscript_main'] = g_module # sys.modules['wscript_main'] = g_module

2
tools/wafadmin/py3kfixes.py

@ -100,7 +100,7 @@ def r7(code):
@subst('Tools/python.py') @subst('Tools/python.py')
def r8(code): 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 return code
@subst('Tools/glib2.py') @subst('Tools/glib2.py')

Loading…
Cancel
Save