Browse Source

Update to waf 1.8.22

This is the last version on the 1.8.x branch. The build system will be
updated to the 1.9.x branch in a later commit.
tags/v1.9.13
Karl Linden 6 years ago
parent
commit
260a4352af
No known key found for this signature in database GPG Key ID: C0F669D8CE2576AB
13 changed files with 112 additions and 43 deletions
  1. +2
    -0
      .wafupdaterc
  2. +2
    -2
      waf
  3. +6
    -0
      waflib/ConfigSet.py
  4. +6
    -6
      waflib/Context.py
  5. +4
    -3
      waflib/Logs.py
  6. +17
    -7
      waflib/Scripting.py
  7. +19
    -5
      waflib/Task.py
  8. +2
    -1
      waflib/TaskGen.py
  9. +43
    -14
      waflib/Tools/c_config.py
  10. +1
    -1
      waflib/Tools/c_preproc.py
  11. +8
    -2
      waflib/Tools/waf_unit_test.py
  12. +1
    -1
      waflib/extras/xcode.py
  13. +1
    -1
      waflib/extras/xcode6.py

+ 2
- 0
.wafupdaterc View File

@@ -117,6 +117,7 @@ WAFLIB_STRIP_EXTRAS="
run_py_script run_py_script
run_r_script run_r_script
sas sas
satellite_assembly
scala scala
slow_qt4 slow_qt4
smart_continue smart_continue
@@ -133,4 +134,5 @@ WAFLIB_STRIP_EXTRAS="
valadoc valadoc
why why
win32_opts win32_opts
wix
" "

+ 2
- 2
waf View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# encoding: ISO8859-1 # encoding: ISO8859-1
# Thomas Nagy, 2005-2015
# Thomas Nagy, 2005-2016


""" """
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE.


import os, sys, inspect import os, sys, inspect


VERSION="1.8.17"
VERSION="1.8.22"
REVISION="x" REVISION="x"
GIT="x" GIT="x"
INSTALL="x" INSTALL="x"


+ 6
- 0
waflib/ConfigSet.py View File

@@ -335,6 +335,12 @@ class ConfigSet(object):
tbl[x] = copy.deepcopy(tbl[x]) tbl[x] = copy.deepcopy(tbl[x])
self.undo_stack = self.undo_stack + [orig] self.undo_stack = self.undo_stack + [orig]


def commit(self):
"""
Commits transactional changes. See :py:meth:`ConfigSet.stash`
"""
self.undo_stack.pop(-1)

def revert(self): def revert(self):
""" """
Reverts the object to a previous state. See :py:meth:`ConfigSet.stash` Reverts the object to a previous state. See :py:meth:`ConfigSet.stash`


+ 6
- 6
waflib/Context.py View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# encoding: utf-8 # encoding: utf-8
# Thomas Nagy, 2010 (ita)
# Thomas Nagy, 2010-2016 (ita)


""" """
Classes and functions required for waf commands Classes and functions required for waf commands
@@ -11,13 +11,13 @@ from waflib import Utils, Errors, Logs
import waflib.Node import waflib.Node


# the following 3 constants are updated on each new release (do not touch) # the following 3 constants are updated on each new release (do not touch)
HEXVERSION=0x1081100
HEXVERSION=0x1081600
"""Constant updated on new releases""" """Constant updated on new releases"""


WAFVERSION="1.8.17"
WAFVERSION="1.8.22"
"""Constant updated on new releases""" """Constant updated on new releases"""


WAFREVISION="cd7579a727d1b390bf9cbf111c1b20e811370bc0"
WAFREVISION="17d4d4faa52c454eb3580e482df69b2a80e19fa7"
"""Git revision when the waf version is updated""" """Git revision when the waf version is updated"""


ABI = 98 ABI = 98
@@ -352,7 +352,7 @@ class Context(ctx):
if 'input' in kw: if 'input' in kw:
if kw['input']: if kw['input']:
wargs['input'] = kw['input'] wargs['input'] = kw['input']
kw['stdin'] = Utils.subprocess.PIPE
kw['stdin'] = subprocess.PIPE
del kw['input'] del kw['input']


