From 3b7dfc51acc2dc0ea52cbf1733107f14405828e0 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Fri, 15 Jun 2018 13:29:45 +0300 Subject: third_party/waf: upgrade to waf 2.0.8 Signed-off-by: Alexander Bokovoy Reviewed-by: Andrew Bartlett --- third_party/waf/waflib/Build.py | 4 - third_party/waf/waflib/ConfigSet.py | 4 - third_party/waf/waflib/Configure.py | 14 +- third_party/waf/waflib/Context.py | 38 +++--- third_party/waf/waflib/Errors.py | 4 - third_party/waf/waflib/Logs.py | 4 - third_party/waf/waflib/Node.py | 60 +++++++-- third_party/waf/waflib/Options.py | 4 - third_party/waf/waflib/Runner.py | 49 +++++-- third_party/waf/waflib/Scripting.py | 4 - third_party/waf/waflib/Task.py | 40 +++++- third_party/waf/waflib/TaskGen.py | 11 +- third_party/waf/waflib/Tools/__init__.py | 4 - third_party/waf/waflib/Tools/ar.py | 4 - third_party/waf/waflib/Tools/asm.py | 4 - third_party/waf/waflib/Tools/bison.py | 4 - third_party/waf/waflib/Tools/c.py | 4 - third_party/waf/waflib/Tools/c_aliases.py | 4 - third_party/waf/waflib/Tools/c_config.py | 4 - third_party/waf/waflib/Tools/c_osx.py | 4 - third_party/waf/waflib/Tools/c_preproc.py | 4 - third_party/waf/waflib/Tools/c_tests.py | 4 - third_party/waf/waflib/Tools/ccroot.py | 10 +- third_party/waf/waflib/Tools/clang.py | 4 - third_party/waf/waflib/Tools/clangxx.py | 4 - third_party/waf/waflib/Tools/compiler_c.py | 4 - third_party/waf/waflib/Tools/compiler_cxx.py | 4 - third_party/waf/waflib/Tools/compiler_d.py | 4 - third_party/waf/waflib/Tools/compiler_fc.py | 4 - third_party/waf/waflib/Tools/cs.py | 4 - third_party/waf/waflib/Tools/cxx.py | 4 - third_party/waf/waflib/Tools/d.py | 4 - third_party/waf/waflib/Tools/d_config.py | 4 - third_party/waf/waflib/Tools/d_scan.py | 4 - third_party/waf/waflib/Tools/dbus.py | 6 +- third_party/waf/waflib/Tools/dmd.py | 4 - third_party/waf/waflib/Tools/errcheck.py | 4 - third_party/waf/waflib/Tools/fc.py | 4 - third_party/waf/waflib/Tools/fc_config.py | 4 - third_party/waf/waflib/Tools/fc_scan.py | 4 - third_party/waf/waflib/Tools/flex.py | 4 - third_party/waf/waflib/Tools/g95.py | 4 - third_party/waf/waflib/Tools/gas.py | 4 - third_party/waf/waflib/Tools/gcc.py | 4 - third_party/waf/waflib/Tools/gdc.py | 4 - third_party/waf/waflib/Tools/gfortran.py | 4 - third_party/waf/waflib/Tools/glib2.py | 4 - third_party/waf/waflib/Tools/gnu_dirs.py | 4 - third_party/waf/waflib/Tools/gxx.py | 4 - third_party/waf/waflib/Tools/icc.py | 4 - third_party/waf/waflib/Tools/icpc.py | 4 - third_party/waf/waflib/Tools/ifort.py | 4 - third_party/waf/waflib/Tools/intltool.py | 4 - third_party/waf/waflib/Tools/irixcc.py | 4 - third_party/waf/waflib/Tools/javaw.py | 4 - third_party/waf/waflib/Tools/ldc2.py | 4 - third_party/waf/waflib/Tools/lua.py | 4 - third_party/waf/waflib/Tools/md5_tstamp.py | 4 - third_party/waf/waflib/Tools/msvc.py | 18 +-- third_party/waf/waflib/Tools/nasm.py | 4 - third_party/waf/waflib/Tools/nobuild.py | 4 - third_party/waf/waflib/Tools/perl.py | 4 - third_party/waf/waflib/Tools/python.py | 10 +- third_party/waf/waflib/Tools/qt5.py | 31 ++++- third_party/waf/waflib/Tools/ruby.py | 4 - third_party/waf/waflib/Tools/suncc.py | 4 - third_party/waf/waflib/Tools/suncxx.py | 4 - third_party/waf/waflib/Tools/tex.py | 4 - third_party/waf/waflib/Tools/vala.py | 4 - third_party/waf/waflib/Tools/waf_unit_test.py | 10 +- third_party/waf/waflib/Tools/winres.py | 4 - third_party/waf/waflib/Tools/xlc.py | 4 - third_party/waf/waflib/Tools/xlcxx.py | 4 - third_party/waf/waflib/Utils.py | 21 ++- third_party/waf/waflib/__init__.py | 4 - third_party/waf/waflib/ansiterm.py | 4 - third_party/waf/waflib/extras/__init__.py | 4 - third_party/waf/waflib/extras/batched_cc.py | 4 - third_party/waf/waflib/extras/biber.py | 4 - third_party/waf/waflib/extras/bjam.py | 4 - third_party/waf/waflib/extras/blender.py | 4 - third_party/waf/waflib/extras/boo.py | 4 - third_party/waf/waflib/extras/boost.py | 123 +++++++++++++---- .../waf/waflib/extras/build_file_tracker.py | 4 - third_party/waf/waflib/extras/build_logs.py | 4 - third_party/waf/waflib/extras/buildcopy.py | 4 - third_party/waf/waflib/extras/c_bgxlc.py | 4 - third_party/waf/waflib/extras/c_dumbpreproc.py | 4 - third_party/waf/waflib/extras/c_emscripten.py | 4 - third_party/waf/waflib/extras/c_nec.py | 4 - third_party/waf/waflib/extras/cabal.py | 4 - third_party/waf/waflib/extras/cfg_altoptions.py | 4 - .../waflib/extras/clang_compilation_database.py | 13 +- third_party/waf/waflib/extras/codelite.py | 4 - third_party/waf/waflib/extras/color_gcc.py | 4 - third_party/waf/waflib/extras/color_rvct.py | 4 - third_party/waf/waflib/extras/compat15.py | 4 - third_party/waf/waflib/extras/cppcheck.py | 4 - third_party/waf/waflib/extras/cpplint.py | 4 - third_party/waf/waflib/extras/cross_gnu.py | 4 - third_party/waf/waflib/extras/cython.py | 4 - third_party/waf/waflib/extras/dcc.py | 4 - third_party/waf/waflib/extras/distnet.py | 5 - third_party/waf/waflib/extras/doxygen.py | 8 +- third_party/waf/waflib/extras/dpapi.py | 4 - third_party/waf/waflib/extras/eclipse.py | 128 ++++++++++++------ third_party/waf/waflib/extras/erlang.py | 4 - third_party/waf/waflib/extras/fast_partial.py | 4 - third_party/waf/waflib/extras/fc_bgxlf.py | 4 - third_party/waf/waflib/extras/fc_cray.py | 4 - third_party/waf/waflib/extras/fc_nag.py | 4 - third_party/waf/waflib/extras/fc_nec.py | 4 - third_party/waf/waflib/extras/fc_open64.py | 4 - third_party/waf/waflib/extras/fc_pgfortran.py | 4 - third_party/waf/waflib/extras/fc_solstudio.py | 4 - third_party/waf/waflib/extras/fc_xlf.py | 4 - third_party/waf/waflib/extras/file_to_object.py | 4 - third_party/waf/waflib/extras/fluid.py | 4 - third_party/waf/waflib/extras/freeimage.py | 4 - third_party/waf/waflib/extras/fsb.py | 4 - third_party/waf/waflib/extras/fsc.py | 4 - third_party/waf/waflib/extras/gccdeps.py | 4 - third_party/waf/waflib/extras/gdbus.py | 87 ++++++++++++ third_party/waf/waflib/extras/gob2.py | 4 - third_party/waf/waflib/extras/halide.py | 4 - third_party/waf/waflib/extras/javatest.py | 4 - third_party/waf/waflib/extras/kde4.py | 4 - third_party/waf/waflib/extras/local_rpath.py | 4 - third_party/waf/waflib/extras/make.py | 4 - third_party/waf/waflib/extras/midl.py | 4 - third_party/waf/waflib/extras/msvcdeps.py | 4 - third_party/waf/waflib/extras/msvs.py | 4 - third_party/waf/waflib/extras/netcache_client.py | 4 - third_party/waf/waflib/extras/objcopy.py | 4 - third_party/waf/waflib/extras/ocaml.py | 4 - third_party/waf/waflib/extras/package.py | 4 - third_party/waf/waflib/extras/parallel_debug.py | 4 - third_party/waf/waflib/extras/pch.py | 10 +- third_party/waf/waflib/extras/pep8.py | 4 - third_party/waf/waflib/extras/pgicc.py | 4 - third_party/waf/waflib/extras/pgicxx.py | 4 - third_party/waf/waflib/extras/proc.py | 4 - third_party/waf/waflib/extras/protoc.py | 18 ++- third_party/waf/waflib/extras/pyqt5.py | 4 - third_party/waf/waflib/extras/pytest.py | 4 - third_party/waf/waflib/extras/qnxnto.py | 4 - third_party/waf/waflib/extras/qt4.py | 4 - third_party/waf/waflib/extras/relocation.py | 4 - third_party/waf/waflib/extras/remote.py | 4 - third_party/waf/waflib/extras/resx.py | 4 - third_party/waf/waflib/extras/review.py | 4 - third_party/waf/waflib/extras/rst.py | 4 - third_party/waf/waflib/extras/run_do_script.py | 4 - third_party/waf/waflib/extras/run_m_script.py | 4 - third_party/waf/waflib/extras/run_py_script.py | 4 - third_party/waf/waflib/extras/run_r_script.py | 4 - third_party/waf/waflib/extras/sas.py | 4 - .../waf/waflib/extras/satellite_assembly.py | 4 - third_party/waf/waflib/extras/scala.py | 4 - third_party/waf/waflib/extras/slow_qt4.py | 6 +- third_party/waf/waflib/extras/softlink_libs.py | 4 - third_party/waf/waflib/extras/stale.py | 4 - third_party/waf/waflib/extras/stracedeps.py | 4 - third_party/waf/waflib/extras/swig.py | 22 +-- third_party/waf/waflib/extras/syms.py | 4 - third_party/waf/waflib/extras/ticgt.py | 4 - third_party/waf/waflib/extras/unity.py | 4 - third_party/waf/waflib/extras/use_config.py | 4 - third_party/waf/waflib/extras/valadoc.py | 4 - third_party/waf/waflib/extras/waf_xattr.py | 150 +++++++++++++++++++++ third_party/waf/waflib/extras/why.py | 4 - third_party/waf/waflib/extras/win32_opts.py | 4 - third_party/waf/waflib/extras/wix.py | 4 - third_party/waf/waflib/extras/xcode6.py | 6 +- third_party/waf/waflib/fixpy2.py | 4 - third_party/waf/waflib/processor.py | 4 - 176 files changed, 657 insertions(+), 841 deletions(-) create mode 100644 third_party/waf/waflib/extras/gdbus.py create mode 100644 third_party/waf/waflib/extras/waf_xattr.py (limited to 'third_party') diff --git a/third_party/waf/waflib/Build.py b/third_party/waf/waflib/Build.py index 70ebd697c24..8347a287a81 100644 --- a/third_party/waf/waflib/Build.py +++ b/third_party/waf/waflib/Build.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2018 (ita) diff --git a/third_party/waf/waflib/ConfigSet.py b/third_party/waf/waflib/ConfigSet.py index d07f4c304fb..b300bb56b7c 100644 --- a/third_party/waf/waflib/ConfigSet.py +++ b/third_party/waf/waflib/ConfigSet.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2018 (ita) diff --git a/third_party/waf/waflib/Configure.py b/third_party/waf/waflib/Configure.py index 839413e9201..20ca705e696 100644 --- a/third_party/waf/waflib/Configure.py +++ b/third_party/waf/waflib/Configure.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2018 (ita) @@ -315,11 +311,7 @@ def conf(f): :type f: function """ def fun(*k, **kw): - mandatory = True - if 'mandatory' in kw: - mandatory = kw['mandatory'] - del kw['mandatory'] - + mandatory = kw.pop('mandatory', True) try: return f(*k, **kw) except Errors.ConfigurationError: @@ -426,8 +418,8 @@ def find_program(self, filename, **kw): :type var: string :param value: obtain the program from the value passed exclusively :type value: list or string (list is preferred) - :param ext: list of extensions for the binary (do not add an extension for portability) - :type ext: list of string + :param exts: list of extensions for the binary (do not add an extension for portability) + :type exts: list of string :param msg: name to display in the log, by default filename is used :type msg: string :param interpreter: interpreter for the program diff --git a/third_party/waf/waflib/Context.py b/third_party/waf/waflib/Context.py index 7eab573e28d..3222fb1551c 100644 --- a/third_party/waf/waflib/Context.py +++ b/third_party/waf/waflib/Context.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2010-2018 (ita) @@ -15,13 +11,13 @@ from waflib import Utils, Errors, Logs import waflib.Node # the following 3 constants are updated on each new release (do not touch) -HEXVERSION=0x2000400 +HEXVERSION=0x2000800 """Constant updated on new releases""" -WAFVERSION="2.0.4" +WAFVERSION="2.0.8" """Constant updated on new releases""" -WAFREVISION="5996879673deb7166b61a299be317a738de6891e" +WAFREVISION="f78fbc32bb355a3291c9b5f79bbe0c8dfe81282a" """Git revision when the waf version is updated""" ABI = 20 @@ -56,6 +52,9 @@ out_dir = '' waf_dir = '' """Directory containing the waf modules""" +default_encoding = Utils.console_encoding() +"""Encoding to use when reading outputs from other processes""" + g_module = None """ Module representing the top-level wscript file (see :py:const:`waflib.Context.run_dir`) @@ -358,6 +357,8 @@ class Context(ctx): if not isinstance(kw['cwd'], str): kw['cwd'] = kw['cwd'].abspath() + encoding = kw.pop('decode_as', default_encoding) + try: ret, out, err = Utils.run_process(cmd, kw, cargs) except Exception as e: @@ -365,14 +366,14 @@ class Context(ctx): if out: if not isinstance(out, str): - out = out.decode(sys.stdout.encoding or 'latin-1', errors='replace') + out = out.decode(encoding, errors='replace') if self.logger: self.logger.debug('out: %s', out) else: Logs.info(out, extra={'stream':sys.stdout, 'c1': ''}) if err: if not isinstance(err, str): - err = err.decode(sys.stdout.encoding or 'latin-1', errors='replace') + err = err.decode(encoding, errors='replace') if self.logger: self.logger.error('err: %s' % err) else: @@ -408,17 +409,8 @@ class Context(ctx): kw['shell'] = isinstance(cmd, str) self.log_command(cmd, kw) - if 'quiet' in kw: - quiet = kw['quiet'] - del kw['quiet'] - else: - quiet = None - - if 'output' in kw: - to_ret = kw['output'] - del kw['output'] - else: - to_ret = STDOUT + quiet = kw.pop('quiet', None) + to_ret = kw.pop('output', STDOUT) if Logs.verbose and not kw['shell'] and not Utils.check_exe(cmd[0]): raise Errors.WafError('Program %r not found!' % cmd[0]) @@ -444,15 +436,17 @@ class Context(ctx): if not isinstance(kw['cwd'], str): kw['cwd'] = kw['cwd'].abspath() + encoding = kw.pop('decode_as', default_encoding) + try: ret, out, err = Utils.run_process(cmd, kw, cargs) except Exception as e: raise Errors.WafError('Execution failure: %s' % str(e), ex=e) if not isinstance(out, str): - out = out.decode(sys.stdout.encoding or 'latin-1', errors='replace') + out = out.decode(encoding, errors='replace') if not isinstance(err, str): - err = err.decode(sys.stdout.encoding or 'latin-1', errors='replace') + err = err.decode(encoding, errors='replace') if out and quiet != STDOUT and quiet != BOTH: self.to_log('out: %s' % out) diff --git a/third_party/waf/waflib/Errors.py b/third_party/waf/waflib/Errors.py index c38a557128e..bf75c1b6611 100644 --- a/third_party/waf/waflib/Errors.py +++ b/third_party/waf/waflib/Errors.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2010-2018 (ita) diff --git a/third_party/waf/waflib/Logs.py b/third_party/waf/waflib/Logs.py index 4d4db5ecdd3..2a475169b9b 100644 --- a/third_party/waf/waflib/Logs.py +++ b/third_party/waf/waflib/Logs.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2018 (ita) diff --git a/third_party/waf/waflib/Node.py b/third_party/waf/waflib/Node.py index a61902d00e5..4ac1ea8a0b8 100644 --- a/third_party/waf/waflib/Node.py +++ b/third_party/waf/waflib/Node.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2018 (ita) @@ -630,11 +626,10 @@ class Node(object): if maxdepth: for k in node.ant_iter(accept=accept, maxdepth=maxdepth - 1, pats=npats, dir=dir, src=src, remove=remove, quiet=quiet): yield k - raise StopIteration def ant_glob(self, *k, **kw): """ - Finds files across folders: + Finds files across folders and returns Node objects: * ``**/*`` find all files recursively * ``**/*.class`` find all files ending by .class @@ -643,14 +638,51 @@ class Node(object): For example:: def configure(cfg): - cfg.path.ant_glob('**/*.cpp') # finds all .cpp files - cfg.root.ant_glob('etc/*.txt') # matching from the filesystem root can be slow - cfg.path.ant_glob('*.cpp', excl=['*.c'], src=True, dir=False) + # find all .cpp files + cfg.path.ant_glob('**/*.cpp') + # find particular files from the root filesystem (can be slow) + cfg.root.ant_glob('etc/*.txt') + # simple exclusion rule example + cfg.path.ant_glob('*.c*', excl=['*.c'], src=True, dir=False) + + For more information about the patterns, consult http://ant.apache.org/manual/dirtasks.html + Please remember that the '..' sequence does not represent the parent directory:: + + def configure(cfg): + cfg.path.ant_glob('../*.h') # incorrect + cfg.path.parent.ant_glob('*.h') # correct + + The Node structure is itself a filesystem cache, so certain precautions must + be taken while matching files in the build or installation phases. + Nodes objects that do have a corresponding file or folder are garbage-collected by default. + This garbage collection is usually required to prevent returning files that do not + exist anymore. Yet, this may also remove Node objects of files that are yet-to-be built. - For more information see http://ant.apache.org/manual/dirtasks.html + This typically happens when trying to match files in the build directory, + but there are also cases when files are created in the source directory. + Run ``waf -v`` to display any warnings, and try consider passing ``remove=False`` + when matching files in the build directory. + + Since ant_glob can traverse both source and build folders, it is a best practice + to call this method only from the most specific build node:: + + def build(bld): + # traverses the build directory, may need ``remove=False``: + bld.path.ant_glob('project/dir/**/*.h') + # better, no accidental build directory traversal: + bld.path.find_node('project/dir').ant_glob('**/*.h') # best + + In addition, files and folders are listed immediately. When matching files in the + build folders, consider passing ``generator=True`` so that the generator object + returned can defer computation to a later stage. For example:: + + def build(bld): + bld(rule='tar xvf ${SRC}', source='arch.tar') + bld.add_group() + gen = bld.bldnode.ant_glob("*.h", generator=True, remove=True) + # files will be listed only after the arch.tar is unpacked + bld(rule='ls ${SRC}', source=gen, name='XYZ') - The nodes that correspond to files and folders that do not exist are garbage-collected. - To prevent this behaviour in particular when running over the build directory, pass ``remove=False`` :param incl: ant patterns or list of patterns to include :type incl: string or list of strings @@ -664,13 +696,13 @@ class Node(object): :type maxdepth: int :param ignorecase: ignore case while matching (False by default) :type ignorecase: bool - :returns: The corresponding Nodes + :param generator: Whether to evaluate the Nodes lazily :type generator: bool :param remove: remove files/folders that do not exist (True by default) :type remove: bool :param quiet: disable build directory traversal warnings (verbose mode) :type quiet: bool - :returns: Whether to evaluate the Nodes lazily, alters the type of the returned value + :returns: The corresponding Node objects as a list or as a generator object (generator=True) :rtype: by default, list of :py:class:`waflib.Node.Node` instances """ src = kw.get('src', True) diff --git a/third_party/waf/waflib/Options.py b/third_party/waf/waflib/Options.py index 39873c629cc..ad802d4b905 100644 --- a/third_party/waf/waflib/Options.py +++ b/third_party/waf/waflib/Options.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Scott Newton, 2005 (scottn) diff --git a/third_party/waf/waflib/Runner.py b/third_party/waf/waflib/Runner.py index 30e42d3b099..7535c83de9e 100644 --- a/third_party/waf/waflib/Runner.py +++ b/third_party/waf/waflib/Runner.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2018 (ita) @@ -12,9 +8,21 @@ Runner.py: Task scheduling and execution import heapq, traceback try: - from queue import Queue + from queue import Queue, PriorityQueue except ImportError: from Queue import Queue + try: + from Queue import PriorityQueue + except ImportError: + class PriorityQueue(Queue): + def _init(self, maxsize): + self.maxsize = maxsize + self.queue = [] + def _put(self, item): + heapq.heappush(self.queue, item) + def _get(self): + return heapq.heappop(self.queue) + from waflib import Utils, Task, Errors, Logs GAP = 5 @@ -34,6 +42,7 @@ class PriorityTasks(object): def append(self, task): heapq.heappush(self.lst, task) def appendleft(self, task): + "Deprecated, do not use" heapq.heappush(self.lst, task) def pop(self): return heapq.heappop(self.lst) @@ -141,7 +150,7 @@ class Parallel(object): self.incomplete = set() """List of :py:class:`waflib.Task.Task` waiting for dependent tasks to complete (DAG)""" - self.ready = Queue(0) + self.ready = PriorityQueue(0) """List of :py:class:`waflib.Task.Task` ready to be executed by consumers""" self.out = Queue(0) @@ -261,7 +270,26 @@ class Parallel(object): :type tsk: :py:attr:`waflib.Task.Task` """ if getattr(tsk, 'more_tasks', None): - # TODO recompute priorities globally? + more = set(tsk.more_tasks) + groups_done = set() + def iteri(a, b): + for x in a: + yield x + for x in b: + yield x + + # Update the dependency tree + # this assumes that task.run_after values were updated + for x in iteri(self.outstanding, self.incomplete): + for k in x.run_after: + if isinstance(k, Task.TaskGroup): + if k not in groups_done: + groups_done.add(k) + for j in k.prev & more: + self.revdeps[j].add(k) + elif k in more: + self.revdeps[k].add(x) + ready, waiting = self.prio_and_split(tsk.more_tasks) self.outstanding.extend(ready) self.incomplete.update(waiting) @@ -480,13 +508,12 @@ class Parallel(object): reverse = self.revdeps + groups_done = set() for x in tasks: for k in x.run_after: if isinstance(k, Task.TaskGroup): - if k.done: - pass - else: - k.done = True + if k not in groups_done: + groups_done.add(k) for j in k.prev: reverse[j].add(k) else: diff --git a/third_party/waf/waflib/Scripting.py b/third_party/waf/waflib/Scripting.py index 642d6d43e59..18203d52701 100644 --- a/third_party/waf/waflib/Scripting.py +++ b/third_party/waf/waflib/Scripting.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2018 (ita) diff --git a/third_party/waf/waflib/Task.py b/third_party/waf/waflib/Task.py index 89a73258f92..c4642443f55 100644 --- a/third_party/waf/waflib/Task.py +++ b/third_party/waf/waflib/Task.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2018 (ita) @@ -726,6 +722,32 @@ class Task(evil): v = v() # dependency is a function, call it upd(v) + def sig_deep_inputs(self): + """ + Enable rebuilds on input files task signatures. Not used by default. + + Example: hashes of output programs can be unchanged after being re-linked, + despite the libraries being different. This method can thus prevent stale unit test + results (waf_unit_test.py). + + Hashing input file timestamps is another possibility for the implementation. + This may cause unnecessary rebuilds when input tasks are frequently executed. + Here is an implementation example:: + + lst = [] + for node in self.inputs + self.dep_nodes: + st = os.stat(node.abspath()) + lst.append(st.st_mtime) + lst.append(st.st_size) + self.m.update(Utils.h_list(lst)) + + The downside of the implementation is that it absolutely requires all build directory + files to be declared within the current build. + """ + bld = self.generator.bld + lst = [bld.task_sigs[bld.node_sigs[node]] for node in (self.inputs + self.dep_nodes) if node.is_bld()] + self.m.update(Utils.h_list(lst)) + def sig_vars(self): """ Used by :py:meth:`waflib.Task.Task.signature`; it hashes :py:attr:`waflib.Task.Task.env` variables/values @@ -1244,6 +1266,16 @@ def task_factory(name, func=None, vars=None, color='GREEN', ext_in=[], ext_out=[ return cls +def deep_inputs(cls): + """ + Task class decorator to enable rebuilds on input files task signatures + """ + def sig_explicit_deps(self): + Task.sig_explicit_deps(self) + Task.sig_deep_inputs(self) + cls.sig_explicit_deps = sig_explicit_deps + return cls + TaskBase = Task "Provided for compatibility reasons, TaskBase should not be used" diff --git a/third_party/waf/waflib/TaskGen.py b/third_party/waf/waflib/TaskGen.py index 1287058cee2..40007b55ca7 100644 --- a/third_party/waf/waflib/TaskGen.py +++ b/third_party/waf/waflib/TaskGen.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2018 (ita) @@ -571,6 +567,7 @@ def process_rule(self): * stderr: standard error, set to None to prevent waf from capturing the text * timeout: timeout for command execution (Python 3) * always: whether to always run the command (False by default) + * deep_inputs: whether the task must depend on the input file tasks too (False by default) """ if not getattr(self, 'rule', None): return @@ -592,12 +589,13 @@ def process_rule(self): cls_str = getattr(self, 'cls_str', None) cls_keyword = getattr(self, 'cls_keyword', None) use_cache = getattr(self, 'cache_rule', 'True') + deep_inputs = getattr(self, 'deep_inputs', False) scan_val = has_deps = hasattr(self, 'deps') if scan: scan_val = id(scan) - key = Utils.h_list((name, self.rule, chmod, shell, color, cls_str, cls_keyword, scan_val, _vars)) + key = Utils.h_list((name, self.rule, chmod, shell, color, cls_str, cls_keyword, scan_val, _vars, deep_inputs)) cls = None if use_cache: @@ -626,6 +624,9 @@ def process_rule(self): if cls_keyword: setattr(cls, 'keyword', self.cls_keyword) + if deep_inputs: + Task.deep_inputs(cls) + if scan: cls.scan = self.scan elif has_deps: diff --git a/third_party/waf/waflib/Tools/__init__.py b/third_party/waf/waflib/Tools/__init__.py index 94cf66f799b..079df358f58 100644 --- a/third_party/waf/waflib/Tools/__init__.py +++ b/third_party/waf/waflib/Tools/__init__.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2018 (ita) diff --git a/third_party/waf/waflib/Tools/ar.py b/third_party/waf/waflib/Tools/ar.py index bf5220d41c0..b39b645926b 100644 --- a/third_party/waf/waflib/Tools/ar.py +++ b/third_party/waf/waflib/Tools/ar.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2018 (ita) diff --git a/third_party/waf/waflib/Tools/asm.py b/third_party/waf/waflib/Tools/asm.py index 46fa614d9d3..b6f26fb3df3 100644 --- a/third_party/waf/waflib/Tools/asm.py +++ b/third_party/waf/waflib/Tools/asm.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2008-2018 (ita) diff --git a/third_party/waf/waflib/Tools/bison.py b/third_party/waf/waflib/Tools/bison.py index 771d39e7abf..eef56dcdd74 100644 --- a/third_party/waf/waflib/Tools/bison.py +++ b/third_party/waf/waflib/Tools/bison.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # John O'Meara, 2006 diff --git a/third_party/waf/waflib/Tools/c.py b/third_party/waf/waflib/Tools/c.py index 0b998a3b0ee..effd6b6ee8e 100644 --- a/third_party/waf/waflib/Tools/c.py +++ b/third_party/waf/waflib/Tools/c.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2018 (ita) diff --git a/third_party/waf/waflib/Tools/c_aliases.py b/third_party/waf/waflib/Tools/c_aliases.py index d9c050b46f8..c9d53692e8f 100644 --- a/third_party/waf/waflib/Tools/c_aliases.py +++ b/third_party/waf/waflib/Tools/c_aliases.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2015 (ita) diff --git a/third_party/waf/waflib/Tools/c_config.py b/third_party/waf/waflib/Tools/c_config.py index db8197db14b..76082152cd9 100644 --- a/third_party/waf/waflib/Tools/c_config.py +++ b/third_party/waf/waflib/Tools/c_config.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2018 (ita) diff --git a/third_party/waf/waflib/Tools/c_osx.py b/third_party/waf/waflib/Tools/c_osx.py index bafcda19684..f70b128b874 100644 --- a/third_party/waf/waflib/Tools/c_osx.py +++ b/third_party/waf/waflib/Tools/c_osx.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy 2008-2018 (ita) diff --git a/third_party/waf/waflib/Tools/c_preproc.py b/third_party/waf/waflib/Tools/c_preproc.py index 1a8b9137644..c2c239baa26 100644 --- a/third_party/waf/waflib/Tools/c_preproc.py +++ b/third_party/waf/waflib/Tools/c_preproc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2018 (ita) diff --git a/third_party/waf/waflib/Tools/c_tests.py b/third_party/waf/waflib/Tools/c_tests.py index c3620192498..f858df5763c 100644 --- a/third_party/waf/waflib/Tools/c_tests.py +++ b/third_party/waf/waflib/Tools/c_tests.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2016-2018 (ita) diff --git a/third_party/waf/waflib/Tools/ccroot.py b/third_party/waf/waflib/Tools/ccroot.py index 6a425fd8f4d..394f36b8e12 100644 --- a/third_party/waf/waflib/Tools/ccroot.py +++ b/third_party/waf/waflib/Tools/ccroot.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2018 (ita) @@ -517,11 +513,11 @@ def apply_implib(self): node = self.path.find_resource(self.defs) if not node: raise Errors.WafError('invalid def file %r' % self.defs) - if 'msvc' in (self.env.CC_NAME, self.env.CXX_NAME): - self.env.append_value('LINKFLAGS', '/def:%s' % node.path_from(self.get_cwd())) + if self.env.def_PATTERN: + self.env.append_value('LINKFLAGS', self.env.def_PATTERN % node.path_from(self.get_cwd())) self.link_task.dep_nodes.append(node) else: - #gcc for windows takes *.def file a an input without any special flag + # gcc for windows takes *.def file as input without any special flag self.link_task.inputs.append(node) # where to put the import library diff --git a/third_party/waf/waflib/Tools/clang.py b/third_party/waf/waflib/Tools/clang.py index 882b68ab0f5..3828e391188 100644 --- a/third_party/waf/waflib/Tools/clang.py +++ b/third_party/waf/waflib/Tools/clang.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Krzysztof Kosiński 2014 diff --git a/third_party/waf/waflib/Tools/clangxx.py b/third_party/waf/waflib/Tools/clangxx.py index cec3311e41c..152013ce7a1 100644 --- a/third_party/waf/waflib/Tools/clangxx.py +++ b/third_party/waf/waflib/Tools/clangxx.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy 2009-2018 (ita) diff --git a/third_party/waf/waflib/Tools/compiler_c.py b/third_party/waf/waflib/Tools/compiler_c.py index 2bc55bf518f..2dba3f82704 100644 --- a/third_party/waf/waflib/Tools/compiler_c.py +++ b/third_party/waf/waflib/Tools/compiler_c.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Matthias Jahn jahn dôt matthias ât freenet dôt de, 2007 (pmarat) diff --git a/third_party/waf/waflib/Tools/compiler_cxx.py b/third_party/waf/waflib/Tools/compiler_cxx.py index fb5b874d679..1af65a226dc 100644 --- a/third_party/waf/waflib/Tools/compiler_cxx.py +++ b/third_party/waf/waflib/Tools/compiler_cxx.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Matthias Jahn jahn dôt matthias ât freenet dôt de 2007 (pmarat) diff --git a/third_party/waf/waflib/Tools/compiler_d.py b/third_party/waf/waflib/Tools/compiler_d.py index 6146d7b2cae..43bb1f646ab 100644 --- a/third_party/waf/waflib/Tools/compiler_d.py +++ b/third_party/waf/waflib/Tools/compiler_d.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Carlos Rafael Giani, 2007 (dv) diff --git a/third_party/waf/waflib/Tools/compiler_fc.py b/third_party/waf/waflib/Tools/compiler_fc.py index 0def0180444..96b58e706f6 100644 --- a/third_party/waf/waflib/Tools/compiler_fc.py +++ b/third_party/waf/waflib/Tools/compiler_fc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 diff --git a/third_party/waf/waflib/Tools/cs.py b/third_party/waf/waflib/Tools/cs.py index b23b77f91f2..aecca6da13d 100644 --- a/third_party/waf/waflib/Tools/cs.py +++ b/third_party/waf/waflib/Tools/cs.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2018 (ita) diff --git a/third_party/waf/waflib/Tools/cxx.py b/third_party/waf/waflib/Tools/cxx.py index e6964e9cdeb..194fad7437d 100644 --- a/third_party/waf/waflib/Tools/cxx.py +++ b/third_party/waf/waflib/Tools/cxx.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2018 (ita) diff --git a/third_party/waf/waflib/Tools/d.py b/third_party/waf/waflib/Tools/d.py index f4337146e0b..e4cf73bb4af 100644 --- a/third_party/waf/waflib/Tools/d.py +++ b/third_party/waf/waflib/Tools/d.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Carlos Rafael Giani, 2007 (dv) diff --git a/third_party/waf/waflib/Tools/d_config.py b/third_party/waf/waflib/Tools/d_config.py index 207f3c75b71..66375565245 100644 --- a/third_party/waf/waflib/Tools/d_config.py +++ b/third_party/waf/waflib/Tools/d_config.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2016-2018 (ita) diff --git a/third_party/waf/waflib/Tools/d_scan.py b/third_party/waf/waflib/Tools/d_scan.py index 4b9b148d381..14c6c313e9a 100644 --- a/third_party/waf/waflib/Tools/d_scan.py +++ b/third_party/waf/waflib/Tools/d_scan.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2016-2018 (ita) diff --git a/third_party/waf/waflib/Tools/dbus.py b/third_party/waf/waflib/Tools/dbus.py index 801ad1fa5c6..d520f1c0f2d 100644 --- a/third_party/waf/waflib/Tools/dbus.py +++ b/third_party/waf/waflib/Tools/dbus.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Ali Sabil, 2007 @@ -44,7 +40,7 @@ def add_dbus_file(self, filename, prefix, mode): self.meths.append('process_dbus') self.dbus_lst.append([filename, prefix, mode]) -@before_method('apply_core') +@before_method('process_source') def process_dbus(self): """ Processes the dbus files stored in the attribute *dbus_lst* to create :py:class:`waflib.Tools.dbus.dbus_binding_tool` instances. diff --git a/third_party/waf/waflib/Tools/dmd.py b/third_party/waf/waflib/Tools/dmd.py index 07d7d59cf2c..8917ca1b3f9 100644 --- a/third_party/waf/waflib/Tools/dmd.py +++ b/third_party/waf/waflib/Tools/dmd.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Carlos Rafael Giani, 2007 (dv) diff --git a/third_party/waf/waflib/Tools/errcheck.py b/third_party/waf/waflib/Tools/errcheck.py index e50fe607761..de8d75a42bd 100644 --- a/third_party/waf/waflib/Tools/errcheck.py +++ b/third_party/waf/waflib/Tools/errcheck.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2011 (ita) diff --git a/third_party/waf/waflib/Tools/fc.py b/third_party/waf/waflib/Tools/fc.py index 92bb2eb60a6..621eb5029df 100644 --- a/third_party/waf/waflib/Tools/fc.py +++ b/third_party/waf/waflib/Tools/fc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # DC 2008 diff --git a/third_party/waf/waflib/Tools/fc_config.py b/third_party/waf/waflib/Tools/fc_config.py index 69928abc940..0df460b5d1e 100644 --- a/third_party/waf/waflib/Tools/fc_config.py +++ b/third_party/waf/waflib/Tools/fc_config.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # DC 2008 diff --git a/third_party/waf/waflib/Tools/fc_scan.py b/third_party/waf/waflib/Tools/fc_scan.py index e8c6eda9624..12cb0fc041e 100644 --- a/third_party/waf/waflib/Tools/fc_scan.py +++ b/third_party/waf/waflib/Tools/fc_scan.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # DC 2008 diff --git a/third_party/waf/waflib/Tools/flex.py b/third_party/waf/waflib/Tools/flex.py index 11191af3447..2256657b6a9 100644 --- a/third_party/waf/waflib/Tools/flex.py +++ b/third_party/waf/waflib/Tools/flex.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # John O'Meara, 2006 diff --git a/third_party/waf/waflib/Tools/g95.py b/third_party/waf/waflib/Tools/g95.py index 95db89bbb04..f69ba4f3678 100644 --- a/third_party/waf/waflib/Tools/g95.py +++ b/third_party/waf/waflib/Tools/g95.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # KWS 2010 diff --git a/third_party/waf/waflib/Tools/gas.py b/third_party/waf/waflib/Tools/gas.py index c3862b82714..77afed7038f 100644 --- a/third_party/waf/waflib/Tools/gas.py +++ b/third_party/waf/waflib/Tools/gas.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2008-2018 (ita) diff --git a/third_party/waf/waflib/Tools/gcc.py b/third_party/waf/waflib/Tools/gcc.py index 60183ceeae0..acdd473ada5 100644 --- a/third_party/waf/waflib/Tools/gcc.py +++ b/third_party/waf/waflib/Tools/gcc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2018 (ita) diff --git a/third_party/waf/waflib/Tools/gdc.py b/third_party/waf/waflib/Tools/gdc.py index 8d378c512c8..d89a66d3066 100644 --- a/third_party/waf/waflib/Tools/gdc.py +++ b/third_party/waf/waflib/Tools/gdc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Carlos Rafael Giani, 2007 (dv) diff --git a/third_party/waf/waflib/Tools/gfortran.py b/third_party/waf/waflib/Tools/gfortran.py index 12cff7106d2..1050667315d 100644 --- a/third_party/waf/waflib/Tools/gfortran.py +++ b/third_party/waf/waflib/Tools/gfortran.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # DC 2008 diff --git a/third_party/waf/waflib/Tools/glib2.py b/third_party/waf/waflib/Tools/glib2.py index 6891ac8cadb..949fe37c3b6 100644 --- a/third_party/waf/waflib/Tools/glib2.py +++ b/third_party/waf/waflib/Tools/glib2.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2018 (ita) diff --git a/third_party/waf/waflib/Tools/gnu_dirs.py b/third_party/waf/waflib/Tools/gnu_dirs.py index b9735b8cf38..2847071d173 100644 --- a/third_party/waf/waflib/Tools/gnu_dirs.py +++ b/third_party/waf/waflib/Tools/gnu_dirs.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Ali Sabil, 2007 diff --git a/third_party/waf/waflib/Tools/gxx.py b/third_party/waf/waflib/Tools/gxx.py index 69c7aa2172a..22c5d26f2a4 100644 --- a/third_party/waf/waflib/Tools/gxx.py +++ b/third_party/waf/waflib/Tools/gxx.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2018 (ita) diff --git a/third_party/waf/waflib/Tools/icc.py b/third_party/waf/waflib/Tools/icc.py index eede6035143..b6492c8e1a0 100644 --- a/third_party/waf/waflib/Tools/icc.py +++ b/third_party/waf/waflib/Tools/icc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Stian Selnes 2008 diff --git a/third_party/waf/waflib/Tools/icpc.py b/third_party/waf/waflib/Tools/icpc.py index 226e8292379..8a6cc6c40f9 100644 --- a/third_party/waf/waflib/Tools/icpc.py +++ b/third_party/waf/waflib/Tools/icpc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy 2009-2018 (ita) diff --git a/third_party/waf/waflib/Tools/ifort.py b/third_party/waf/waflib/Tools/ifort.py index 3d0f83f0732..74934f3f661 100644 --- a/third_party/waf/waflib/Tools/ifort.py +++ b/third_party/waf/waflib/Tools/ifort.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # DC 2008 diff --git a/third_party/waf/waflib/Tools/intltool.py b/third_party/waf/waflib/Tools/intltool.py index 960c3963cb7..af95ba80eda 100644 --- a/third_party/waf/waflib/Tools/intltool.py +++ b/third_party/waf/waflib/Tools/intltool.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2018 (ita) diff --git a/third_party/waf/waflib/Tools/irixcc.py b/third_party/waf/waflib/Tools/irixcc.py index ed5c49ff6e0..c3ae1ac915c 100644 --- a/third_party/waf/waflib/Tools/irixcc.py +++ b/third_party/waf/waflib/Tools/irixcc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # imported from samba diff --git a/third_party/waf/waflib/Tools/javaw.py b/third_party/waf/waflib/Tools/javaw.py index 3a2f3a7af58..f6fd20cc689 100644 --- a/third_party/waf/waflib/Tools/javaw.py +++ b/third_party/waf/waflib/Tools/javaw.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2018 (ita) diff --git a/third_party/waf/waflib/Tools/ldc2.py b/third_party/waf/waflib/Tools/ldc2.py index 3d719de781c..a51c344b95d 100644 --- a/third_party/waf/waflib/Tools/ldc2.py +++ b/third_party/waf/waflib/Tools/ldc2.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Alex Rønne Petersen, 2012 (alexrp/Zor) diff --git a/third_party/waf/waflib/Tools/lua.py b/third_party/waf/waflib/Tools/lua.py index 9c6a234447a..15a333a995b 100644 --- a/third_party/waf/waflib/Tools/lua.py +++ b/third_party/waf/waflib/Tools/lua.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Sebastian Schlingmann, 2008 diff --git a/third_party/waf/waflib/Tools/md5_tstamp.py b/third_party/waf/waflib/Tools/md5_tstamp.py index f17b1223f4e..6428e46024e 100644 --- a/third_party/waf/waflib/Tools/md5_tstamp.py +++ b/third_party/waf/waflib/Tools/md5_tstamp.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 diff --git a/third_party/waf/waflib/Tools/msvc.py b/third_party/waf/waflib/Tools/msvc.py index 9ee7eadcdbe..17b347d4583 100644 --- a/third_party/waf/waflib/Tools/msvc.py +++ b/third_party/waf/waflib/Tools/msvc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Carlos Rafael Giani, 2006 (dv) @@ -12,6 +8,12 @@ """ Microsoft Visual C++/Intel C++ compiler support +If you get detection problems, first try any of the following:: + + chcp 65001 + set PYTHONIOENCODING=... + set PYTHONLEGACYWINDOWSSTDIO=1 + Usage:: $ waf configure --msvc_version="msvc 10.0,msvc 9.0" --msvc_target="x64" @@ -461,10 +463,8 @@ def gather_vswhere_versions(conf, versions): return if sys.version_info[0] < 3: - try: - txt = txt.decode(sys.stdout.encoding or 'cp1252') - except UnicodeError: - txt = txt.decode('utf-8', 'replace') + txt = txt.decode(Utils.console_encoding()) + arr = json.loads(txt) arr.sort(key=lambda x: x['installationVersion']) for entry in arr: @@ -940,6 +940,8 @@ def msvc_common_flags(conf): v.cprogram_PATTERN = v.cxxprogram_PATTERN = '%s.exe' + v.def_PATTERN = '/def:%s' + ####################################################################################################### ##### conf above, build below diff --git a/third_party/waf/waflib/Tools/nasm.py b/third_party/waf/waflib/Tools/nasm.py index eedba82a8df..411d5826b5d 100644 --- a/third_party/waf/waflib/Tools/nasm.py +++ b/third_party/waf/waflib/Tools/nasm.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2008-2018 (ita) diff --git a/third_party/waf/waflib/Tools/nobuild.py b/third_party/waf/waflib/Tools/nobuild.py index 705c3dd0b0a..2e4b055ec7f 100644 --- a/third_party/waf/waflib/Tools/nobuild.py +++ b/third_party/waf/waflib/Tools/nobuild.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2015 (ita) diff --git a/third_party/waf/waflib/Tools/perl.py b/third_party/waf/waflib/Tools/perl.py index 375346ddfdf..32b03fbaa71 100644 --- a/third_party/waf/waflib/Tools/perl.py +++ b/third_party/waf/waflib/Tools/perl.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # andersg at 0x63.nu 2007 diff --git a/third_party/waf/waflib/Tools/python.py b/third_party/waf/waflib/Tools/python.py index 10e407387d3..25841d03cf8 100644 --- a/third_party/waf/waflib/Tools/python.py +++ b/third_party/waf/waflib/Tools/python.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2007-2015 (ita) @@ -450,9 +446,9 @@ def check_python_version(conf, minver=None): Check if the python interpreter is found matching a given minimum version. minver should be a tuple, eg. to check for python >= 2.4.2 pass (2,4,2) as minver. - If successful, PYTHON_VERSION is defined as 'MAJOR.MINOR' - (eg. '2.4') of the actual python version found, and PYTHONDIR is - defined, pointing to the site-packages directory appropriate for + If successful, PYTHON_VERSION is defined as 'MAJOR.MINOR' (eg. '2.4') + of the actual python version found, and PYTHONDIR and PYTHONARCHDIR + are defined, pointing to the site-packages directories appropriate for this python version, where modules/packages/extensions should be installed. diff --git a/third_party/waf/waflib/Tools/qt5.py b/third_party/waf/waflib/Tools/qt5.py index f4842a9ac55..709dd5161e3 100644 --- a/third_party/waf/waflib/Tools/qt5.py +++ b/third_party/waf/waflib/Tools/qt5.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2018 (ita) @@ -399,6 +395,19 @@ class rcc(Task.Task): names.append(x) return (nodes, names) + def quote_flag(self, x): + """ + Override Task.quote_flag. QT parses the argument files + differently than cl.exe and link.exe + + :param x: flag + :type x: string + :return: quoted flag + :rtype: string + """ + return x + + class moc(Task.Task): """ Creates ``.moc`` files @@ -406,6 +415,19 @@ class moc(Task.Task): color = 'BLUE' run_str = '${QT_MOC} ${MOC_FLAGS} ${MOCCPPPATH_ST:INCPATHS} ${MOCDEFINES_ST:DEFINES} ${SRC} ${MOC_ST} ${TGT}' + def quote_flag(self, x): + """ + Override Task.quote_flag. QT parses the argument files + differently than cl.exe and link.exe + + :param x: flag + :type x: string + :return: quoted flag + :rtype: string + """ + return x + + class ui5(Task.Task): """ Processes ``.ui`` files @@ -629,7 +651,6 @@ def find_single_qt5_lib(self, name, uselib, qtlibs, qtincludes, force_static): for k in ('', '5') if Utils.is_win32 else ['']: for p in ('lib', ''): yield (p, name, k, x) - raise StopIteration for tup in lib_names(): k = ''.join(tup) diff --git a/third_party/waf/waflib/Tools/ruby.py b/third_party/waf/waflib/Tools/ruby.py index f5107aaa141..8d92a79a161 100644 --- a/third_party/waf/waflib/Tools/ruby.py +++ b/third_party/waf/waflib/Tools/ruby.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # daniel.svensson at purplescout.se 2008 diff --git a/third_party/waf/waflib/Tools/suncc.py b/third_party/waf/waflib/Tools/suncc.py index 5a3318368aa..33d34fc9ea8 100644 --- a/third_party/waf/waflib/Tools/suncc.py +++ b/third_party/waf/waflib/Tools/suncc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2018 (ita) diff --git a/third_party/waf/waflib/Tools/suncxx.py b/third_party/waf/waflib/Tools/suncxx.py index 5b00407edec..3b384f6f99d 100644 --- a/third_party/waf/waflib/Tools/suncxx.py +++ b/third_party/waf/waflib/Tools/suncxx.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2018 (ita) diff --git a/third_party/waf/waflib/Tools/tex.py b/third_party/waf/waflib/Tools/tex.py index 0d72333889c..eaf9fdb5802 100644 --- a/third_party/waf/waflib/Tools/tex.py +++ b/third_party/waf/waflib/Tools/tex.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2018 (ita) diff --git a/third_party/waf/waflib/Tools/vala.py b/third_party/waf/waflib/Tools/vala.py index 699a80082c5..822ec502e0f 100644 --- a/third_party/waf/waflib/Tools/vala.py +++ b/third_party/waf/waflib/Tools/vala.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Ali Sabil, 2007 diff --git a/third_party/waf/waflib/Tools/waf_unit_test.py b/third_party/waf/waflib/Tools/waf_unit_test.py index b1db1704c9c..a71ed1c0909 100644 --- a/third_party/waf/waflib/Tools/waf_unit_test.py +++ b/third_party/waf/waflib/Tools/waf_unit_test.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Carlos Rafael Giani, 2006 @@ -156,6 +152,7 @@ def add_test_results(self, tup): except AttributeError: self.bld.utest_results = [tup] +@Task.deep_inputs class utest(Task.Task): """ Execute a unit test @@ -235,11 +232,6 @@ class utest(Task.Task): def get_cwd(self): return getattr(self.generator, 'ut_cwd', self.inputs[0].parent) - def sig_explicit_deps(self): - lst = [os.stat(node.abspath()).st_mtime for node in self.inputs] - self.m.update(str(lst)) - return super(utest, self).sig_explicit_deps() - def summary(bld): """ Display an execution summary:: diff --git a/third_party/waf/waflib/Tools/winres.py b/third_party/waf/waflib/Tools/winres.py index 23fa27e54e0..586c596cf93 100644 --- a/third_party/waf/waflib/Tools/winres.py +++ b/third_party/waf/waflib/Tools/winres.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Brant Young, 2007 diff --git a/third_party/waf/waflib/Tools/xlc.py b/third_party/waf/waflib/Tools/xlc.py index 6dfb4b04486..134dd4152d2 100644 --- a/third_party/waf/waflib/Tools/xlc.py +++ b/third_party/waf/waflib/Tools/xlc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2018 (ita) diff --git a/third_party/waf/waflib/Tools/xlcxx.py b/third_party/waf/waflib/Tools/xlcxx.py index a67ef502ba9..76aa59bc91c 100644 --- a/third_party/waf/waflib/Tools/xlcxx.py +++ b/third_party/waf/waflib/Tools/xlcxx.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2018 (ita) diff --git a/third_party/waf/waflib/Utils.py b/third_party/waf/waflib/Utils.py index 0c9158385b4..b4665c4dc2b 100644 --- a/third_party/waf/waflib/Utils.py +++ b/third_party/waf/waflib/Utils.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2018 (ita) @@ -204,6 +200,8 @@ class lazy_generator(object): it = self.it = self.fun(*self.params) return next(it) + next = __next__ + is_win32 = os.sep == '\\' or sys.platform == 'win32' # msys2 """ Whether this system is a Windows series @@ -436,6 +434,21 @@ def to_list(val): else: return val +def console_encoding(): + try: + import ctypes + except ImportError: + pass + else: + try: + codepage = ctypes.windll.kernel32.GetConsoleCP() + except AttributeError: + pass + else: + if codepage: + return 'cp%d' % codepage + return sys.stdout.encoding or ('cp1252' if is_win32 else 'latin-1') + def split_path_unix(path): return path.split('/') diff --git a/third_party/waf/waflib/__init__.py b/third_party/waf/waflib/__init__.py index 94cf66f799b..079df358f58 100644 --- a/third_party/waf/waflib/__init__.py +++ b/third_party/waf/waflib/__init__.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2018 (ita) diff --git a/third_party/waf/waflib/ansiterm.py b/third_party/waf/waflib/ansiterm.py index 8da47263121..0d20c6374b7 100644 --- a/third_party/waf/waflib/ansiterm.py +++ b/third_party/waf/waflib/ansiterm.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 diff --git a/third_party/waf/waflib/extras/__init__.py b/third_party/waf/waflib/extras/__init__.py index 3dfaabd1371..c8a3c349288 100644 --- a/third_party/waf/waflib/extras/__init__.py +++ b/third_party/waf/waflib/extras/__init__.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2010 (ita) diff --git a/third_party/waf/waflib/extras/batched_cc.py b/third_party/waf/waflib/extras/batched_cc.py index 935df6cf162..aad28722983 100644 --- a/third_party/waf/waflib/extras/batched_cc.py +++ b/third_party/waf/waflib/extras/batched_cc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2015 (ita) diff --git a/third_party/waf/waflib/extras/biber.py b/third_party/waf/waflib/extras/biber.py index b4bb72267e8..fd9db4e04ea 100644 --- a/third_party/waf/waflib/extras/biber.py +++ b/third_party/waf/waflib/extras/biber.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2011 (ita) diff --git a/third_party/waf/waflib/extras/bjam.py b/third_party/waf/waflib/extras/bjam.py index b8effa543b7..8e04d3a66fc 100644 --- a/third_party/waf/waflib/extras/bjam.py +++ b/third_party/waf/waflib/extras/bjam.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # per rosengren 2011 diff --git a/third_party/waf/waflib/extras/blender.py b/third_party/waf/waflib/extras/blender.py index 2556415a0c8..e5efc280cf8 100644 --- a/third_party/waf/waflib/extras/blender.py +++ b/third_party/waf/waflib/extras/blender.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Michal Proszek, 2014 (poxip) diff --git a/third_party/waf/waflib/extras/boo.py b/third_party/waf/waflib/extras/boo.py index 93bff04c538..06623d40fd4 100644 --- a/third_party/waf/waflib/extras/boo.py +++ b/third_party/waf/waflib/extras/boo.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Yannick LM 2011 diff --git a/third_party/waf/waflib/extras/boost.py b/third_party/waf/waflib/extras/boost.py index 2fe99a40674..c2aaaa938a2 100644 --- a/third_party/waf/waflib/extras/boost.py +++ b/third_party/waf/waflib/extras/boost.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # @@ -58,8 +54,7 @@ from waflib import Utils, Logs, Errors from waflib.Configure import conf from waflib.TaskGen import feature, after_method -BOOST_LIBS = ['/usr/lib/x86_64-linux-gnu', '/usr/lib/i386-linux-gnu', - '/usr/lib', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib'] +BOOST_LIBS = ['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib'] BOOST_INCLUDES = ['/usr/include', '/usr/local/include', '/opt/local/include', '/sw/include'] BOOST_VERSION_FILE = 'boost/version.hpp' BOOST_VERSION_CODE = ''' @@ -73,6 +68,21 @@ BOOST_ERROR_CODE = ''' int main() { boost::system::error_code c; } ''' +PTHREAD_CODE = ''' +#include +static void* f(void*) { return 0; } +int main() { + pthread_t th; + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_create(&th, &attr, &f, 0); + pthread_join(th, 0); + pthread_cleanup_push(0, 0); + pthread_cleanup_pop(0); + pthread_attr_destroy(&attr); +} +''' + BOOST_THREAD_CODE = ''' #include int main() { boost::thread t; } @@ -309,6 +319,66 @@ def boost_get_libs(self, *k, **kw): return path.abspath(), match_libs(kw.get('lib'), False), match_libs(kw.get('stlib'), True) +@conf +def _check_pthread_flag(self, *k, **kw): + ''' + Computes which flags should be added to CXXFLAGS and LINKFLAGS to compile in multi-threading mode + + Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3, + boost/thread.hpp will trigger a #error if -pthread isn't used: + boost/config/requires_threads.hpp:47:5: #error "Compiler threading support + is not turned on. Please set the correct command line options for + threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)" + + Based on _BOOST_PTHREAD_FLAG(): https://github.com/tsuna/boost.m4/blob/master/build-aux/boost.m4 + ''' + + var = kw.get('uselib_store', 'BOOST') + + self.start_msg('Checking the flags needed to use pthreads') + + # The ordering *is* (sometimes) important. Some notes on the + # individual items follow: + # (none): in case threads are in libc; should be tried before -Kthread and + # other compiler flags to prevent continual compiler warnings + # -lpthreads: AIX (must check this before -lpthread) + # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) + # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) + # -llthread: LinuxThreads port on FreeBSD (also preferred to -pthread) + # -pthread: GNU Linux/GCC (kernel threads), BSD/GCC (userland threads) + # -pthreads: Solaris/GCC + # -mthreads: MinGW32/GCC, Lynx/GCC + # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it + # doesn't hurt to check since this sometimes defines pthreads too; + # also defines -D_REENTRANT) + # ... -mt is also the pthreads flag for HP/aCC + # -lpthread: GNU Linux, etc. + # --thread-safe: KAI C++ + if Utils.unversioned_sys_platform() == "sunos": + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthreads/-mt/ + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + boost_pthread_flags = ["-pthreads", "-lpthread", "-mt", "-pthread"] + else: + boost_pthread_flags = ["", "-lpthreads", "-Kthread", "-kthread", "-llthread", "-pthread", + "-pthreads", "-mthreads", "-lpthread", "--thread-safe", "-mt"] + + for boost_pthread_flag in boost_pthread_flags: + try: + self.env.stash() + self.env.append_value('CXXFLAGS_%s' % var, boost_pthread_flag) + self.env.append_value('LINKFLAGS_%s' % var, boost_pthread_flag) + self.check_cxx(code=PTHREAD_CODE, msg=None, use=var, execute=False) + + self.end_msg(boost_pthread_flag) + return + except self.errors.ConfigurationError: + self.env.revert() + self.end_msg('None') @conf def check_boost(self, *k, **kw): @@ -333,6 +403,11 @@ def check_boost(self, *k, **kw): var = kw.get('uselib_store', 'BOOST') + self.find_program('dpkg-architecture', var='DPKG_ARCHITECTURE', mandatory=False) + if self.env.DPKG_ARCHITECTURE: + deb_host_multiarch = self.cmd_and_log([self.env.DPKG_ARCHITECTURE[0], '-qDEB_HOST_MULTIARCH']) + BOOST_LIBS.insert(0, '/usr/lib/%s' % deb_host_multiarch.strip()) + self.start_msg('Checking boost includes') self.env['INCLUDES_%s' % var] = inc = self.boost_get_includes(**params) versions = self.boost_get_version(inc) @@ -360,32 +435,26 @@ def check_boost(self, *k, **kw): Logs.pprint('CYAN', ' shared libs : %s' % libs) Logs.pprint('CYAN', ' static libs : %s' % stlibs) + def has_shlib(lib): + return params['lib'] and lib in params['lib'] + def has_stlib(lib): + return params['stlib'] and lib in params['stlib'] + def has_lib(lib): + return has_shlib(lib) or has_stlib(lib) + if has_lib('thread'): + # not inside try_link to make check visible in the output + self._check_pthread_flag(k, kw) def try_link(): - if (params['lib'] and 'system' in params['lib']) or \ - params['stlib'] and 'system' in params['stlib']: + if has_lib('system'): self.check_cxx(fragment=BOOST_ERROR_CODE, use=var, execute=False) - if (params['lib'] and 'thread' in params['lib']) or \ - params['stlib'] and 'thread' in params['stlib']: + if has_lib('thread'): self.check_cxx(fragment=BOOST_THREAD_CODE, use=var, execute=False) - - def is_log_mt(): - '''Check if found boost_log library is multithread-safe''' - for lib in libs: - if lib.startswith('boost_log'): - lib_log = lib - break - return '-mt' in lib_log - - if params['lib'] and 'log' in params['lib']: - self.env['DEFINES_%s' % var] += ['BOOST_LOG_DYN_LINK'] - if not is_log_mt(): - self.env['DEFINES_%s' % var] += ['BOOST_LOG_NO_THREADS'] - self.check_cxx(fragment=BOOST_LOG_CODE, use=var, execute=False) - if params['stlib'] and 'log' in params['stlib']: - # Static linking is assumed by default - if not is_log_mt(): + if has_lib('log'): + if not has_lib('thread'): self.env['DEFINES_%s' % var] += ['BOOST_LOG_NO_THREADS'] + if has_shlib('log'): + self.env['DEFINES_%s' % var] += ['BOOST_LOG_DYN_LINK'] self.check_cxx(fragment=BOOST_LOG_CODE, use=var, execute=False) if params.get('linkage_autodetect', False): diff --git a/third_party/waf/waflib/extras/build_file_tracker.py b/third_party/waf/waflib/extras/build_file_tracker.py index 28b00e538a3..c4f26fd070d 100644 --- a/third_party/waf/waflib/extras/build_file_tracker.py +++ b/third_party/waf/waflib/extras/build_file_tracker.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2015 diff --git a/third_party/waf/waflib/extras/build_logs.py b/third_party/waf/waflib/extras/build_logs.py index 87a4e2c3b4a..cdf8ed097e9 100644 --- a/third_party/waf/waflib/extras/build_logs.py +++ b/third_party/waf/waflib/extras/build_logs.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2013 (ita) diff --git a/third_party/waf/waflib/extras/buildcopy.py b/third_party/waf/waflib/extras/buildcopy.py index 10625d1e26f..a6d9ac83114 100644 --- a/third_party/waf/waflib/extras/buildcopy.py +++ b/third_party/waf/waflib/extras/buildcopy.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Calle Rosenquist, 2017 (xbreak) diff --git a/third_party/waf/waflib/extras/c_bgxlc.py b/third_party/waf/waflib/extras/c_bgxlc.py index 04a3c79cff0..6e3eaf7bb64 100644 --- a/third_party/waf/waflib/extras/c_bgxlc.py +++ b/third_party/waf/waflib/extras/c_bgxlc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # harald at klimachs.de diff --git a/third_party/waf/waflib/extras/c_dumbpreproc.py b/third_party/waf/waflib/extras/c_dumbpreproc.py index 407bcf5a893..ce9e1a400b9 100644 --- a/third_party/waf/waflib/extras/c_dumbpreproc.py +++ b/third_party/waf/waflib/extras/c_dumbpreproc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2010 (ita) diff --git a/third_party/waf/waflib/extras/c_emscripten.py b/third_party/waf/waflib/extras/c_emscripten.py index b23d770b43b..e1ac494f448 100644 --- a/third_party/waf/waflib/extras/c_emscripten.py +++ b/third_party/waf/waflib/extras/c_emscripten.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # -*- coding: utf-8 vi:ts=4:noexpandtab diff --git a/third_party/waf/waflib/extras/c_nec.py b/third_party/waf/waflib/extras/c_nec.py index 1ca665c1b0d..96bfae4f345 100644 --- a/third_party/waf/waflib/extras/c_nec.py +++ b/third_party/waf/waflib/extras/c_nec.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # harald at klimachs.de diff --git a/third_party/waf/waflib/extras/cabal.py b/third_party/waf/waflib/extras/cabal.py index a26f6342e9e..a5acce77375 100644 --- a/third_party/waf/waflib/extras/cabal.py +++ b/third_party/waf/waflib/extras/cabal.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Anton Feldmann, 2012 diff --git a/third_party/waf/waflib/extras/cfg_altoptions.py b/third_party/waf/waflib/extras/cfg_altoptions.py index d42c5ccfa86..47b1189f476 100644 --- a/third_party/waf/waflib/extras/cfg_altoptions.py +++ b/third_party/waf/waflib/extras/cfg_altoptions.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/python # -*- coding: utf-8 -*- # Tool to extend c_config.check_cfg() diff --git a/third_party/waf/waflib/extras/clang_compilation_database.py b/third_party/waf/waflib/extras/clang_compilation_database.py index 756180f8bb6..4d9b5e275ae 100644 --- a/third_party/waf/waflib/extras/clang_compilation_database.py +++ b/third_party/waf/waflib/extras/clang_compilation_database.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Christoph Koke, 2013 @@ -23,11 +19,6 @@ from waflib import Logs, TaskGen, Task Task.Task.keep_last_cmd = True -if sys.hexversion >= 0x3030000: - quote = shlex.quote -else: - quote = pipes.quote - @TaskGen.feature('c', 'cxx') @TaskGen.after_method('process_use') def collect_compilation_db_tasks(self): @@ -60,10 +51,9 @@ def write_compilation_database(ctx): directory = getattr(task, 'cwd', ctx.variant_dir) f_node = task.inputs[0] filename = os.path.relpath(f_node.abspath(), directory) - cmd = " ".join(map(quote, cmd)) entry = { "directory": directory, - "command": cmd, + "arguments": cmd, "file": filename, } clang_db[filename] = entry @@ -93,4 +83,3 @@ for x in ('c', 'cxx'): setattr(t, 'old_runnable_status', getattr(t, 'runnable_status', None)) setattr(t, 'runnable_status', runnable_status) - diff --git a/third_party/waf/waflib/extras/codelite.py b/third_party/waf/waflib/extras/codelite.py index df5949a763f..fd04a91d94b 100644 --- a/third_party/waf/waflib/extras/codelite.py +++ b/third_party/waf/waflib/extras/codelite.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # CodeLite Project diff --git a/third_party/waf/waflib/extras/color_gcc.py b/third_party/waf/waflib/extras/color_gcc.py index 73b001768c5..b68c5ebf2df 100644 --- a/third_party/waf/waflib/extras/color_gcc.py +++ b/third_party/waf/waflib/extras/color_gcc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 diff --git a/third_party/waf/waflib/extras/color_rvct.py b/third_party/waf/waflib/extras/color_rvct.py index 8138b39d63a..f89ccbdb140 100644 --- a/third_party/waf/waflib/extras/color_rvct.py +++ b/third_party/waf/waflib/extras/color_rvct.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 diff --git a/third_party/waf/waflib/extras/compat15.py b/third_party/waf/waflib/extras/compat15.py index ec6a16493a3..0e74df8506c 100644 --- a/third_party/waf/waflib/extras/compat15.py +++ b/third_party/waf/waflib/extras/compat15.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2010 (ita) diff --git a/third_party/waf/waflib/extras/cppcheck.py b/third_party/waf/waflib/extras/cppcheck.py index 4a4e59da5f4..43dc544df73 100644 --- a/third_party/waf/waflib/extras/cppcheck.py +++ b/third_party/waf/waflib/extras/cppcheck.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # -*- encoding: utf-8 -*- # Michel Mooij, michel.mooij7@gmail.com diff --git a/third_party/waf/waflib/extras/cpplint.py b/third_party/waf/waflib/extras/cpplint.py index eba979b5328..fc914c2450b 100644 --- a/third_party/waf/waflib/extras/cpplint.py +++ b/third_party/waf/waflib/extras/cpplint.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # diff --git a/third_party/waf/waflib/extras/cross_gnu.py b/third_party/waf/waflib/extras/cross_gnu.py index b6a4036f58e..309f53b034d 100644 --- a/third_party/waf/waflib/extras/cross_gnu.py +++ b/third_party/waf/waflib/extras/cross_gnu.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/python # -*- coding: utf-8 vi:ts=4:noexpandtab # Tool to provide dedicated variables for cross-compilation diff --git a/third_party/waf/waflib/extras/cython.py b/third_party/waf/waflib/extras/cython.py index 20e94d051d8..2b2c7ccc265 100644 --- a/third_party/waf/waflib/extras/cython.py +++ b/third_party/waf/waflib/extras/cython.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2010-2015 diff --git a/third_party/waf/waflib/extras/dcc.py b/third_party/waf/waflib/extras/dcc.py index d1b85bc56e6..c1a57c04d93 100644 --- a/third_party/waf/waflib/extras/dcc.py +++ b/third_party/waf/waflib/extras/dcc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Jérôme Carretero, 2011 (zougloub) diff --git a/third_party/waf/waflib/extras/distnet.py b/third_party/waf/waflib/extras/distnet.py index a8dd2d2eb42..09a31a6d437 100644 --- a/third_party/waf/waflib/extras/distnet.py +++ b/third_party/waf/waflib/extras/distnet.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 @@ -406,7 +402,6 @@ class package_reader(Context.Context): if x.pkgname == self.myproject: continue yield x - raise StopIteration def execute(self): self.compute_dependencies() diff --git a/third_party/waf/waflib/extras/doxygen.py b/third_party/waf/waflib/extras/doxygen.py index f6e951b8f32..28f56e9c7d7 100644 --- a/third_party/waf/waflib/extras/doxygen.py +++ b/third_party/waf/waflib/extras/doxygen.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: UTF-8 # Thomas Nagy 2008-2010 (ita) @@ -194,13 +190,13 @@ class tar(Task.Task): @feature('doxygen') def process_doxy(self): if not getattr(self, 'doxyfile', None): - self.generator.bld.fatal('no doxyfile??') + self.bld.fatal('no doxyfile variable specified??') node = self.doxyfile if not isinstance(node, Node.Node): node = self.path.find_resource(node) if not node: - raise ValueError('doxygen file not found') + self.bld.fatal('doxygen file %s not found' % self.doxyfile) # the task instance dsk = self.create_task('doxygen', node) diff --git a/third_party/waf/waflib/extras/dpapi.py b/third_party/waf/waflib/extras/dpapi.py index 0e226b1d776..b94d4823581 100644 --- a/third_party/waf/waflib/extras/dpapi.py +++ b/third_party/waf/waflib/extras/dpapi.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Matt Clarkson, 2012 diff --git a/third_party/waf/waflib/extras/eclipse.py b/third_party/waf/waflib/extras/eclipse.py index 9209a2546b6..bb787416e9f 100644 --- a/third_party/waf/waflib/extras/eclipse.py +++ b/third_party/waf/waflib/extras/eclipse.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Eclipse CDT 5.0 generator for Waf @@ -27,6 +23,8 @@ oe_cdt = 'org.eclipse.cdt' cdt_mk = oe_cdt + '.make.core' cdt_core = oe_cdt + '.core' cdt_bld = oe_cdt + '.build.core' +extbuilder_dir = '.externalToolBuilders' +extbuilder_name = 'Waf_Builder.launch' class eclipse(Build.BuildContext): cmd = 'eclipse' @@ -44,6 +42,10 @@ class eclipse(Build.BuildContext): appname = getattr(Context.g_module, Context.APPNAME, os.path.basename(self.srcnode.abspath())) self.create_cproject(appname, pythonpath=self.env['ECLIPSE_PYTHON_PATH']) + # Helper to dump the XML document content to XML with UTF-8 encoding + def write_conf_to_xml(self, filename, document): + self.srcnode.make_node(filename).write(document.toprettyxml(encoding='UTF-8'), flags='wb') + def create_cproject(self, appname, workspace_includes=[], pythonpath=[]): """ Create the Eclipse CDT .project and .cproject files @@ -57,6 +59,7 @@ class eclipse(Build.BuildContext): source_dirs = [] cpppath = self.env['CPPPATH'] javasrcpath = [] + javalibpath = [] includes = STANDARD_INCLUDES if sys.platform != 'win32': cc = self.env.CC or self.env.CXX @@ -79,36 +82,43 @@ class eclipse(Build.BuildContext): if not isinstance(tg, TaskGen.task_gen): continue + tg.post() + # Add local Python modules paths to configuration so object resolving will work in IDE + # This may also contain generated files (ie. pyqt5 or protoc) that get picked from build if 'py' in tg.features: pypath = tg.path.relpath() py_installfrom = getattr(tg, 'install_from', None) - if py_installfrom: - pypath += os.sep + py_installfrom - pythonpath.append(pypath) + if isinstance(py_installfrom, Node.Node): + pypath = py_installfrom.path_from(self.root.make_node(self.top_dir)) + if pypath not in pythonpath: + pythonpath.append(pypath) haspython = True - # Add Java source directories so object resolving works in IDE - if 'java' in tg.features: + # This may also contain generated files (ie. protoc) that get picked from build + if 'javac' in tg.features: java_src = tg.path.relpath() - java_srcdir = getattr(tg, 'srcdir', None) + java_srcdir = getattr(tg.javac_task, 'srcdir', None) if java_srcdir: if isinstance(java_srcdir, Node.Node): java_srcdir = [java_srcdir] for x in Utils.to_list(java_srcdir): - if isinstance(x, Node.Node): - x = x.name - if java_src == '.': - this_src = x - else: - this_src = java_src + os.sep + x - javasrcpath.append(this_src) + x = x.path_from(self.root.make_node(self.top_dir)) + if x not in javasrcpath: + javasrcpath.append(x) else: - javasrcpath.append(java_src) + if java_src not in javasrcpath: + javasrcpath.append(java_src) hasjava = True - tg.post() + # Check if there are external dependencies and add them as external jar so they will be resolved by Eclipse + usedlibs=getattr(tg, 'use', []) + for x in Utils.to_list(usedlibs): + for cl in Utils.to_list(tg.env['CLASSPATH_'+x]): + if cl not in javalibpath: + javalibpath.append(cl) + if not getattr(tg, 'link_task', None): continue @@ -130,23 +140,23 @@ class eclipse(Build.BuildContext): hasc = True - project = self.impl_create_project(sys.executable, appname, hasc, hasjava, haspython) - self.srcnode.make_node('.project').write(project.toprettyxml()) + waf_executable = os.path.abspath(sys.argv[0]) + project = self.impl_create_project(sys.executable, appname, hasc, hasjava, haspython, waf_executable) + self.write_conf_to_xml('.project', project) if hasc: - waf = os.path.abspath(sys.argv[0]) - project = self.impl_create_cproject(sys.executable, waf, appname, workspace_includes, cpppath, source_dirs) - self.srcnode.make_node('.cproject').write(project.toprettyxml()) + project = self.impl_create_cproject(sys.executable, waf_executable, appname, workspace_includes, cpppath, source_dirs) + self.write_conf_to_xml('.cproject', project) if haspython: project = self.impl_create_pydevproject(sys.path, pythonpath) - self.srcnode.make_node('.pydevproject').write(project.toprettyxml()) + self.write_conf_to_xml('.pydevproject', project) if hasjava: - project = self.impl_create_javaproject(javasrcpath) - self.srcnode.make_node('.classpath').write(project.toprettyxml()) + project = self.impl_create_javaproject(javasrcpath, javalibpath) + self.write_conf_to_xml('.classpath', project) - def impl_create_project(self, executable, appname, hasc, hasjava, haspython): + def impl_create_project(self, executable, appname, hasc, hasjava, haspython, waf_executable): doc = Document() projectDescription = doc.createElement('projectDescription') self.add(doc, projectDescription, 'name', appname) @@ -154,16 +164,47 @@ class eclipse(Build.BuildContext): self.add(doc, projectDescription, 'projects') buildSpec = self.add(doc, projectDescription, 'buildSpec') buildCommand = self.add(doc, buildSpec, 'buildCommand') - self.add(doc, buildCommand, 'name', oe_cdt + '.managedbuilder.core.genmakebuilder') self.add(doc, buildCommand, 'triggers', 'clean,full,incremental,') arguments = self.add(doc, buildCommand, 'arguments') - # the default make-style targets are overwritten by the .cproject values - dictionaries = { - cdt_mk + '.contents': cdt_mk + '.activeConfigSettings', - cdt_mk + '.enableAutoBuild': 'false', - cdt_mk + '.enableCleanBuild': 'true', - cdt_mk + '.enableFullBuild': 'true', - } + dictionaries = {} + + # If CDT is present, instruct this one to call waf as it is more flexible (separate build/clean ...) + if hasc: + self.add(doc, buildCommand, 'name', oe_cdt + '.managedbuilder.core.genmakebuilder') + # the default make-style targets are overwritten by the .cproject values + dictionaries = { + cdt_mk + '.contents': cdt_mk + '.activeConfigSettings', + cdt_mk + '.enableAutoBuild': 'false', + cdt_mk + '.enableCleanBuild': 'true', + cdt_mk + '.enableFullBuild': 'true', + } + else: + # Otherwise for Java/Python an external builder tool is created that will call waf build + self.add(doc, buildCommand, 'name', 'org.eclipse.ui.externaltools.ExternalToolBuilder') + dictionaries = { + 'LaunchConfigHandle': '/%s/%s'%(extbuilder_dir, extbuilder_name), + } + # The definition is in a separate directory XML file + try: + os.mkdir(extbuilder_dir) + except OSError: + pass # Ignore error if already exists + + # Populate here the external builder XML calling waf + builder = Document() + launchConfiguration = doc.createElement('launchConfiguration') + launchConfiguration.setAttribute('type', 'org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType') + self.add(doc, launchConfiguration, 'booleanAttribute', {'key': 'org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND', 'value': 'false'}) + self.add(doc, launchConfiguration, 'booleanAttribute', {'key': 'org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED', 'value': 'true'}) + self.add(doc, launchConfiguration, 'stringAttribute', {'key': 'org.eclipse.ui.externaltools.ATTR_LOCATION', 'value': waf_executable}) + self.add(doc, launchConfiguration, 'stringAttribute', {'key': 'org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS', 'value': 'full,incremental,'}) + self.add(doc, launchConfiguration, 'stringAttribute', {'key': 'org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS', 'value': 'build'}) + self.add(doc, launchConfiguration, 'stringAttribute', {'key': 'org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY', 'value': '${project_loc}'}) + builder.appendChild(launchConfiguration) + # And write the XML to the file references before + self.write_conf_to_xml('%s%s%s'%(extbuilder_dir, os.path.sep, extbuilder_name), builder) + + for k, v in dictionaries.items(): self.addDictionary(doc, arguments, k, v) @@ -187,7 +228,7 @@ class eclipse(Build.BuildContext): doc.appendChild(projectDescription) return doc - def impl_create_cproject(self, executable, waf, appname, workspace_includes, cpppath, source_dirs=[]): + def impl_create_cproject(self, executable, waf_executable, appname, workspace_includes, cpppath, source_dirs=[]): doc = Document() doc.appendChild(doc.createProcessingInstruction('fileVersion', '4.0.0')) cconf_id = cdt_core + '.default.config.1' @@ -234,8 +275,8 @@ class eclipse(Build.BuildContext): self.add(doc, toolChain, 'targetPlatform', {'binaryParser': 'org.eclipse.cdt.core.ELF', 'id': cdt_bld + '.prefbase.toolchain.1', 'name': ''}) - waf_build = '"%s" %s'%(waf, eclipse.fun) - waf_clean = '"%s" clean'%(waf) + waf_build = '"%s" %s'%(waf_executable, eclipse.fun) + waf_clean = '"%s" clean'%(waf_executable) self.add(doc, toolChain, 'builder', {'autoBuildTarget': waf_build, 'command': executable, @@ -295,7 +336,7 @@ class eclipse(Build.BuildContext): buildTargets = self.add(doc, storageModule, 'buildTargets') def addTargetWrap(name, runAll): return self.addTarget(doc, buildTargets, executable, name, - '"%s" %s'%(waf, name), runAll) + '"%s" %s'%(waf_executable, name), runAll) addTargetWrap('configure', True) addTargetWrap('dist', False) addTargetWrap('install', False) @@ -337,7 +378,7 @@ class eclipse(Build.BuildContext): doc.appendChild(pydevproject) return doc - def impl_create_javaproject(self, javasrcpath): + def impl_create_javaproject(self, javasrcpath, javalibpath): # create a .classpath file for java usage doc = Document() javaproject = doc.createElement('classpath') @@ -346,6 +387,11 @@ class eclipse(Build.BuildContext): self.add(doc, javaproject, 'classpathentry', {'kind': 'src', 'path': i}) + if javalibpath: + for i in javalibpath: + self.add(doc, javaproject, 'classpathentry', + {'kind': 'lib', 'path': i}) + self.add(doc, javaproject, 'classpathentry', {'kind': 'con', 'path': 'org.eclipse.jdt.launching.JRE_CONTAINER'}) self.add(doc, javaproject, 'classpathentry', {'kind': 'output', 'path': self.bldnode.name }) doc.appendChild(javaproject) diff --git a/third_party/waf/waflib/extras/erlang.py b/third_party/waf/waflib/extras/erlang.py index b2aa5a16579..49f6d5b475b 100644 --- a/third_party/waf/waflib/extras/erlang.py +++ b/third_party/waf/waflib/extras/erlang.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2010 (ita) diff --git a/third_party/waf/waflib/extras/fast_partial.py b/third_party/waf/waflib/extras/fast_partial.py index bd9b2b833dc..b3af513b255 100644 --- a/third_party/waf/waflib/extras/fast_partial.py +++ b/third_party/waf/waflib/extras/fast_partial.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2017-2018 (ita) diff --git a/third_party/waf/waflib/extras/fc_bgxlf.py b/third_party/waf/waflib/extras/fc_bgxlf.py index c58e7ac0181..cca18101ead 100644 --- a/third_party/waf/waflib/extras/fc_bgxlf.py +++ b/third_party/waf/waflib/extras/fc_bgxlf.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # harald at klimachs.de diff --git a/third_party/waf/waflib/extras/fc_cray.py b/third_party/waf/waflib/extras/fc_cray.py index 0ae9f7ec91a..ec2906742b4 100644 --- a/third_party/waf/waflib/extras/fc_cray.py +++ b/third_party/waf/waflib/extras/fc_cray.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # harald at klimachs.de diff --git a/third_party/waf/waflib/extras/fc_nag.py b/third_party/waf/waflib/extras/fc_nag.py index 1779e1988f5..edcb218bc31 100644 --- a/third_party/waf/waflib/extras/fc_nag.py +++ b/third_party/waf/waflib/extras/fc_nag.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # harald at klimachs.de diff --git a/third_party/waf/waflib/extras/fc_nec.py b/third_party/waf/waflib/extras/fc_nec.py index 2d0ca71ab39..4b70f3dcccd 100644 --- a/third_party/waf/waflib/extras/fc_nec.py +++ b/third_party/waf/waflib/extras/fc_nec.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # harald at klimachs.de diff --git a/third_party/waf/waflib/extras/fc_open64.py b/third_party/waf/waflib/extras/fc_open64.py index 6001b2083a6..413719f43ec 100644 --- a/third_party/waf/waflib/extras/fc_open64.py +++ b/third_party/waf/waflib/extras/fc_open64.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # harald at klimachs.de diff --git a/third_party/waf/waflib/extras/fc_pgfortran.py b/third_party/waf/waflib/extras/fc_pgfortran.py index bc62279a306..afb2817ba67 100644 --- a/third_party/waf/waflib/extras/fc_pgfortran.py +++ b/third_party/waf/waflib/extras/fc_pgfortran.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # harald at klimachs.de diff --git a/third_party/waf/waflib/extras/fc_solstudio.py b/third_party/waf/waflib/extras/fc_solstudio.py index 8880d31c58e..53766df8fc1 100644 --- a/third_party/waf/waflib/extras/fc_solstudio.py +++ b/third_party/waf/waflib/extras/fc_solstudio.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # harald at klimachs.de diff --git a/third_party/waf/waflib/extras/fc_xlf.py b/third_party/waf/waflib/extras/fc_xlf.py index fe8ea4539ce..5a3da034187 100644 --- a/third_party/waf/waflib/extras/fc_xlf.py +++ b/third_party/waf/waflib/extras/fc_xlf.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # harald at klimachs.de diff --git a/third_party/waf/waflib/extras/file_to_object.py b/third_party/waf/waflib/extras/file_to_object.py index a295998e9e6..1393b511d63 100644 --- a/third_party/waf/waflib/extras/file_to_object.py +++ b/third_party/waf/waflib/extras/file_to_object.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/python # -*- coding: utf-8 -*- # Tool to embed file into objects diff --git a/third_party/waf/waflib/extras/fluid.py b/third_party/waf/waflib/extras/fluid.py index caa8afdfbc0..4814a35b94d 100644 --- a/third_party/waf/waflib/extras/fluid.py +++ b/third_party/waf/waflib/extras/fluid.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/python # encoding: utf-8 # Grygoriy Fuchedzhy 2009 diff --git a/third_party/waf/waflib/extras/freeimage.py b/third_party/waf/waflib/extras/freeimage.py index 59d557a1cf7..f27e5258ddd 100644 --- a/third_party/waf/waflib/extras/freeimage.py +++ b/third_party/waf/waflib/extras/freeimage.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # diff --git a/third_party/waf/waflib/extras/fsb.py b/third_party/waf/waflib/extras/fsb.py index d31e33a4597..1b8f398feb6 100644 --- a/third_party/waf/waflib/extras/fsb.py +++ b/third_party/waf/waflib/extras/fsb.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2011 (ita) diff --git a/third_party/waf/waflib/extras/fsc.py b/third_party/waf/waflib/extras/fsc.py index 6325de4a40b..c67e70be296 100644 --- a/third_party/waf/waflib/extras/fsc.py +++ b/third_party/waf/waflib/extras/fsc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2011 (ita) diff --git a/third_party/waf/waflib/extras/gccdeps.py b/third_party/waf/waflib/extras/gccdeps.py index 81f60d5aaca..d9758ab34d5 100644 --- a/third_party/waf/waflib/extras/gccdeps.py +++ b/third_party/waf/waflib/extras/gccdeps.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2008-2010 (ita) diff --git a/third_party/waf/waflib/extras/gdbus.py b/third_party/waf/waflib/extras/gdbus.py new file mode 100644 index 00000000000..0e0476e301a --- /dev/null +++ b/third_party/waf/waflib/extras/gdbus.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python +# encoding: utf-8 +# Copyright Garmin International or its subsidiaries, 2018 +# +# Heavily based on dbus.py + +""" +Compiles dbus files with **gdbus-codegen** +Typical usage:: + def options(opt): + opt.load('compiler_c gdbus') + def configure(conf): + conf.load('compiler_c gdbus') + def build(bld): + tg = bld.program( + includes = '.', + source = bld.path.ant_glob('*.c'), + target = 'gnome-hello') + tg.add_gdbus_file('test.xml', 'com.example.example.', 'Example') +""" + +from waflib import Task, Errors, Utils +from waflib.TaskGen import taskgen_method, before_method + +@taskgen_method +def add_gdbus_file(self, filename, prefix, namespace, export=False): + """ + Adds a dbus file to the list of dbus files to process. Store them in the attribute *dbus_lst*. + :param filename: xml file to compile + :type filename: string + :param prefix: interface prefix (--interface-prefix=prefix) + :type prefix: string + :param mode: C namespace (--c-namespace=namespace) + :type mode: string + :param export: Export Headers? + :type export: boolean + """ + if not hasattr(self, 'gdbus_lst'): + self.gdbus_lst = [] + if not 'process_gdbus' in self.meths: + self.meths.append('process_gdbus') + self.gdbus_lst.append([filename, prefix, namespace, export]) + +@before_method('process_source') +def process_gdbus(self): + """ + Processes the dbus files stored in the attribute *gdbus_lst* to create :py:class:`gdbus_binding_tool` instances. + """ + output_node = self.path.get_bld().make_node(['gdbus', self.get_name()]) + sources = [] + + for filename, prefix, namespace, export in getattr(self, 'gdbus_lst', []): + node = self.path.find_resource(filename) + if not node: + raise Errors.WafError('file not found ' + filename) + c_file = output_node.find_or_declare(node.change_ext('.c').name) + h_file = output_node.find_or_declare(node.change_ext('.h').name) + tsk = self.create_task('gdbus_binding_tool', node, [c_file, h_file]) + tsk.cwd = output_node.abspath() + + tsk.env.GDBUS_CODEGEN_INTERFACE_PREFIX = prefix + tsk.env.GDBUS_CODEGEN_NAMESPACE = namespace + tsk.env.GDBUS_CODEGEN_OUTPUT = node.change_ext('').name + sources.append(c_file) + + if sources: + output_node.mkdir() + self.source = Utils.to_list(self.source) + sources + self.includes = [output_node] + self.to_incnodes(getattr(self, 'includes', [])) + if export: + self.export_includes = [output_node] + self.to_incnodes(getattr(self, 'export_includes', [])) + +class gdbus_binding_tool(Task.Task): + """ + Compiles a dbus file + """ + color = 'BLUE' + ext_out = ['.h', '.c'] + run_str = '${GDBUS_CODEGEN} --interface-prefix ${GDBUS_CODEGEN_INTERFACE_PREFIX} --generate-c-code ${GDBUS_CODEGEN_OUTPUT} --c-namespace ${GDBUS_CODEGEN_NAMESPACE} --c-generate-object-manager ${SRC[0].abspath()}' + shell = True + +def configure(conf): + """ + Detects the program gdbus-codegen and sets ``conf.env.GDBUS_CODEGEN`` + """ + conf.find_program('gdbus-codegen', var='GDBUS_CODEGEN') + diff --git a/third_party/waf/waflib/extras/gob2.py b/third_party/waf/waflib/extras/gob2.py index 629ccdca8ed..b4fa3b9a72e 100644 --- a/third_party/waf/waflib/extras/gob2.py +++ b/third_party/waf/waflib/extras/gob2.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Ali Sabil, 2007 diff --git a/third_party/waf/waflib/extras/halide.py b/third_party/waf/waflib/extras/halide.py index df7509a6d11..6078e38bde1 100644 --- a/third_party/waf/waflib/extras/halide.py +++ b/third_party/waf/waflib/extras/halide.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/python # -*- coding: utf-8 -*- # Halide code generation tool diff --git a/third_party/waf/waflib/extras/javatest.py b/third_party/waf/waflib/extras/javatest.py index 0c315745353..979b8d8242d 100755 --- a/third_party/waf/waflib/extras/javatest.py +++ b/third_party/waf/waflib/extras/javatest.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Federico Pellegrin, 2017 (fedepell) diff --git a/third_party/waf/waflib/extras/kde4.py b/third_party/waf/waflib/extras/kde4.py index 13ac82f4049..e49a9ec00e1 100644 --- a/third_party/waf/waflib/extras/kde4.py +++ b/third_party/waf/waflib/extras/kde4.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2010 (ita) diff --git a/third_party/waf/waflib/extras/local_rpath.py b/third_party/waf/waflib/extras/local_rpath.py index 6020b45f7a9..b2507e17a10 100644 --- a/third_party/waf/waflib/extras/local_rpath.py +++ b/third_party/waf/waflib/extras/local_rpath.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2011 (ita) diff --git a/third_party/waf/waflib/extras/make.py b/third_party/waf/waflib/extras/make.py index 7b75d5511ba..933d9cacb2b 100644 --- a/third_party/waf/waflib/extras/make.py +++ b/third_party/waf/waflib/extras/make.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2011 (ita) diff --git a/third_party/waf/waflib/extras/midl.py b/third_party/waf/waflib/extras/midl.py index c81e0e317ad..43e6cf911f2 100644 --- a/third_party/waf/waflib/extras/midl.py +++ b/third_party/waf/waflib/extras/midl.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # Issue 1185 ultrix gmail com diff --git a/third_party/waf/waflib/extras/msvcdeps.py b/third_party/waf/waflib/extras/msvcdeps.py index a6ea52af76b..fc1ecd4d08c 100644 --- a/third_party/waf/waflib/extras/msvcdeps.py +++ b/third_party/waf/waflib/extras/msvcdeps.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Copyright Garmin International or its subsidiaries, 2012-2013 diff --git a/third_party/waf/waflib/extras/msvs.py b/third_party/waf/waflib/extras/msvs.py index b12d9c068e5..8aa2db0b751 100644 --- a/third_party/waf/waflib/extras/msvs.py +++ b/third_party/waf/waflib/extras/msvs.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Avalanche Studios 2009-2011 diff --git a/third_party/waf/waflib/extras/netcache_client.py b/third_party/waf/waflib/extras/netcache_client.py index ffd40d87f42..dc490485acf 100644 --- a/third_party/waf/waflib/extras/netcache_client.py +++ b/third_party/waf/waflib/extras/netcache_client.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2011-2015 (ita) diff --git a/third_party/waf/waflib/extras/objcopy.py b/third_party/waf/waflib/extras/objcopy.py index baa54c0bd54..82d8359ecf7 100644 --- a/third_party/waf/waflib/extras/objcopy.py +++ b/third_party/waf/waflib/extras/objcopy.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/python # Grygoriy Fuchedzhy 2010 diff --git a/third_party/waf/waflib/extras/ocaml.py b/third_party/waf/waflib/extras/ocaml.py index 56f851e72cf..afe73c0ca3e 100644 --- a/third_party/waf/waflib/extras/ocaml.py +++ b/third_party/waf/waflib/extras/ocaml.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2010 (ita) diff --git a/third_party/waf/waflib/extras/package.py b/third_party/waf/waflib/extras/package.py index 669aa170bd5..c06498eba8f 100644 --- a/third_party/waf/waflib/extras/package.py +++ b/third_party/waf/waflib/extras/package.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2011 diff --git a/third_party/waf/waflib/extras/parallel_debug.py b/third_party/waf/waflib/extras/parallel_debug.py index d365024e205..35883a3dd74 100644 --- a/third_party/waf/waflib/extras/parallel_debug.py +++ b/third_party/waf/waflib/extras/parallel_debug.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2007-2010 (ita) diff --git a/third_party/waf/waflib/extras/pch.py b/third_party/waf/waflib/extras/pch.py index 98b23f47fe4..103e752838c 100644 --- a/third_party/waf/waflib/extras/pch.py +++ b/third_party/waf/waflib/extras/pch.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Alexander Afanasyev (UCLA), 2014 @@ -94,8 +90,8 @@ def apply_pch(self): if getattr(self, 'name', None): try: - task = self.bld.pch_tasks[self.name] - self.bld.fatal("Duplicated 'pch' task with name %r" % self.name) + task = self.bld.pch_tasks["%s.%s" % (self.name, self.idx)] + self.bld.fatal("Duplicated 'pch' task with name %r" % "%s.%s" % (self.name, self.idx)) except KeyError: pass @@ -108,7 +104,7 @@ def apply_pch(self): self.pch_task = task if getattr(self, 'name', None): - self.bld.pch_tasks[self.name] = task + self.bld.pch_tasks["%s.%s" % (self.name, self.idx)] = task @TaskGen.feature('cxx') @TaskGen.after_method('process_source', 'propagate_uselib_vars') diff --git a/third_party/waf/waflib/extras/pep8.py b/third_party/waf/waflib/extras/pep8.py index 278662f8051..676beedb25b 100644 --- a/third_party/waf/waflib/extras/pep8.py +++ b/third_party/waf/waflib/extras/pep8.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # diff --git a/third_party/waf/waflib/extras/pgicc.py b/third_party/waf/waflib/extras/pgicc.py index ba50e172bc0..9790b9cf8ba 100644 --- a/third_party/waf/waflib/extras/pgicc.py +++ b/third_party/waf/waflib/extras/pgicc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Antoine Dechaume 2011 diff --git a/third_party/waf/waflib/extras/pgicxx.py b/third_party/waf/waflib/extras/pgicxx.py index 7d077d74789..eae121c4036 100644 --- a/third_party/waf/waflib/extras/pgicxx.py +++ b/third_party/waf/waflib/extras/pgicxx.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Antoine Dechaume 2011 diff --git a/third_party/waf/waflib/extras/proc.py b/third_party/waf/waflib/extras/proc.py index 2d7e5cedb1f..764abecfc30 100644 --- a/third_party/waf/waflib/extras/proc.py +++ b/third_party/waf/waflib/extras/proc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # per rosengren 2011 diff --git a/third_party/waf/waflib/extras/protoc.py b/third_party/waf/waflib/extras/protoc.py index cb16e858182..f3cb4d86ab8 100644 --- a/third_party/waf/waflib/extras/protoc.py +++ b/third_party/waf/waflib/extras/protoc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Philipp Bender, 2012 @@ -128,6 +124,9 @@ class protoc(Task): names.append(dep) parse_node(node) + # Add also dependencies path to INCPATHS so protoc will find the included file + for deppath in nodes: + self.env.append_value('INCPATHS', deppath.parent.bldpath()) return (nodes, names) @extension('.proto') @@ -195,9 +194,9 @@ def process_protoc(self, node): nodename += javacn + '.java' else: if self.env.PROTOC_MAJOR > '2' and node.abspath()[node.abspath().rfind(os.sep)+1:node.abspath().rfind('.')].title() in messages: - nodename += node.abspath()[node.abspath().rfind(os.sep)+1:node.abspath().rfind('.')].title() + 'OuterClass.java' + nodename += node.abspath()[node.abspath().rfind(os.sep)+1:node.abspath().rfind('.')].title().replace('_','') + 'OuterClass.java' else: - nodename += node.abspath()[node.abspath().rfind(os.sep)+1:node.abspath().rfind('.')].title() + '.java' + nodename += node.abspath()[node.abspath().rfind(os.sep)+1:node.abspath().rfind('.')].title().replace('_','') + '.java' java_node = node.parent.find_or_declare(nodename) out_nodes.append(java_node) @@ -220,9 +219,14 @@ def process_protoc(self, node): # For C++ standard include files dirs are used, # but this doesn't apply to Python for example for incpath in getattr(self, 'protoc_includes', []): - incdirs.append(self.bld.path.find_node(incpath).bldpath()) + incdirs.append(self.path.find_node(incpath).bldpath()) tsk.env.PROTOC_INCPATHS = incdirs + # PR2115: protoc generates output of .proto files in nested + # directories by canonicalizing paths. To avoid this we have to pass + # as first include the full directory file of the .proto file + tsk.env.prepend_value('INCPATHS', node.parent.bldpath()) + use = getattr(self, 'use', '') if not 'PROTOBUF' in use: self.use = self.to_list(use) + ['PROTOBUF'] diff --git a/third_party/waf/waflib/extras/pyqt5.py b/third_party/waf/waflib/extras/pyqt5.py index 0190f2527d7..c21dfa72048 100644 --- a/third_party/waf/waflib/extras/pyqt5.py +++ b/third_party/waf/waflib/extras/pyqt5.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Federico Pellegrin, 2016-2018 (fedepell) adapted for Python diff --git a/third_party/waf/waflib/extras/pytest.py b/third_party/waf/waflib/extras/pytest.py index c4ed4c574da..7dd5a1a087a 100644 --- a/third_party/waf/waflib/extras/pytest.py +++ b/third_party/waf/waflib/extras/pytest.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Calle Rosenquist, 2016-2018 (xbreak) diff --git a/third_party/waf/waflib/extras/qnxnto.py b/third_party/waf/waflib/extras/qnxnto.py index db4467df396..1158124da96 100644 --- a/third_party/waf/waflib/extras/qnxnto.py +++ b/third_party/waf/waflib/extras/qnxnto.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Jérôme Carretero 2011 (zougloub) diff --git a/third_party/waf/waflib/extras/qt4.py b/third_party/waf/waflib/extras/qt4.py index c310046188f..90cae7e0ae5 100644 --- a/third_party/waf/waflib/extras/qt4.py +++ b/third_party/waf/waflib/extras/qt4.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2010 (ita) diff --git a/third_party/waf/waflib/extras/relocation.py b/third_party/waf/waflib/extras/relocation.py index 50ac5b9d41b..7e821f4166c 100644 --- a/third_party/waf/waflib/extras/relocation.py +++ b/third_party/waf/waflib/extras/relocation.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 diff --git a/third_party/waf/waflib/extras/remote.py b/third_party/waf/waflib/extras/remote.py index 9bf6e2d71c6..3b038f772b5 100644 --- a/third_party/waf/waflib/extras/remote.py +++ b/third_party/waf/waflib/extras/remote.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Remote Builds tool using rsync+ssh diff --git a/third_party/waf/waflib/extras/resx.py b/third_party/waf/waflib/extras/resx.py index ead38ef50b5..caf4d318bb0 100644 --- a/third_party/waf/waflib/extras/resx.py +++ b/third_party/waf/waflib/extras/resx.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 diff --git a/third_party/waf/waflib/extras/review.py b/third_party/waf/waflib/extras/review.py index 8d167c15e13..561e06219da 100644 --- a/third_party/waf/waflib/extras/review.py +++ b/third_party/waf/waflib/extras/review.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Laurent Birtz, 2011 diff --git a/third_party/waf/waflib/extras/rst.py b/third_party/waf/waflib/extras/rst.py index 1703eeac348..f3c3a5eba42 100644 --- a/third_party/waf/waflib/extras/rst.py +++ b/third_party/waf/waflib/extras/rst.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Jérôme Carretero, 2013 (zougloub) diff --git a/third_party/waf/waflib/extras/run_do_script.py b/third_party/waf/waflib/extras/run_do_script.py index 529cc08ae9e..f3c58122c9b 100644 --- a/third_party/waf/waflib/extras/run_do_script.py +++ b/third_party/waf/waflib/extras/run_do_script.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Hans-Martin von Gaudecker, 2012 diff --git a/third_party/waf/waflib/extras/run_m_script.py b/third_party/waf/waflib/extras/run_m_script.py index bc6db0027ab..b5f27ebe082 100644 --- a/third_party/waf/waflib/extras/run_m_script.py +++ b/third_party/waf/waflib/extras/run_m_script.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Hans-Martin von Gaudecker, 2012 diff --git a/third_party/waf/waflib/extras/run_py_script.py b/third_party/waf/waflib/extras/run_py_script.py index 845a3ced798..367038114ca 100644 --- a/third_party/waf/waflib/extras/run_py_script.py +++ b/third_party/waf/waflib/extras/run_py_script.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Hans-Martin von Gaudecker, 2012 diff --git a/third_party/waf/waflib/extras/run_r_script.py b/third_party/waf/waflib/extras/run_r_script.py index 8dd81825e9c..b0d8f2b2cde 100644 --- a/third_party/waf/waflib/extras/run_r_script.py +++ b/third_party/waf/waflib/extras/run_r_script.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Hans-Martin von Gaudecker, 2012 diff --git a/third_party/waf/waflib/extras/sas.py b/third_party/waf/waflib/extras/sas.py index a7220068b96..754c6148dec 100644 --- a/third_party/waf/waflib/extras/sas.py +++ b/third_party/waf/waflib/extras/sas.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Mark Coggeshall, 2010 diff --git a/third_party/waf/waflib/extras/satellite_assembly.py b/third_party/waf/waflib/extras/satellite_assembly.py index a9e1ddf6d62..005eb074f9d 100644 --- a/third_party/waf/waflib/extras/satellite_assembly.py +++ b/third_party/waf/waflib/extras/satellite_assembly.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/python # encoding: utf-8 # vim: tabstop=4 noexpandtab diff --git a/third_party/waf/waflib/extras/scala.py b/third_party/waf/waflib/extras/scala.py index bdc2bbbee59..a9880f02341 100644 --- a/third_party/waf/waflib/extras/scala.py +++ b/third_party/waf/waflib/extras/scala.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2010 (ita) diff --git a/third_party/waf/waflib/extras/slow_qt4.py b/third_party/waf/waflib/extras/slow_qt4.py index e3014cdf070..ec7880bf9d7 100644 --- a/third_party/waf/waflib/extras/slow_qt4.py +++ b/third_party/waf/waflib/extras/slow_qt4.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # Thomas Nagy, 2011 (ita) @@ -26,7 +22,7 @@ import waflib.Tools.cxx @extension(*waflib.Tools.qt4.EXT_QT4) def cxx_hook(self, node): - self.create_compiled_task('cxx_qt', node) + return self.create_compiled_task('cxx_qt', node) class cxx_qt(Task.classes['cxx']): def runnable_status(self): diff --git a/third_party/waf/waflib/extras/softlink_libs.py b/third_party/waf/waflib/extras/softlink_libs.py index ed453848786..50c777f28c5 100644 --- a/third_party/waf/waflib/extras/softlink_libs.py +++ b/third_party/waf/waflib/extras/softlink_libs.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # per rosengren 2011 diff --git a/third_party/waf/waflib/extras/stale.py b/third_party/waf/waflib/extras/stale.py index 991af82cd61..cac3f469c94 100644 --- a/third_party/waf/waflib/extras/stale.py +++ b/third_party/waf/waflib/extras/stale.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: UTF-8 # Thomas Nagy, 2006-2015 (ita) diff --git a/third_party/waf/waflib/extras/stracedeps.py b/third_party/waf/waflib/extras/stracedeps.py index 4be44248cb6..37d82cbb724 100644 --- a/third_party/waf/waflib/extras/stracedeps.py +++ b/third_party/waf/waflib/extras/stracedeps.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2015 (ita) diff --git a/third_party/waf/waflib/extras/swig.py b/third_party/waf/waflib/extras/swig.py index 18d665e5d46..fd3d6d2c995 100644 --- a/third_party/waf/waflib/extras/swig.py +++ b/third_party/waf/waflib/extras/swig.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: UTF-8 # Petar Forai @@ -116,9 +112,16 @@ def swig_c(self): c_tsk.set_run_after(self) - ge = self.generator.bld.producer - ge.outstanding.append(c_tsk) - ge.total += 1 + # transfer weights from swig task to c task + if getattr(self, 'weight', None): + c_tsk.weight = self.weight + if getattr(self, 'tree_weight', None): + c_tsk.tree_weight = self.tree_weight + + try: + self.more_tasks.append(c_tsk) + except AttributeError: + self.more_tasks = [c_tsk] try: ltask = self.generator.link_task @@ -127,10 +130,9 @@ def swig_c(self): else: ltask.set_run_after(c_tsk) # setting input nodes does not declare the build order - # because the build already started + # because the build already started, but it sets + # the dependency to enable rebuilds ltask.inputs.append(c_tsk.outputs[0]) - # set the build order after the build started: - ge.revdeps[c_tsk].add(ltask) self.outputs.append(out_node) diff --git a/third_party/waf/waflib/extras/syms.py b/third_party/waf/waflib/extras/syms.py index 05fff9f59a2..dfa005930e4 100644 --- a/third_party/waf/waflib/extras/syms.py +++ b/third_party/waf/waflib/extras/syms.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 diff --git a/third_party/waf/waflib/extras/ticgt.py b/third_party/waf/waflib/extras/ticgt.py index 117585cecae..f43a7ea5cb1 100644 --- a/third_party/waf/waflib/extras/ticgt.py +++ b/third_party/waf/waflib/extras/ticgt.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 diff --git a/third_party/waf/waflib/extras/unity.py b/third_party/waf/waflib/extras/unity.py index cb6a8d54db7..78128ed3859 100644 --- a/third_party/waf/waflib/extras/unity.py +++ b/third_party/waf/waflib/extras/unity.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 diff --git a/third_party/waf/waflib/extras/use_config.py b/third_party/waf/waflib/extras/use_config.py index b5a73d7f3e1..71df793a2a3 100644 --- a/third_party/waf/waflib/extras/use_config.py +++ b/third_party/waf/waflib/extras/use_config.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # coding=utf-8 # Mathieu Courtois - EDF R&D, 2013 - http://www.code-aster.org diff --git a/third_party/waf/waflib/extras/valadoc.py b/third_party/waf/waflib/extras/valadoc.py index bb2a4d22030..c50f69e747a 100644 --- a/third_party/waf/waflib/extras/valadoc.py +++ b/third_party/waf/waflib/extras/valadoc.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: UTF-8 # Nicolas Joseph 2009 diff --git a/third_party/waf/waflib/extras/waf_xattr.py b/third_party/waf/waflib/extras/waf_xattr.py new file mode 100644 index 00000000000..351dd63a784 --- /dev/null +++ b/third_party/waf/waflib/extras/waf_xattr.py @@ -0,0 +1,150 @@ +#! /usr/bin/env python +# encoding: utf-8 + +""" +Use extended attributes instead of database files + +1. Input files will be made writable +2. This is only for systems providing extended filesystem attributes +3. By default, hashes are calculated only if timestamp/size change (HASH_CACHE below) +4. The module enables "deep_inputs" on all tasks by propagating task signatures +5. This module also skips task signature comparisons for task code changes due to point 4. +6. This module is for Python3/Linux only, but it could be extended to Python2/other systems + using the xattr library +7. For projects in which tasks always declare output files, it should be possible to + store the rest of build context attributes on output files (imp_sigs, raw_deps and node_deps) + but this is not done here + +On a simple C++ project benchmark, the variations before and after adding waf_xattr.py were observed: +total build time: 20s -> 22s +no-op build time: 2.4s -> 1.8s +pickle file size: 2.9MB -> 2.6MB +""" + +import os +from waflib import Logs, Node, Task, Utils, Errors +from waflib.Task import SKIP_ME, RUN_ME, CANCEL_ME, ASK_LATER, SKIPPED, MISSING + +HASH_CACHE = True +SIG_VAR = 'user.waf.sig' +SEP = ','.encode() +TEMPLATE = '%b%d,%d'.encode() + +try: + PermissionError +except NameError: + PermissionError = IOError + +def getxattr(self): + return os.getxattr(self.abspath(), SIG_VAR) + +def setxattr(self, val): + os.setxattr(self.abspath(), SIG_VAR, val) + +def h_file(self): + try: + ret = getxattr(self) + except OSError: + if HASH_CACHE: + st = os.stat(self.abspath()) + mtime = st.st_mtime + size = st.st_size + else: + if len(ret) == 16: + # for build directory files + return ret + + if HASH_CACHE: + # check if timestamp and mtime match to avoid re-hashing + st = os.stat(self.abspath()) + mtime, size = ret[16:].split(SEP) + if int(1000 * st.st_mtime) == int(mtime) and st.st_size == int(size): + return ret[:16] + + ret = Utils.h_file(self.abspath()) + if HASH_CACHE: + val = TEMPLATE % (ret, int(1000 * st.st_mtime), int(st.st_size)) + try: + setxattr(self, val) + except PermissionError: + os.chmod(self.abspath(), st.st_mode | 128) + setxattr(self, val) + return ret + +def runnable_status(self): + bld = self.generator.bld + if bld.is_install < 0: + return SKIP_ME + + for t in self.run_after: + if not t.hasrun: + return ASK_LATER + elif t.hasrun < SKIPPED: + # a dependency has an error + return CANCEL_ME + + # first compute the signature + try: + new_sig = self.signature() + except Errors.TaskNotReady: + return ASK_LATER + + if not self.outputs: + # compare the signature to a signature computed previously + # this part is only for tasks with no output files + key = self.uid() + try: + prev_sig = bld.task_sigs[key] + except KeyError: + Logs.debug('task: task %r must run: it was never run before or the task code changed', self) + return RUN_ME + if new_sig != prev_sig: + Logs.debug('task: task %r must run: the task signature changed', self) + return RUN_ME + + # compare the signatures of the outputs to make a decision + for node in self.outputs: + try: + sig = node.h_file() + except EnvironmentError: + Logs.debug('task: task %r must run: an output node does not exist', self) + return RUN_ME + if sig != new_sig: + Logs.debug('task: task %r must run: an output node is stale', self) + return RUN_ME + + return (self.always_run and RUN_ME) or SKIP_ME + +def post_run(self): + bld = self.generator.bld + sig = self.signature() + for node in self.outputs: + if not node.exists(): + self.hasrun = MISSING + self.err_msg = '-> missing file: %r' % node.abspath() + raise Errors.WafError(self.err_msg) + os.setxattr(node.abspath(), 'user.waf.sig', sig) + if not self.outputs: + # only for task with no outputs + bld.task_sigs[self.uid()] = sig + if not self.keep_last_cmd: + try: + del self.last_cmd + except AttributeError: + pass + +try: + os.getxattr +except AttributeError: + pass +else: + h_file.__doc__ = Node.Node.h_file.__doc__ + + # keep file hashes as file attributes + Node.Node.h_file = h_file + + # enable "deep_inputs" on all tasks + Task.Task.runnable_status = runnable_status + Task.Task.post_run = post_run + Task.Task.sig_deep_inputs = Utils.nada + diff --git a/third_party/waf/waflib/extras/why.py b/third_party/waf/waflib/extras/why.py index 8404e213888..1bb941f6c98 100644 --- a/third_party/waf/waflib/extras/why.py +++ b/third_party/waf/waflib/extras/why.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2010 (ita) diff --git a/third_party/waf/waflib/extras/win32_opts.py b/third_party/waf/waflib/extras/win32_opts.py index f8f41870567..9f7443c39b4 100644 --- a/third_party/waf/waflib/extras/win32_opts.py +++ b/third_party/waf/waflib/extras/win32_opts.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 diff --git a/third_party/waf/waflib/extras/wix.py b/third_party/waf/waflib/extras/wix.py index c9daae6ead3..d87bfbb1ec8 100644 --- a/third_party/waf/waflib/extras/wix.py +++ b/third_party/waf/waflib/extras/wix.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/python # encoding: utf-8 # vim: tabstop=4 noexpandtab diff --git a/third_party/waf/waflib/extras/xcode6.py b/third_party/waf/waflib/extras/xcode6.py index 15cddf2b056..c062a74e4fc 100644 --- a/third_party/waf/waflib/extras/xcode6.py +++ b/third_party/waf/waflib/extras/xcode6.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # XCode 3/XCode 4/XCode 6/Xcode 7 generator for Waf @@ -129,7 +125,7 @@ def configure(self): # Some build settings are required to be present by XCode. We will supply default values # if user hasn't defined any. defaults_required = [('PRODUCT_NAME', '$(TARGET_NAME)')] - for cfgname,settings in self.env.PROJ_CONFIGURATION.iteritems(): + for cfgname,settings in self.env.PROJ_CONFIGURATION.items(): for default_var, default_val in defaults_required: if default_var not in settings: settings[default_var] = default_val diff --git a/third_party/waf/waflib/fixpy2.py b/third_party/waf/waflib/fixpy2.py index 83df79cbeda..24176e06645 100644 --- a/third_party/waf/waflib/fixpy2.py +++ b/third_party/waf/waflib/fixpy2.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2010-2018 (ita) diff --git a/third_party/waf/waflib/processor.py b/third_party/waf/waflib/processor.py index 2c62228f521..2eecf3bd93f 100755 --- a/third_party/waf/waflib/processor.py +++ b/third_party/waf/waflib/processor.py @@ -1,7 +1,3 @@ -#! /usr/bin/env python -# encoding: utf-8 -# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file - #! /usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2016-2018 (ita) -- cgit v1.2.1