summaryrefslogtreecommitdiff
path: root/waflib/Tools
diff options
context:
space:
mode:
authorKarl Linden <karl.j.linden@gmail.com>2015-12-12 21:52:15 +0100
committerKarl Linden <karl.j.linden@gmail.com>2015-12-12 21:52:15 +0100
commitbb8e7497361f7e425acdab7bd5b22ad1c3947bbf (patch)
treebd19284599f1592f6dbaaced51637160e4e903b9 /waflib/Tools
parentf3cf9d6f895efffdbc3b5c4351482dca2690750c (diff)
downloadjack2-bb8e7497361f7e425acdab7bd5b22ad1c3947bbf.tar.gz
Update to waf 1.8.17.
Diffstat (limited to 'waflib/Tools')
-rw-r--r--waflib/Tools/c_aliases.py7
-rw-r--r--waflib/Tools/c_config.py36
-rw-r--r--waflib/Tools/c_osx.py9
-rw-r--r--waflib/Tools/c_tests.py1
-rw-r--r--waflib/Tools/ccroot.py9
-rw-r--r--waflib/Tools/clang.py1
-rw-r--r--waflib/Tools/clangxx.py1
-rw-r--r--waflib/Tools/compiler_c.py4
-rw-r--r--waflib/Tools/compiler_cxx.py4
-rw-r--r--waflib/Tools/errcheck.py5
-rw-r--r--waflib/Tools/gcc.py2
-rw-r--r--waflib/Tools/gxx.py2
-rw-r--r--waflib/Tools/icc.py2
-rw-r--r--waflib/Tools/icpc.py2
-rw-r--r--waflib/Tools/irixcc.py2
-rw-r--r--waflib/Tools/msvc.py43
16 files changed, 69 insertions, 61 deletions
diff --git a/waflib/Tools/c_aliases.py b/waflib/Tools/c_aliases.py
index 4bb6352e..0747abf5 100644
--- a/waflib/Tools/c_aliases.py
+++ b/waflib/Tools/c_aliases.py
@@ -4,8 +4,7 @@
"base for all c/c++ programs and libraries"
-import os, sys, re
-from waflib import Utils, Build, Errors
+from waflib import Utils, Errors
from waflib.Configure import conf
def get_extensions(lst):
@@ -49,7 +48,7 @@ def sniff_features(**kw):
feats.append('cxx')
break
- if 'c' in exts or 'vala' in exts:
+ if 'c' in exts or 'vala' in exts or 'gs' in exts:
feats.append('c')
for x in 'f f90 F F90 for FOR'.split():
@@ -71,7 +70,7 @@ def sniff_features(**kw):
feats.append(x + type)
will_link = True
if not will_link and not kw.get('features', []):
- raise Errors.WafError('Cannot link from %r, try passing eg: features="cprogram"?' % kw)
+ raise Errors.WafError('Cannot link from %r, try passing eg: features="c cprogram"?' % kw)
return feats
def set_features(kw, _type):
diff --git a/waflib/Tools/c_config.py b/waflib/Tools/c_config.py
index 14243cd8..f114dffb 100644
--- a/waflib/Tools/c_config.py
+++ b/waflib/Tools/c_config.py
@@ -6,7 +6,7 @@
C/C++/D configuration helpers
"""
-import os, re, shlex, sys
+import os, re, shlex
from waflib import Build, Utils, Task, Options, Logs, Errors, Runner
from waflib.TaskGen import after_method, feature
from waflib.Configure import conf
@@ -288,11 +288,11 @@ def exec_cfg(self, kw):
"""
path = Utils.to_list(kw['path'])
-
+ env = self.env.env or None
def define_it():
pkgname = kw.get('uselib_store', kw['package'].upper())
if kw.get('global_define'):
- # compatibility
+ # compatibility, replace by pkgname in WAF 1.9?
self.define(self.have_define(kw['package']), 1, False)
else:
self.env.append_unique('DEFINES_%s' % pkgname, "%s=1" % self.have_define(pkgname))
@@ -301,7 +301,7 @@ def exec_cfg(self, kw):
# pkg-config version
if 'atleast_pkgconfig_version' in kw:
cmd = path + ['--atleast-pkgconfig-version=%s' % kw['atleast_pkgconfig_version']]
- self.cmd_and_log(cmd)
+ self.cmd_and_log(cmd, env=env)
if not 'okmsg' in kw:
kw['okmsg'] = 'yes'
return
@@ -310,7 +310,7 @@ def exec_cfg(self, kw):
for x in cfg_ver:
y = x.replace('-', '_')
if y in kw:
- self.cmd_and_log(path + ['--%s=%s' % (x, kw[y]), kw['package']])
+ self.cmd_and_log(path + ['--%s=%s' % (x, kw[y]), kw['package']], env=env)
if not 'okmsg' in kw:
kw['okmsg'] = 'yes'
define_it()
@@ -318,7 +318,7 @@ def exec_cfg(self, kw):
# retrieving the version of a module
if 'modversion' in kw:
- version = self.cmd_and_log(path + ['--modversion', kw['modversion']]).strip()
+ version = self.cmd_and_log(path + ['--modversion', kw['modversion']], env=env).strip()
self.define('%s_VERSION' % Utils.quote_define_name(kw.get('uselib_store', kw['modversion'])), version)
return version
@@ -342,19 +342,19 @@ def exec_cfg(self, kw):
# retrieving variables of a module
if 'variables' in kw:
- env = kw.get('env', self.env)
+ v = kw.get('env', self.env)
uselib = kw.get('uselib_store', kw['package'].upper())
vars = Utils.to_list(kw['variables'])
for v in vars:
- val = self.cmd_and_log(lst + ['--variable=' + v]).strip()
+ val = self.cmd_and_log(lst + ['--variable=' + v], env=env).strip()
var = '%s_%s' % (uselib, v)
- env[var] = val
+ v[var] = val
if not 'okmsg' in kw:
kw['okmsg'] = 'yes'
return
# so we assume the command-line will output flags to be parsed afterwards
- ret = self.cmd_and_log(lst)
+ ret = self.cmd_and_log(lst, env=env)
if not 'okmsg' in kw:
kw['okmsg'] = 'yes'
@@ -482,7 +482,10 @@ def validate_c(self, kw):
kw['type'] = 'cprogram'
if not 'features' in kw:
- kw['features'] = [kw['compile_mode'], kw['type']] # "cprogram c"
+ if not 'header_name' in kw or kw.get('link_header_test', True):
+ kw['features'] = [kw['compile_mode'], kw['type']] # "c ccprogram"
+ else:
+ kw['features'] = [kw['compile_mode']]
else:
kw['features'] = Utils.to_list(kw['features'])
@@ -604,6 +607,11 @@ def validate_c(self, kw):
if self.env[INCKEYS]:
kw['code'] = '\n'.join(['#include <%s>' % x for x in self.env[INCKEYS]]) + '\n' + kw['code']
+ # in case defines lead to very long command-lines
+ if kw.get('merge_config_header', False) or env.merge_config_header:
+ kw['code'] = '%s\n\n%s' % (self.get_config_header(), kw['code'])
+ env.DEFINES = [] # modify the copy
+
if not kw.get('success'): kw['success'] = None
if 'define_name' in kw:
@@ -626,7 +634,7 @@ def post_check(self, *k, **kw):
is_success = (kw['success'] == 0)
if 'define_name' in kw:
- # TODO simplify?
+ # TODO simplify!
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):
self.define(kw['define_name'], is_success, quote=kw.get('quote', 1))
@@ -635,6 +643,10 @@ def post_check(self, *k, **kw):
else:
self.define_cond(kw['define_name'], is_success)
+ # consistency with check_cfg
+ if kw.get('global_define', None):
+ self.env[kw['define_name']] = is_success
+
if 'header_name' in kw:
if kw.get('auto_add_header_name', False):
self.env.append_value(INCKEYS, Utils.to_list(kw['header_name']))
diff --git a/waflib/Tools/c_osx.py b/waflib/Tools/c_osx.py
index 2b3c6474..4337cc68 100644
--- a/waflib/Tools/c_osx.py
+++ b/waflib/Tools/c_osx.py
@@ -6,8 +6,8 @@
MacOSX related tools
"""
-import os, shutil, sys, platform
-from waflib import TaskGen, Task, Build, Options, Utils, Errors
+import os, shutil, platform
+from waflib import Task, Utils, Errors
from waflib.TaskGen import taskgen_method, feature, after_method, before_method
app_info = '''
@@ -48,7 +48,6 @@ def create_bundle_dirs(self, name, out):
"""
Create bundle folders, used by :py:func:`create_task_macplist` and :py:func:`create_task_macapp`
"""
- bld = self.bld
dir = out.parent.find_or_declare(name)
dir.mkdir()
macos = dir.find_or_declare(['Contents', 'MacOS'])
@@ -102,7 +101,7 @@ def create_task_macapp(self):
inst_to = getattr(self, 'install_path', '/Applications') + '/%s/Resources' % name
for node in self.to_nodes(self.mac_files):
relpath = node.path_from(mac_files_root or node.parent)
- tsk = self.create_task('macapp', node, res_dir.make_node(relpath))
+ self.create_task('macapp', node, res_dir.make_node(relpath))
self.bld.install_as(os.path.join(inst_to, relpath), node)
if getattr(self, 'mac_resources', None):
@@ -121,7 +120,7 @@ def create_task_macapp(self):
nodes = [node]
for node in nodes:
rel = node.path_from(parent)
- tsk = self.create_task('macapp', node, res_dir.make_node(rel))
+ self.create_task('macapp', node, res_dir.make_node(rel))
self.bld.install_as(inst_to + '/%s' % rel, node)
if getattr(self.bld, 'is_install', None):
diff --git a/waflib/Tools/c_tests.py b/waflib/Tools/c_tests.py
index 2888828d..3b37f54c 100644
--- a/waflib/Tools/c_tests.py
+++ b/waflib/Tools/c_tests.py
@@ -9,7 +9,6 @@ Various configuration tests.
from waflib import Task
from waflib.Configure import conf
from waflib.TaskGen import feature, before_method, after_method
-import sys
LIB_CODE = '''
#ifdef _MSC_VER
diff --git a/waflib/Tools/ccroot.py b/waflib/Tools/ccroot.py
index 363d18d1..7fb53bba 100644
--- a/waflib/Tools/ccroot.py
+++ b/waflib/Tools/ccroot.py
@@ -25,8 +25,8 @@ USELIB_VARS['cxx'] = set(['INCLUDES', 'FRAMEWORKPATH', 'DEFINES', 'CPPFLAGS
USELIB_VARS['d'] = set(['INCLUDES', 'DFLAGS'])
USELIB_VARS['includes'] = set(['INCLUDES', 'FRAMEWORKPATH', 'ARCH'])
-USELIB_VARS['cprogram'] = USELIB_VARS['cxxprogram'] = set(['LIB', 'STLIB', 'LIBPATH', 'STLIBPATH', 'LINKFLAGS', 'RPATH', 'LINKDEPS', 'FRAMEWORK', 'FRAMEWORKPATH', 'ARCH'])
-USELIB_VARS['cshlib'] = USELIB_VARS['cxxshlib'] = set(['LIB', 'STLIB', 'LIBPATH', 'STLIBPATH', 'LINKFLAGS', 'RPATH', 'LINKDEPS', 'FRAMEWORK', 'FRAMEWORKPATH', 'ARCH'])
+USELIB_VARS['cprogram'] = USELIB_VARS['cxxprogram'] = set(['LIB', 'STLIB', 'LIBPATH', 'STLIBPATH', 'LINKFLAGS', 'RPATH', 'LINKDEPS', 'FRAMEWORK', 'FRAMEWORKPATH', 'ARCH', 'LDFLAGS'])
+USELIB_VARS['cshlib'] = USELIB_VARS['cxxshlib'] = set(['LIB', 'STLIB', 'LIBPATH', 'STLIBPATH', 'LINKFLAGS', 'RPATH', 'LINKDEPS', 'FRAMEWORK', 'FRAMEWORKPATH', 'ARCH', 'LDFLAGS'])
USELIB_VARS['cstlib'] = USELIB_VARS['cxxstlib'] = set(['ARFLAGS', 'LINKDEPS'])
USELIB_VARS['dprogram'] = set(['LIB', 'STLIB', 'LIBPATH', 'STLIBPATH', 'LINKFLAGS', 'RPATH', 'LINKDEPS'])
@@ -158,7 +158,10 @@ class link_task(Task.Task):
if len(nums) >= 2:
pattern += '.%s' % nums[1]
- tmp = folder + os.sep + pattern % name
+ if folder:
+ tmp = folder + os.sep + pattern % name
+ else:
+ tmp = pattern % name
target = self.generator.path.find_or_declare(tmp)
self.set_outputs(target)
diff --git a/waflib/Tools/clang.py b/waflib/Tools/clang.py
index 0740e00b..2259c5df 100644
--- a/waflib/Tools/clang.py
+++ b/waflib/Tools/clang.py
@@ -6,7 +6,6 @@
Detect the Clang C compiler
"""
-import os, sys
from waflib.Tools import ccroot, ar, gcc
from waflib.Configure import conf
diff --git a/waflib/Tools/clangxx.py b/waflib/Tools/clangxx.py
index b52fc352..b539b287 100644
--- a/waflib/Tools/clangxx.py
+++ b/waflib/Tools/clangxx.py
@@ -6,7 +6,6 @@
Detect the Clang++ C++ compiler
"""
-import os, sys
from waflib.Tools import ccroot, ar, gxx
from waflib.Configure import conf
diff --git a/waflib/Tools/compiler_c.py b/waflib/Tools/compiler_c.py
index 69c808f2..7d4e22ca 100644
--- a/waflib/Tools/compiler_c.py
+++ b/waflib/Tools/compiler_c.py
@@ -30,9 +30,9 @@ Not all compilers need to have a specific tool. For example, the clang compilers
$ CC=clang waf configure
"""
-import os, sys, imp, types, re
+import re
from waflib.Tools import ccroot
-from waflib import Utils, Configure
+from waflib import Utils
from waflib.Logs import debug
c_compiler = {
diff --git a/waflib/Tools/compiler_cxx.py b/waflib/Tools/compiler_cxx.py
index 4b15b9e3..6f0ea9ea 100644
--- a/waflib/Tools/compiler_cxx.py
+++ b/waflib/Tools/compiler_cxx.py
@@ -31,9 +31,9 @@ Not all compilers need to have a specific tool. For example, the clang compilers
"""
-import os, sys, imp, types, re
+import re
from waflib.Tools import ccroot
-from waflib import Utils, Configure
+from waflib import Utils
from waflib.Logs import debug
cxx_compiler = {
diff --git a/waflib/Tools/errcheck.py b/waflib/Tools/errcheck.py
index 14ce28fb..1f548aca 100644
--- a/waflib/Tools/errcheck.py
+++ b/waflib/Tools/errcheck.py
@@ -22,6 +22,7 @@ typos = {
meths_typos = ['__call__', 'program', 'shlib', 'stlib', 'objects']
+import sys
from waflib import Logs, Build, Node, Task, TaskGen, ConfigSet, Errors, Utils
import waflib.Tools.ccroot
@@ -84,6 +85,9 @@ def check_invalid_constraints(self):
# the build scripts have been read, so we can check for invalid after/before attributes on task classes
for cls in list(Task.classes.values()):
+ if sys.hexversion > 0x3000000 and issubclass(cls, Task.Task) and isinstance(cls.hcode, str):
+ raise Errors.WafError('Class %r has hcode value %r of type <str>, expecting <bytes> (use Utils.h_cmd() ?)' % (cls, cls.hcode))
+
for x in ('before', 'after'):
for y in Utils.to_list(getattr(cls, x, [])):
if not Task.classes.get(y, None):
@@ -103,7 +107,6 @@ def replace(m):
if x in kw:
if x == 'iscopy' and 'subst' in getattr(self, 'features', ''):
continue
- err = True
Logs.error('Fix the typo %r -> %r on %r' % (x, typos[x], ret))
return ret
setattr(Build.BuildContext, m, call)
diff --git a/waflib/Tools/gcc.py b/waflib/Tools/gcc.py
index 741a2e3f..0b897c7d 100644
--- a/waflib/Tools/gcc.py
+++ b/waflib/Tools/gcc.py
@@ -8,8 +8,6 @@
gcc/llvm detection.
"""
-import os, sys
-from waflib import Configure, Options, Utils
from waflib.Tools import ccroot, ar
from waflib.Configure import conf
diff --git a/waflib/Tools/gxx.py b/waflib/Tools/gxx.py
index 4c89273b..9cf52070 100644
--- a/waflib/Tools/gxx.py
+++ b/waflib/Tools/gxx.py
@@ -8,8 +8,6 @@
g++/llvm detection.
"""
-import os, sys
-from waflib import Configure, Options, Utils
from waflib.Tools import ccroot, ar
from waflib.Configure import conf
diff --git a/waflib/Tools/icc.py b/waflib/Tools/icc.py
index c50d4995..f3395030 100644
--- a/waflib/Tools/icc.py
+++ b/waflib/Tools/icc.py
@@ -7,7 +7,7 @@
Detect the Intel C compiler
"""
-import os, sys
+import sys
from waflib.Tools import ccroot, ar, gcc
from waflib.Configure import conf
diff --git a/waflib/Tools/icpc.py b/waflib/Tools/icpc.py
index ec1320ed..03603d44 100644
--- a/waflib/Tools/icpc.py
+++ b/waflib/Tools/icpc.py
@@ -6,7 +6,7 @@
Detect the Intel C++ compiler
"""
-import os, sys
+import sys
from waflib.Tools import ccroot, ar, gxx
from waflib.Configure import conf
diff --git a/waflib/Tools/irixcc.py b/waflib/Tools/irixcc.py
index be90eee0..55eb70be 100644
--- a/waflib/Tools/irixcc.py
+++ b/waflib/Tools/irixcc.py
@@ -6,8 +6,6 @@ compiler definition for irix/MIPSpro cc compiler
based on suncc.py from waf
"""
-import os
-from waflib import Utils
from waflib.Tools import ccroot, ar
from waflib.Configure import conf
diff --git a/waflib/Tools/msvc.py b/waflib/Tools/msvc.py
index c220f3f9..d98432e0 100644
--- a/waflib/Tools/msvc.py
+++ b/waflib/Tools/msvc.py
@@ -194,10 +194,14 @@ echo LIB=%%LIB%%;%%LIBPATH%%
try:
try:
conf.cmd_and_log(cxx + ['/help'], env=env)
+ except UnicodeError:
+ st = Utils.ex_stack()
+ if conf.logger:
+ conf.logger.error(st)
+ conf.fatal('msvc: Unicode error - check the code page?')
except Exception as e:
- debug('msvc: get_msvc_version: %r %r %r -> failure' % (compiler, version, target))
- debug(str(e))
- conf.fatal('msvc: cannot run the compiler (in get_msvc_version)')
+ debug('msvc: get_msvc_version: %r %r %r -> failure %s' % (compiler, version, target, str(e)))
+ conf.fatal('msvc: cannot run the compiler in get_msvc_version (run with -v to display errors)')
else:
debug('msvc: get_msvc_version: %r %r %r -> OK', compiler, version, target)
finally:
@@ -235,7 +239,7 @@ def gather_wsdk_versions(conf, versions):
path,type = Utils.winreg.QueryValueEx(msvc_version,'InstallationFolder')
except WindowsError:
continue
- if os.path.isfile(os.path.join(path, 'bin', 'SetEnv.cmd')):
+ if path and os.path.isfile(os.path.join(path, 'bin', 'SetEnv.cmd')):
targets = []
for target,arch in all_msvc_platforms:
try:
@@ -328,8 +332,8 @@ def get_compiler_env(conf, compiler, version, bat_target, bat, select=None):
"""
Gets the compiler environment variables as a tuple. Evaluation is eager by default.
If set to lazy with ``--msvc_lazy_autodetect`` or ``env.MSVC_LAZY_AUTODETECT``
- the environment is evaluated when the tuple is destructured or iterated. This means
- destructuring can throw :py:class:`conf.errors.ConfigurationError`.
+ the environment is evaluated when the tuple is destructured or iterated. This means
+ destructuring can throw :py:class:`conf.errors.ConfigurationError`.
:param conf: configuration context to use to eventually get the version environment
:param compiler: compiler name
@@ -350,26 +354,26 @@ def get_compiler_env(conf, compiler, version, bat_target, bat, select=None):
class lazytup(object):
"""
A tuple that evaluates its elements from a function when iterated or destructured.
-
+
:param fn: thunk to evaluate the tuple on demand
:param lazy: whether to delay evaluation or evaluate in the constructor
:param default: optional default for :py:func:`repr` if it should not evaluate
"""
- def __init__(self, fn, lazy=True, default=None):
+ def __init__(self, fn, lazy=True, default=None):
self.fn = fn
self.default = default
if not lazy:
self.evaluate()
- def __len__(self):
+ def __len__(self):
self.evaluate()
- return len(self.value)
- def __iter__(self):
+ return len(self.value)
+ def __iter__(self):
self.evaluate()
- for i, v in enumerate(self.value):
- yield v
- def __getitem__(self, i):
+ for i, v in enumerate(self.value):
+ yield v
+ def __getitem__(self, i):
self.evaluate()
- return self.value[i]
+ return self.value[i]
def __repr__(self):
if hasattr(self, 'value'):
return repr(self.value)
@@ -594,9 +598,9 @@ def gather_intel_composer_versions(conf, versions):
if (r'if exist "%VS110COMNTOOLS%..\IDE\VSWinExpress.exe"' in Utils.readf(compilervars_arch) and
not os.path.exists(vs_express_path) and not os.path.exists(dev_env_path)):
Logs.warn(('The Intel compilervar_arch.bat only checks for one Visual Studio SKU '
- '(VSWinExpress.exe) but it does not seem to be installed at %r. '
- 'The intel command line set up will fail to configure unless the file %r'
- 'is patched. See: %s') % (vs_express_path, compilervars_arch, patch_url))
+ '(VSWinExpress.exe) but it does not seem to be installed at %r. '
+ 'The intel command line set up will fail to configure unless the file %r'
+ 'is patched. See: %s') % (vs_express_path, compilervars_arch, patch_url))
except WindowsError:
pass
major = version[0:2]
@@ -833,9 +837,6 @@ def find_msvc(conf):
v.MSVC_MANIFEST = (compiler == 'msvc' and version >= 8) or (compiler == 'wsdk' and version >= 6) or (compiler == 'intel' and version >= 11)
# compiler
- cxx = None
- if v['CXX']: cxx = v['CXX']
- elif 'CXX' in conf.environ: cxx = conf.environ['CXX']
cxx = conf.find_program(compiler_name, var='CXX', path_list=path)
# before setting anything, check if the compiler is really msvc