try: try:
@@ -432,7 +432,7 @@ class Context(ctx):
if 'input' in kw: if 'input' in kw:
if kw['input']: if kw['input']:
wargs['input'] = kw['input'] wargs['input'] = kw['input']
kw['stdin'] = Utils.subprocess.PIPE
kw['stdin'] = subprocess.PIPE
del kw['input'] del kw['input']


try: try:


+ 4
- 3
waflib/Logs.py View File

@@ -169,7 +169,7 @@ class log_handler(logging.StreamHandler):
else: else:
stream.write(fs % msg) stream.write(fs % msg)
except UnicodeError: except UnicodeError:
stream.write((fs % msg).encode("UTF-8"))
stream.write((fs % msg).encode('utf-8'))
else: else:
logging.StreamHandler.emit(self, record) logging.StreamHandler.emit(self, record)


@@ -200,8 +200,9 @@ class formatter(logging.Formatter):
c2 = getattr(rec, 'c2', colors.NORMAL) c2 = getattr(rec, 'c2', colors.NORMAL)
msg = '%s%s%s' % (c1, msg, c2) msg = '%s%s%s' % (c1, msg, c2)
else: else:
msg = msg.replace('\r', '\n')
msg = re.sub(r'\x1B\[(K|.*?(m|h|l))', '', msg)
# remove single \r that make long lines in text files
# and other terminal commands
msg = re.sub(r'\r(?!\n)|\x1B\[(K|.*?(m|h|l))', '', msg)


if rec.levelno >= logging.INFO: # ?? if rec.levelno >= logging.INFO: # ??
return msg return msg


+ 17
- 7
waflib/Scripting.py View File

@@ -76,7 +76,11 @@ def waf_entry_point(current_directory, version, wafdir):
# at the same time, store the first wscript file seen # at the same time, store the first wscript file seen
cur = current_directory cur = current_directory
while cur and not Context.top_dir: while cur and not Context.top_dir:
lst = os.listdir(cur)
try:
lst = os.listdir(cur)
except OSError:
lst = []
Logs.error('Directory %r is unreadable!' % cur)
if Options.lockfile in lst: if Options.lockfile in lst:
env = ConfigSet.ConfigSet() env = ConfigSet.ConfigSet()
try: try:
@@ -193,7 +197,7 @@ def set_main_module(file_path):
name = obj.__name__ name = obj.__name__
if not name in Context.g_module.__dict__: if not name in Context.g_module.__dict__:
setattr(Context.g_module, name, obj) setattr(Context.g_module, name, obj)
for k in (update, dist, distclean, distcheck, update):
for k in (update, dist, distclean, distcheck):
set_def(k) set_def(k)
# add dummy init and shutdown functions if they're not defined # add dummy init and shutdown functions if they're not defined
if not 'init' in Context.g_module.__dict__: if not 'init' in Context.g_module.__dict__:
@@ -614,13 +618,19 @@ def autoconfigure(execute_method):
do_config = h != env.hash do_config = h != env.hash


if do_config: if do_config:
Options.commands.insert(0, self.cmd)
Options.commands.insert(0, 'configure')
cmd = env['config_cmd'] or 'configure'
if Configure.autoconfig == 'clobber': if Configure.autoconfig == 'clobber':
tmp = Options.options.__dict__
Options.options.__dict__ = env.options Options.options.__dict__ = env.options
return

return execute_method(self)
try:
run_command(cmd)
finally:
Options.options.__dict__ = tmp
else:
run_command(cmd)
run_command(self.cmd)
else:
return execute_method(self)
return execute return execute
Build.BuildContext.execute = autoconfigure(Build.BuildContext.execute) Build.BuildContext.execute = autoconfigure(Build.BuildContext.execute)



+ 19
- 5
waflib/Task.py View File

@@ -950,6 +950,7 @@ def funex(c):
exec(c, dc) exec(c, dc)
return dc['f'] return dc['f']


