This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Upgrade WAF to 1.5.14

  • Loading branch information...
ry committed Mar 8, 2010
1 parent c98b079 commit e898c1f2e30a05dd6a45f061468392ca44754b5f
View
@@ -12,6 +12,6 @@ t = join(w, 'Tools')
sys.path = [w, t] + sys.path
import Scripting
-VERSION="1.5.10"
+VERSION="1.5.14"
Scripting.prepare(t, os.getcwd(), VERSION, wafdir)
sys.exit(0)
View
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-# encoding: utf-8
-# Thomas Nagy, 2005-2009
+# encoding: ISO8859-1
+# Thomas Nagy, 2005-2010
"""
Redistribution and use in source and binary forms, with or without
@@ -37,7 +37,7 @@ if 'PSYCOWAF' in os.environ:
try:import psyco;psyco.full()
except:pass
-VERSION="1.5.10"
+VERSION="1.5.14"
REVISION="x"
INSTALL="x"
C1='x'
@@ -149,7 +149,7 @@ t = join(w, 'Tools')
f = join(w, '3rdparty')
sys.path = [w, t, f] + sys.path
-import Scripting
-Scripting.prepare(t, cwd, VERSION, wafdir)
-sys.exit(0)
+if __name__ == '__main__':
+ import Scripting
+ Scripting.prepare(t, cwd, VERSION, wafdir)
@@ -17,7 +17,7 @@
# conf.check_boost(lib='signals filesystem', static='onlystatic', score_version=(-1000, 1000), tag_minscore=1000)
#
#def build(bld):
-# bld.new_task_gen(source='main.c', target='bar', uselib="BOOST BOOST_SYSTEM")
+# bld(source='main.c', target='bar', uselib="BOOST BOOST_SYSTEM")
#
#ISSUES:
# * find_includes should be called only once!
@@ -28,7 +28,7 @@
## * the rest of the code has not really been tried
# * make certain a demo is provided (in demos/adv for example)
-# TODO: boost.py will be removed in waf 1.6
+# TODO: bad and underdocumented code -> boost.py will be removed in waf 1.6 to be rewritten later
import os.path, glob, types, re, sys
import Configure, config_c, Options, Utils, Logs
@@ -52,6 +52,7 @@
is_threadingtag = re.compile('^mt$')
is_abitag = re.compile('^[sgydpn]+$')
is_toolsettag = re.compile('^(acc|borland|como|cw|dmc|darwin|gcc|hp_cxx|intel|kylix|vc|mgw|qcc|sun|vacpp)\d*$')
+is_pythontag=re.compile('^py[0-9]{2}$')
def set_options(opt):
opt.add_option('--boost-includes', type='string', default='', dest='boostincludes', help='path to the boost directory where the includes are e.g. /usr/local/include/boost-1_35')
@@ -74,8 +75,8 @@ def version_string(version):
def libfiles(lib, pattern, lib_paths):
result = []
for lib_path in lib_paths:
- libname = pattern % ('boost_' + lib + '*')
- result += glob.glob(lib_path + '/' + libname)
+ libname = pattern % ('boost_%s[!_]*' % lib)
+ result += glob.glob(os.path.join(lib_path, libname))
return result
@conf
@@ -99,9 +100,10 @@ def tags_score(tags, kw):
score = 0
needed_tags = {
'threading': kw['tag_threading'],
- 'abi': kw['tag_abi'],
- 'toolset': kw['tag_toolset'],
- 'version': kw['tag_version']
+ 'abi': kw['tag_abi'],
+ 'toolset': kw['tag_toolset'],
+ 'version': kw['tag_version'],
+ 'python': kw['tag_python']
}
if kw['tag_toolset'] is None:
@@ -120,6 +122,7 @@ def tags_score(tags, kw):
if is_threadingtag.match(tag): found_tags['threading'] = tag
if is_abitag.match(tag): found_tags['abi'] = tag
if is_toolsettag.match(tag): found_tags['toolset'] = tag
+ if is_pythontag.match(tag): found_tags['python'] = tag
for tagname in needed_tags.iterkeys():
if needed_tags[tagname] is not None and tagname in found_tags:
@@ -148,8 +151,12 @@ def validate_boost(self, kw):
set_default(kw, x, None)
set_default(kw, 'tag_abi', '^[^d]*$')
+ set_default(kw, 'python', str(sys.version_info[0]) + str(sys.version_info[1]) )
+ set_default(kw, 'tag_python', '^py' + kw['python'] + '$')
+
set_default(kw, 'score_threading', (10, -10))
set_default(kw, 'score_abi', (10, -10))
+ set_default(kw, 'score_python', (10,-10))
set_default(kw, 'score_toolset', (1, -1))
set_default(kw, 'score_version', (100, -100))
View
@@ -33,11 +33,14 @@ def __init__(self, b=None, t=[]):
Utils.WafError.__init__(self, self.format_error())
def format_error(self):
- lst = ['Build failed']
+ lst = ['Build failed:']
for tsk in self.tasks:
txt = tsk.format_error()
if txt: lst.append(txt)
- return '\n'.join(lst)
+ sep = ' '
+ if len(lst) > 2:
+ sep = '\n'
+ return sep.join(lst)
def group_method(fun):
"""
@@ -62,7 +65,8 @@ def f(*k, **kw):
m = k[0].task_manager
if not m.groups: m.add_group()
m.groups[m.current_group].post_funs.append((fun, k, kw))
- kw['cwd'] = k[0].path
+ if not 'cwd' in kw:
+ kw['cwd'] = k[0].path
else:
fun(*k, **kw)
return f
@@ -269,7 +273,7 @@ def dw(on=True):
self.generator.start()
except KeyboardInterrupt:
dw()
- if self.generator.consumers:
+ if Runner.TaskConsumer.consumers:
self.save()
raise
except Exception:
@@ -278,7 +282,7 @@ def dw(on=True):
raise
else:
dw()
- if self.generator.consumers:
+ if Runner.TaskConsumer.consumers:
self.save()
if self.generator.error:
@@ -316,6 +320,9 @@ def install(self):
except OSError: pass
def new_task_gen(self, *k, **kw):
+ if self.task_gen_cache_names:
+ self.task_gen_cache_names = {}
+
kw['bld'] = self
if len(k) == 0:
ret = TaskGen.task_gen(*k, **kw)
@@ -328,6 +335,13 @@ def new_task_gen(self, *k, **kw):
ret = cls(*k, **kw)
return ret
+ def __call__(self, *k, **kw):
+ if self.task_gen_cache_names:
+ self.task_gen_cache_names = {}
+
+ kw['bld'] = self
+ return TaskGen.task_gen(*k, **kw)
+
def load_envs(self):
try:
lst = Utils.listdir(self.cachedir)
@@ -384,7 +398,7 @@ def init_variants(self):
lstvariants.append(env.variant())
self.lst_variants = lstvariants
- debug('build: list of variants is %r' % lstvariants)
+ debug('build: list of variants is %r', lstvariants)
for name in lstvariants+[0]:
for v in 'node_sigs cache_node_abspath'.split():
@@ -418,7 +432,7 @@ def load_dirs(self, srcdir, blddir, load_cache=1):
if not self.srcnode:
self.srcnode = self.root.ensure_dir_node_from_path(srcdir)
- debug('build: srcnode is %s and srcdir %s' % (self.srcnode.name, srcdir))
+ debug('build: srcnode is %s and srcdir %s', self.srcnode.name, srcdir)
self.path = self.srcnode
@@ -498,24 +512,30 @@ def rescan(self, src_dir_node):
lst.reverse()
# list the files in the build dirs
- # remove the existing timestamps if the build files are removed
- for variant in self.lst_variants:
- sub_path = os.path.join(self.bldnode.abspath(), variant , *lst)
- try:
+ try:
+ for variant in self.lst_variants:
+ sub_path = os.path.join(self.bldnode.abspath(), variant , *lst)
self.listdir_bld(src_dir_node, sub_path, variant)
- except OSError:
- #debug('build: osError on ' + sub_path)
- # listdir failed, remove all sigs of nodes
- # TODO more things to remove?
- dict = self.node_sigs[variant]
- for node in src_dir_node.childs.values():
- if node.id in dict:
+ except OSError:
+
+ # listdir failed, remove the build node signatures for all variants
+ for node in src_dir_node.childs.values():
+ if node.id & 3 != Node.BUILD:
+ continue
+
+ for dct in self.node_sigs:
+ if node.id in dct:
dict.__delitem__(node.id)
- # avoid deleting the build dir node
- if node.id != self.bldnode.id:
- src_dir_node.childs.__delitem__(node.name)
- os.makedirs(sub_path)
+ # the policy is to avoid removing nodes representing directories
+ src_dir_node.childs.__delitem__(node.name)
+
+ for variant in self.lst_variants:
+ sub_path = os.path.join(self.bldnode.abspath(), variant , *lst)
+ try:
+ os.makedirs(sub_path)
+ except OSError:
+ pass
# ======================================= #
def listdir_src(self, parent_node):
@@ -599,7 +619,7 @@ def hash_env_vars(self, env, vars_lst):
lst = [str(env[a]) for a in vars_lst]
ret = Utils.h_list(lst)
- debug("envhash: %r %r" % (ret, lst))
+ debug('envhash: %r %r', ret, lst)
# next time
self.cache_sig_vars[idx] = ret
@@ -769,14 +789,15 @@ def do_install(self, src, tgt, chmod=O644):
Logs.warn('could not remove %s (error code %r)' % (e.filename, e.errno))
return True
+ red = re.compile(r"^([A-Za-z]:)?[/\\\\]*")
def get_install_path(self, path, env=None):
"installation path prefixed by the destdir, the variables like in '${PREFIX}/bin' are substituted"
if not env: env = self.env
destdir = env.get_destdir()
path = path.replace('/', os.sep)
destpath = Utils.subst_vars(path, env)
if destdir:
- destpath = os.path.join(destdir, destpath.lstrip(os.sep))
+ destpath = os.path.join(destdir, self.red.sub('', destpath))
return destpath
def install_files(self, path, files, env=None, chmod=O644, relative_trick=False, cwd=None):
@@ -891,10 +912,11 @@ def symlink_as(self, path, src, env=None, cwd=None):
link = True
elif os.readlink(tgt) != src:
link = True
+
+ if link:
try: os.remove(tgt)
except OSError: pass
- if link:
info('* symlink %s (-> %s)' % (tgt, src))
os.symlink(src, tgt)
return 0
@@ -909,7 +931,7 @@ def symlink_as(self, path, src, env=None, cwd=None):
def exec_command(self, cmd, **kw):
# 'runner' zone is printed out for waf -v, see wafadmin/Options.py
- debug('runner: system command -> %s' % cmd)
+ debug('runner: system command -> %s', cmd)
if self.log:
self.log.write('%s\n' % cmd)
kw['log'] = self.log
@@ -157,6 +157,7 @@ def check_tool(self, input, tooldir=None, funs=None):
for tool in tools:
tool = tool.replace('++', 'xx')
if tool == 'java': tool = 'javaw'
+ if tool.lower() == 'unittest': tool = 'unittestw'
# avoid loading the same tool more than once with the same functions
# used by composite projects
@@ -166,10 +167,14 @@ def check_tool(self, input, tooldir=None, funs=None):
self.tool_cache.append(mag)
module = Utils.load_tool(tool, tooldir)
- func = getattr(module, 'detect', None)
- if func:
- if type(func) is type(find_file): func(self)
- else: self.eval_rules(funs or func)
+
+ if funs:
+ self.eval_rules(funs)
+ else:
+ func = getattr(module, 'detect', None)
+ if func:
+ if type(func) is type(find_file): func(self)
+ else: self.eval_rules(func)
self.tools.append({'tool':tool, 'tooldir':tooldir, 'funs':funs})
@@ -232,17 +237,20 @@ def add_os_flags(self, var, dest=None):
def check_message_1(self, sr):
self.line_just = max(self.line_just, len(sr))
- self.log.write(sr + '\n\n')
+ for x in ('\n', self.line_just * '-', '\n', sr, '\n'):
+ self.log.write(x)
Utils.pprint('NORMAL', "%s :" % sr.ljust(self.line_just), sep='')
def check_message_2(self, sr, color='GREEN'):
+ self.log.write(sr)
+ self.log.write('\n')
Utils.pprint(color, sr)
def check_message(self, th, msg, state, option=''):
sr = 'Checking for %s %s' % (th, msg)
self.check_message_1(sr)
p = self.check_message_2
- if state: p('ok ' + option)
+ if state: p('ok ' + str(option))
else: p('not found', 'YELLOW')
# FIXME remove in waf 1.6
@@ -268,10 +276,15 @@ def find_program(self, filename, path_list=[], var=None, mandatory=False):
ret = find_program_impl(self.env, x, path_list, var, environ=self.environ)
if ret: break
- self.check_message('program', ','.join(filename), ret, ret)
- self.log.write('find program=%r paths=%r var=%r -> %r\n\n' % (filename, path_list, var, ret))
- if not ret and mandatory:
- self.fatal('The program %r could not be found' % filename)
+ self.check_message_1('Check for program %s' % ' or '.join(filename))
+ self.log.write(' find program=%r paths=%r var=%r\n -> %r\n' % (filename, path_list, var, ret))
+ if ret:
+ Utils.pprint('GREEN', str(ret))
+ else:
+ Utils.pprint('YELLOW', 'not found')
+ if mandatory:
+ self.fatal('The program %r is required' % filename)
+
if var:
self.env[var] = ret
return ret
@@ -9,9 +9,9 @@
"""
# do not touch these three lines, they are updated automatically
-HEXVERSION = 0x105010
-WAFVERSION="1.5.10"
-WAFREVISION = "6794M"
+HEXVERSION = 0x105014
+WAFVERSION="1.5.14"
+WAFREVISION = "7363M"
ABI = 7
# permissions
Oops, something went wrong.

0 comments on commit e898c1f

Please sign in to comment.