re_novar = re.compile(r"^(SRC|TGT)\W+.*?$")
reg_act = re.compile(r"(?P<backslash>\\)|(?P<dollar>\$\$)|(?P<subst>\$\{(?P<var>\w+)(?P<code>.*?)\})", re.M) reg_act = re.compile(r"(?P<backslash>\\)|(?P<dollar>\$\$)|(?P<subst>\$\{(?P<var>\w+)(?P<code>.*?)\})", re.M)
def compile_fun_shell(line): def compile_fun_shell(line):
""" """
@@ -979,25 +980,31 @@ def compile_fun_shell(line):
else: app('" ".join([a.path_from(cwdx) for a in tsk.outputs])') else: app('" ".join([a.path_from(cwdx) for a in tsk.outputs])')
elif meth: elif meth:
if meth.startswith(':'): if meth.startswith(':'):
if var not in dvars:
dvars.append(var)
m = meth[1:] m = meth[1:]
if m == 'SRC': if m == 'SRC':
m = '[a.path_from(cwdx) for a in tsk.inputs]' m = '[a.path_from(cwdx) for a in tsk.inputs]'
elif m == 'TGT': elif m == 'TGT':
m = '[a.path_from(cwdx) for a in tsk.outputs]' m = '[a.path_from(cwdx) for a in tsk.outputs]'
elif re_novar.match(m):
m = '[tsk.inputs%s]' % m[3:]
elif re_novar.match(m):
m = '[tsk.outputs%s]' % m[3:]
elif m[:3] not in ('tsk', 'gen', 'bld'): elif m[:3] not in ('tsk', 'gen', 'bld'):
dvars.extend([var, meth[1:]])
dvars.append(meth[1:])
m = '%r' % m m = '%r' % m
app('" ".join(tsk.colon(%r, %s))' % (var, m)) app('" ".join(tsk.colon(%r, %s))' % (var, m))
else: else:
app('%s%s' % (var, meth)) app('%s%s' % (var, meth))
else: else:
if not var in dvars: dvars.append(var)
if var not in dvars:
dvars.append(var)
app("p('%s')" % var) app("p('%s')" % var)
if parm: parm = "%% (%s) " % (',\n\t\t'.join(parm)) if parm: parm = "%% (%s) " % (',\n\t\t'.join(parm))
else: parm = '' else: parm = ''


c = COMPILE_TEMPLATE_SHELL % (line, parm) c = COMPILE_TEMPLATE_SHELL % (line, parm)

Logs.debug('action: %s' % c.strip().splitlines()) Logs.debug('action: %s' % c.strip().splitlines())
return (funex(c), dvars) return (funex(c), dvars)


@@ -1034,20 +1041,27 @@ def compile_fun_noshell(line):
else: app("lst.extend([a.path_from(cwdx) for a in tsk.outputs])") else: app("lst.extend([a.path_from(cwdx) for a in tsk.outputs])")
elif meth: elif meth:
if meth.startswith(':'): if meth.startswith(':'):
if not var in dvars:
dvars.append(var)
m = meth[1:] m = meth[1:]
if m == 'SRC': if m == 'SRC':
m = '[a.path_from(cwdx) for a in tsk.inputs]' m = '[a.path_from(cwdx) for a in tsk.inputs]'
elif m == 'TGT': elif m == 'TGT':
m = '[a.path_from(cwdx) for a in tsk.outputs]' m = '[a.path_from(cwdx) for a in tsk.outputs]'
elif re_novar.match(m):
m = '[tsk.inputs%s]' % m[3:]
elif re_novar.match(m):
m = '[tsk.outputs%s]' % m[3:]
elif m[:3] not in ('tsk', 'gen', 'bld'): elif m[:3] not in ('tsk', 'gen', 'bld'):
dvars.extend([var, m])
dvars.append(m)
m = '%r' % m m = '%r' % m
app('lst.extend(tsk.colon(%r, %s))' % (var, m)) app('lst.extend(tsk.colon(%r, %s))' % (var, m))
else: else:
app('lst.extend(gen.to_list(%s%s))' % (var, meth)) app('lst.extend(gen.to_list(%s%s))' % (var, meth))
else: else:
app('lst.extend(to_list(env[%r]))' % var) app('lst.extend(to_list(env[%r]))' % var)
if not var in dvars: dvars.append(var)
if not var in dvars:
dvars.append(var)


if extr: if extr:
if params[-1]: if params[-1]:


+ 2
- 1
waflib/TaskGen.py View File

@@ -216,7 +216,8 @@ class task_gen(object):
tmp.append(x) tmp.append(x)


if prec: if prec:
raise Errors.WafError('Cycle detected in the method execution %r' % prec)
txt = '\n'.join(['- %s after %s' % (k, repr(v)) for k, v in prec.items()])
raise Errors.WafError('Cycle detected in the method execution\n%s' % txt)
out.reverse() out.reverse()
self.meths = out self.meths = out




+ 43
- 14
waflib/Tools/c_config.py View File

@@ -100,6 +100,7 @@ MACRO_TO_DEST_CPU = {
'__s390x__' : 's390x', '__s390x__' : 's390x',
'__s390__' : 's390', '__s390__' : 's390',
'__sh__' : 'sh', '__sh__' : 'sh',
'__xtensa__' : 'xtensa',
} }


@conf @conf
@@ -167,7 +168,12 @@ def parse_flags(self, line, uselib_store, env=None, force_static=False, posix=No
elif x.startswith('/LIBPATH:'): elif x.startswith('/LIBPATH:'):
prefix = (force_static or static) and 'STLIBPATH_' or 'LIBPATH_' prefix = (force_static or static) and 'STLIBPATH_' or 'LIBPATH_'
appu(prefix + uselib, [x.replace('/LIBPATH:', '')]) appu(prefix + uselib, [x.replace('/LIBPATH:', '')])
elif x == '-pthread' or x.startswith('+') or x.startswith('-std'):
elif x.startswith('-std='):
if '++' in x:
app('CXXFLAGS_' + uselib, [x])
else:
app('CFLAGS_' + uselib, [x])
elif x == '-pthread' or x.startswith('+'):
app('CFLAGS_' + uselib, [x]) app('CFLAGS_' + uselib, [x])
app('CXXFLAGS_' + uselib, [x]) app('CXXFLAGS_' + uselib, [x])
app('LINKFLAGS_' + uselib, [x]) app('LINKFLAGS_' + uselib, [x])
@@ -342,13 +348,13 @@ def exec_cfg(self, kw):


# retrieving variables of a module # retrieving variables of a module
if 'variables' in kw: if 'variables' in kw:
v = kw.get('env', self.env)
v_env = kw.get('env', self.env)
uselib = kw.get('uselib_store', kw['package'].upper()) uselib = kw.get('uselib_store', kw['package'].upper())
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(lst + ['--variable=' + v], env=env).strip() val = self.cmd_and_log(lst + ['--variable=' + v], env=env).strip()
var = '%s_%s' % (uselib, v) var = '%s_%s' % (uselib, v)
v[var] = val
v_env[var] = val
if not 'okmsg' in kw: if not 'okmsg' in kw:
kw['okmsg'] = 'yes' kw['okmsg'] = 'yes'
return return
@@ -635,13 +641,15 @@ def post_check(self, *k, **kw):


if 'define_name' in kw: if 'define_name' in kw:
# TODO simplify! # TODO simplify!
comment = kw.get('comment', '')
define_name = kw['define_name']
if 'header_name' in kw or 'function_name' in kw or 'type_name' in kw or 'fragment' in kw: if 'header_name' in kw or 'function_name' in kw or 'type_name' in kw or 'fragment' in kw:
if kw['execute'] and kw.get('define_ret', None) and isinstance(is_success, str): if kw['execute'] and kw.get('define_ret', None) and isinstance(is_success, str):
self.define(kw['define_name'], is_success, quote=kw.get('quote', 1))
self.define(define_name, is_success, quote=kw.get('quote', 1), comment=comment)
else: else:
self.define_cond(kw['define_name'], is_success)
self.define_cond(define_name, is_success, comment=comment)
else: else:
self.define_cond(kw['define_name'], is_success)
self.define_cond(define_name, is_success, comment=comment)


# consistency with check_cfg # consistency with check_cfg
if kw.get('global_define', None): if kw.get('global_define', None):
@@ -757,7 +765,20 @@ def check_cc(self, *k, **kw):
return self.check(*k, **kw) return self.check(*k, **kw)


@conf @conf
def define(self, key, val, quote=True):
def set_define_comment(self, key, comment):
# comments that appear in get_config_header
coms = self.env.DEFINE_COMMENTS
if not coms:
coms = self.env.DEFINE_COMMENTS = {}
coms[key] = comment or ''

@conf
def get_define_comment(self, key):
coms = self.env.DEFINE_COMMENTS or {}
return coms.get(key, '')

@conf
def define(self, key, val, quote=True, comment=''):
""" """
Store a single define and its state into conf.env.DEFINES. If the value is True, False or None it is cast to 1 or 0. Store a single define and its state into conf.env.DEFINES. If the value is True, False or None it is cast to 1 or 0.


@@ -791,9 +812,10 @@ def define(self, key, val, quote=True):
self.env.append_value('DEFINES', app) self.env.append_value('DEFINES', app)


self.env.append_unique(DEFKEYS, key) self.env.append_unique(DEFKEYS, key)
self.set_define_comment(key, comment)


@conf @conf
def undefine(self, key):
def undefine(self, key, comment=''):
""" """
Remove a define from conf.env.DEFINES Remove a define from conf.env.DEFINES


@@ -806,9 +828,10 @@ def undefine(self, key):
lst = [x for x in self.env['DEFINES'] if not x.startswith(ban)] lst = [x for x in self.env['DEFINES'] if not x.startswith(ban)]
self.env['DEFINES'] = lst self.env['DEFINES'] = lst
self.env.append_unique(DEFKEYS, key) self.env.append_unique(DEFKEYS, key)
self.set_define_comment(key, comment)


@conf @conf
def define_cond(self, key, val):
def define_cond(self, key, val, comment=''):
""" """
Conditionally define a name:: Conditionally define a name::


@@ -826,9 +849,9 @@ def define_cond(self, key, val):
assert key and isinstance(key, str) assert key and isinstance(key, str)


if val: if val:
self.define(key, 1)
self.define(key, 1, comment=comment)
else: else:
self.undefine(key)
self.undefine(key, comment=comment)


@conf @conf
def is_defined(self, key): def is_defined(self, key):
@@ -958,10 +981,13 @@ def get_config_header(self, defines=True, headers=False, define_prefix=''):
tbl[a] = b tbl[a] = b


for k in self.env[DEFKEYS]: for k in self.env[DEFKEYS]:
caption = self.get_define_comment(k)
if caption:
caption = ' /* %s */' % caption
try: try:
txt = '#define %s%s %s' % (define_prefix, k, tbl[k])
txt = '#define %s%s %s%s' % (define_prefix, k, tbl[k], caption)
except KeyError: except KeyError:
txt = '/* #undef %s%s */' % (define_prefix, k)
txt = '/* #undef %s%s */%s' % (define_prefix, k, caption)
lst.append(txt) lst.append(txt)
return "\n".join(lst) return "\n".join(lst)


@@ -1129,7 +1155,10 @@ def get_suncc_version(conf, cc):
version = (out or err) version = (out or err)
version = version.splitlines()[0] version = version.splitlines()[0]


version_re = re.compile(r'cc:\s+sun\s+(c\+\+|c)\s+(?P<major>\d*)\.(?P<minor>\d*)', re.I).search
# cc: Sun C 5.10 SunOS_i386 2009/06/03
# cc: Studio 12.5 Sun C++ 5.14 SunOS_sparc Beta 2015/11/17
# cc: WorkShop Compilers 5.0 98/12/15 C 5.0
version_re = re.compile(r'cc: (studio.*?|\s+)?(sun\s+(c\+\+|c)|(WorkShop\s+Compilers))?\s+(?P<major>\d*)\.(?P<minor>\d*)', re.I).search
match = version_re(version) match = version_re(version)
if match: if match:
k = match.groupdict() k = match.groupdict()


+ 1
- 1
waflib/Tools/c_preproc.py View File

@@ -735,7 +735,7 @@ def tokenize_private(s):
if v: if v:
if name == IDENT: if name == IDENT:
try: try:
g_optrans[v];
g_optrans[v]
name = OP name = OP
except KeyError: except KeyError:
# c++ specific # c++ specific


+ 8
- 2
waflib/Tools/waf_unit_test.py View File

@@ -127,18 +127,23 @@ class utest(Task.Task):


testcmd = getattr(self.generator, 'ut_cmd', False) or getattr(Options.options, 'testcmd', False) testcmd = getattr(self.generator, 'ut_cmd', False) or getattr(Options.options, 'testcmd', False)
if testcmd: if testcmd:
self.ut_exec = (testcmd % self.ut_exec[0]).split(' ')
self.ut_exec = (testcmd % " ".join(self.ut_exec)).split(' ')


proc = Utils.subprocess.Popen(self.ut_exec, cwd=cwd, env=self.get_test_env(), stderr=Utils.subprocess.PIPE, stdout=Utils.subprocess.PIPE) proc = Utils.subprocess.Popen(self.ut_exec, cwd=cwd, env=self.get_test_env(), stderr=Utils.subprocess.PIPE, stdout=Utils.subprocess.PIPE)
(stdout, stderr) = proc.communicate() (stdout, stderr) = proc.communicate()


tup = (filename, proc.returncode, stdout, stderr)
self.waf_unit_test_results = tup = (filename, proc.returncode, stdout, stderr)
testlock.acquire() testlock.acquire()
try: try:
return self.generator.add_test_results(tup) return self.generator.add_test_results(tup)
finally: finally:
testlock.release() testlock.release()


def post_run(self):
super(utest, self).post_run()
if getattr(Options.options, 'clear_failed_tests', False) and self.waf_unit_test_results[1]:
self.generator.bld.task_sigs[self.uid()] = None

def summary(bld): def summary(bld):
""" """
Display an execution summary:: Display an execution summary::
@@ -194,6 +199,7 @@ def options(opt):
""" """
opt.add_option('--notests', action='store_true', default=False, help='Exec no unit tests', dest='no_tests') opt.add_option('--notests', action='store_true', default=False, help='Exec no unit tests', dest='no_tests')
opt.add_option('--alltests', action='store_true', default=False, help='Exec all unit tests', dest='all_tests') opt.add_option('--alltests', action='store_true', default=False, help='Exec all unit tests', dest='all_tests')
opt.add_option('--clear-failed', action='store_true', default=False, help='Force failed unit tests to run again next time', dest='clear_failed_tests')
opt.add_option('--testcmd', action='store', default=False, opt.add_option('--testcmd', action='store', default=False,
help = 'Run the unit tests using the test-cmd string' help = 'Run the unit tests using the test-cmd string'
' example "--test-cmd="valgrind --error-exitcode=1' ' example "--test-cmd="valgrind --error-exitcode=1'


+ 1
- 1
waflib/extras/xcode.py View File

@@ -213,7 +213,7 @@ class PBXProject(XCodeNode):
XCodeNode.__init__(self) XCodeNode.__init__(self)
self.buildConfigurationList = XCConfigurationList([XCBuildConfiguration('waf', {})]) self.buildConfigurationList = XCConfigurationList([XCBuildConfiguration('waf', {})])
self.compatibilityVersion = version[0] self.compatibilityVersion = version[0]
self.hasScannedForEncodings = 1;
self.hasScannedForEncodings = 1
self.mainGroup = PBXGroup(name) self.mainGroup = PBXGroup(name)
self.projectRoot = "" self.projectRoot = ""
self.projectDirPath = "" self.projectDirPath = ""


+ 1
- 1
waflib/extras/xcode6.py View File

@@ -417,7 +417,7 @@ class PBXProject(XCodeNode):


self.buildConfigurationList = XCConfigurationList(configurations) self.buildConfigurationList = XCConfigurationList(configurations)
self.compatibilityVersion = version[0] self.compatibilityVersion = version[0]
self.hasScannedForEncodings = 1;
self.hasScannedForEncodings = 1
self.mainGroup = PBXGroup(name) self.mainGroup = PBXGroup(name)
self.projectRoot = "" self.projectRoot = ""
self.projectDirPath = "" self.projectDirPath = ""


Loading…
Cancel
Save