The branch, master has been updated via fb175576b69 third_party: Update waf to verison 2.0.23 via 6b8d30e0aa1 third_party:waf: Print the version of waf at the end of the update script via 33186bdf644 editorconfig: Final newlines are pycodestyle from 45cb14ac808 waf: re-add missing readlink test
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit fb175576b698f43224dab815fd6c0763a12db2b2 Author: Andreas Schneider <a...@samba.org> Date: Thu Feb 17 15:40:20 2022 +0100 third_party: Update waf to verison 2.0.23 Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> Autobuild-User(master): Andreas Schneider <a...@cryptomilk.org> Autobuild-Date(master): Mon Feb 21 10:06:27 UTC 2022 on sn-devel-184 commit 6b8d30e0aa15fff7e831c0a3e34719e8cdc1ebec Author: Andreas Schneider <a...@samba.org> Date: Thu Feb 17 15:40:38 2022 +0100 third_party:waf: Print the version of waf at the end of the update script Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 33186bdf6447556cf681333dc83310bc5e1735a1 Author: Andreas Schneider <a...@samba.org> Date: Thu Feb 17 20:35:50 2022 +0100 editorconfig: Final newlines are pycodestyle Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> ----------------------------------------------------------------------- Summary of changes: .editorconfig | 10 ++- buildtools/bin/waf | 3 +- buildtools/wafsamba/wafsamba.py | 2 +- third_party/waf/update.sh | 4 +- third_party/waf/waflib/Context.py | 6 +- third_party/waf/waflib/Runner.py | 4 +- third_party/waf/waflib/TaskGen.py | 8 +-- third_party/waf/waflib/Tools/c_config.py | 1 + third_party/waf/waflib/Tools/compiler_c.py | 25 +++---- third_party/waf/waflib/Tools/compiler_cxx.py | 25 +++---- third_party/waf/waflib/Tools/python.py | 7 +- third_party/waf/waflib/Tools/qt5.py | 4 +- third_party/waf/waflib/Tools/winres.py | 35 +++++++++ .../waflib/extras/clang_compilation_database.py | 2 +- third_party/waf/waflib/extras/classic_runner.py | 68 ++++++++++++++++++ third_party/waf/waflib/extras/color_gcc.py | 2 +- third_party/waf/waflib/extras/eclipse.py | 74 ++++++++++++++++++- third_party/waf/waflib/extras/gccdeps.py | 82 ++++++++++++---------- third_party/waf/waflib/extras/msvcdeps.py | 54 ++++++++++---- third_party/waf/waflib/extras/msvs.py | 6 +- third_party/waf/waflib/extras/swig.py | 2 +- third_party/waf/waflib/extras/wafcache.py | 26 +++---- third_party/waf/waflib/fixpy2.py | 2 +- 23 files changed, 336 insertions(+), 116 deletions(-) create mode 100644 third_party/waf/waflib/extras/classic_runner.py Changeset truncated at 500 lines: diff --git a/.editorconfig b/.editorconfig index f493800cb18..b5d39118772 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,7 +12,13 @@ indent_style = tab indent_size = 8 tab_width = 8 -[*.{py,sh}] +[*.{py}] +indent_style = space +indent_size = 4 +tab_width = 4 +insert_final_newline = true + +[*.{sh}] indent_style = space indent_size = 4 tab_width = 4 @@ -30,4 +36,4 @@ tab_width = 4 [third_party/heimdal/**.{c,h}] indent_style = space indent_size = 4 -tab_width = 8 +tab_width = 8 \ No newline at end of file diff --git a/buildtools/bin/waf b/buildtools/bin/waf index b0ccb09a877..2001ccdbd8a 100755 --- a/buildtools/bin/waf +++ b/buildtools/bin/waf @@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. import os, sys, inspect -VERSION="2.0.22" +VERSION="2.0.23" REVISION="x" GIT="x" INSTALL="x" @@ -164,4 +164,3 @@ if __name__ == '__main__': from waflib import Scripting Scripting.waf_entry_point(cwd, VERSION, wafdir[0]) - diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py index 185ef3b73a2..710b82af663 100644 --- a/buildtools/wafsamba/wafsamba.py +++ b/buildtools/wafsamba/wafsamba.py @@ -38,7 +38,7 @@ LIB_PATH="shared" os.environ['PYTHONUNBUFFERED'] = '1' -if Context.HEXVERSION not in (0x2001600,): +if Context.HEXVERSION not in (0x2001700,): Logs.error(''' Please use the version of waf that comes with Samba, not a system installed version. See http://wiki.samba.org/index.php/Waf diff --git a/third_party/waf/update.sh b/third_party/waf/update.sh index 16bda84a3f0..95f57ed1d81 100755 --- a/third_party/waf/update.sh +++ b/third_party/waf/update.sh @@ -74,6 +74,8 @@ popd || cleanup_and_exit 1 echo echo "Now please change VERSION in buildtools/bin/waf and" echo "Context.HEXVERSION in buildtools/wafsamba/wafsamba.py" +grep WAFVERSION "${WAF_SAMBA_DIR}/waflib/Context.py" +grep HEXVERSION "${WAF_SAMBA_DIR}/waflib/Context.py" echo -cleanup_and_exit 0 +cleanup_and_exit 0 \ No newline at end of file diff --git a/third_party/waf/waflib/Context.py b/third_party/waf/waflib/Context.py index 07ee1201f03..36d1ca74fef 100644 --- a/third_party/waf/waflib/Context.py +++ b/third_party/waf/waflib/Context.py @@ -18,13 +18,13 @@ else: import imp # the following 3 constants are updated on each new release (do not touch) -HEXVERSION=0x2001600 +HEXVERSION=0x2001700 """Constant updated on new releases""" -WAFVERSION="2.0.22" +WAFVERSION="2.0.23" """Constant updated on new releases""" -WAFREVISION="816d5bc48ba2abc4ac22f2b44d94d322bf992b9c" +WAFREVISION="cc6b34cf555d354c34f554c41206134072588de7" """Git revision when the waf version is updated""" WAFNAME="waf" diff --git a/third_party/waf/waflib/Runner.py b/third_party/waf/waflib/Runner.py index 91d55479e20..350c86a22c0 100644 --- a/third_party/waf/waflib/Runner.py +++ b/third_party/waf/waflib/Runner.py @@ -71,7 +71,7 @@ class Consumer(Utils.threading.Thread): """Task to execute""" self.spawner = spawner """Coordinator object""" - self.setDaemon(1) + self.daemon = True self.start() def run(self): """ @@ -98,7 +98,7 @@ class Spawner(Utils.threading.Thread): """:py:class:`waflib.Runner.Parallel` producer instance""" self.sem = Utils.threading.Semaphore(master.numjobs) """Bounded semaphore that prevents spawning more than *n* concurrent consumers""" - self.setDaemon(1) + self.daemon = True self.start() def run(self): """ diff --git a/third_party/waf/waflib/TaskGen.py b/third_party/waf/waflib/TaskGen.py index f8f92bd57c1..89f63169910 100644 --- a/third_party/waf/waflib/TaskGen.py +++ b/third_party/waf/waflib/TaskGen.py @@ -631,12 +631,8 @@ def process_rule(self): cls.scan = self.scan elif has_deps: def scan(self): - nodes = [] - for x in self.generator.to_list(getattr(self.generator, 'deps', None)): - node = self.generator.path.find_resource(x) - if not node: - self.generator.bld.fatal('Could not find %r (was it declared?)' % x) - nodes.append(node) + deps = getattr(self.generator, 'deps', None) + nodes = self.generator.to_nodes(deps) return [nodes, []] cls.scan = scan diff --git a/third_party/waf/waflib/Tools/c_config.py b/third_party/waf/waflib/Tools/c_config.py index 03b6bf61bc0..f5ab19bf6ce 100644 --- a/third_party/waf/waflib/Tools/c_config.py +++ b/third_party/waf/waflib/Tools/c_config.py @@ -69,6 +69,7 @@ MACRO_TO_DEST_CPU = { '__sh__' : 'sh', '__xtensa__' : 'xtensa', '__e2k__' : 'e2k', +'__riscv' : 'riscv', } @conf diff --git a/third_party/waf/waflib/Tools/compiler_c.py b/third_party/waf/waflib/Tools/compiler_c.py index 931dc57efec..e033ce6c5c3 100644 --- a/third_party/waf/waflib/Tools/compiler_c.py +++ b/third_party/waf/waflib/Tools/compiler_c.py @@ -36,18 +36,19 @@ from waflib import Utils from waflib.Logs import debug c_compiler = { -'win32': ['msvc', 'gcc', 'clang'], -'cygwin': ['gcc', 'clang'], -'darwin': ['clang', 'gcc'], -'aix': ['xlc', 'gcc', 'clang'], -'linux': ['gcc', 'clang', 'icc'], -'sunos': ['suncc', 'gcc'], -'irix': ['gcc', 'irixcc'], -'hpux': ['gcc'], -'osf1V': ['gcc'], -'gnu': ['gcc', 'clang'], -'java': ['gcc', 'msvc', 'clang', 'icc'], -'default':['clang', 'gcc'], +'win32': ['msvc', 'gcc', 'clang'], +'cygwin': ['gcc', 'clang'], +'darwin': ['clang', 'gcc'], +'aix': ['xlc', 'gcc', 'clang'], +'linux': ['gcc', 'clang', 'icc'], +'sunos': ['suncc', 'gcc'], +'irix': ['gcc', 'irixcc'], +'hpux': ['gcc'], +'osf1V': ['gcc'], +'gnu': ['gcc', 'clang'], +'java': ['gcc', 'msvc', 'clang', 'icc'], +'gnukfreebsd': ['gcc', 'clang'], +'default': ['clang', 'gcc'], } """ Dict mapping platform names to Waf tools finding specific C compilers:: diff --git a/third_party/waf/waflib/Tools/compiler_cxx.py b/third_party/waf/waflib/Tools/compiler_cxx.py index 09fca7e4dc6..42658c5847e 100644 --- a/third_party/waf/waflib/Tools/compiler_cxx.py +++ b/third_party/waf/waflib/Tools/compiler_cxx.py @@ -37,18 +37,19 @@ from waflib import Utils from waflib.Logs import debug cxx_compiler = { -'win32': ['msvc', 'g++', 'clang++'], -'cygwin': ['g++', 'clang++'], -'darwin': ['clang++', 'g++'], -'aix': ['xlc++', 'g++', 'clang++'], -'linux': ['g++', 'clang++', 'icpc'], -'sunos': ['sunc++', 'g++'], -'irix': ['g++'], -'hpux': ['g++'], -'osf1V': ['g++'], -'gnu': ['g++', 'clang++'], -'java': ['g++', 'msvc', 'clang++', 'icpc'], -'default': ['clang++', 'g++'] +'win32': ['msvc', 'g++', 'clang++'], +'cygwin': ['g++', 'clang++'], +'darwin': ['clang++', 'g++'], +'aix': ['xlc++', 'g++', 'clang++'], +'linux': ['g++', 'clang++', 'icpc'], +'sunos': ['sunc++', 'g++'], +'irix': ['g++'], +'hpux': ['g++'], +'osf1V': ['g++'], +'gnu': ['g++', 'clang++'], +'java': ['g++', 'msvc', 'clang++', 'icpc'], +'gnukfreebsd': ['g++', 'clang++'], +'default': ['clang++', 'g++'] } """ Dict mapping the platform names to Waf tools finding specific C++ compilers:: diff --git a/third_party/waf/waflib/Tools/python.py b/third_party/waf/waflib/Tools/python.py index 07442561dff..fb641e5e20d 100644 --- a/third_party/waf/waflib/Tools/python.py +++ b/third_party/waf/waflib/Tools/python.py @@ -416,9 +416,14 @@ def check_python_headers(conf, features='pyembed pyext'): if not result: path = [os.path.join(dct['prefix'], "libs")] - conf.to_log("\n\n# try again with -L$prefix/libs, and pythonXY name rather than pythonX.Y (win32)\n") + conf.to_log("\n\n# try again with -L$prefix/libs, and pythonXY rather than pythonX.Y (win32)\n") result = conf.check(lib=name, uselib='PYEMBED', libpath=path, mandatory=False, msg='Checking for library %s in $prefix/libs' % name) + if not result: + path = [os.path.normpath(os.path.join(dct['INCLUDEPY'], '..', 'libs'))] + conf.to_log("\n\n# try again with -L$INCLUDEPY/../libs, and pythonXY rather than pythonX.Y (win32)\n") + result = conf.check(lib=name, uselib='PYEMBED', libpath=path, mandatory=False, msg='Checking for library %s in $INCLUDEPY/../libs' % name) + if result: break # do not forget to set LIBPATH_PYEMBED diff --git a/third_party/waf/waflib/Tools/qt5.py b/third_party/waf/waflib/Tools/qt5.py index 82c83e18c8a..b3e61325e50 100644 --- a/third_party/waf/waflib/Tools/qt5.py +++ b/third_party/waf/waflib/Tools/qt5.py @@ -783,8 +783,8 @@ def set_qt5_libs_to_check(self): pat = self.env.cxxstlib_PATTERN if Utils.unversioned_sys_platform() == 'darwin': pat = r"%s\.framework" - re_qt = re.compile(pat % 'Qt5?(?P<name>\\D+)' + '$') - for x in dirlst: + re_qt = re.compile(pat % 'Qt5?(?P<name>\\w+)' + '$') + for x in sorted(dirlst): m = re_qt.match(x) if m: self.qt5_vars.append("Qt5%s" % m.group('name')) diff --git a/third_party/waf/waflib/Tools/winres.py b/third_party/waf/waflib/Tools/winres.py index 9be1ed66009..73c0e95315b 100644 --- a/third_party/waf/waflib/Tools/winres.py +++ b/third_party/waf/waflib/Tools/winres.py @@ -4,10 +4,12 @@ "Process *.rc* files for C/C++: X{.rc -> [.res|.rc.o]}" +import os import re from waflib import Task from waflib.TaskGen import extension from waflib.Tools import c_preproc +from waflib import Utils @extension('.rc') def rc_file(self, node): @@ -61,6 +63,39 @@ class winrc(Task.Task): tmp.start(self.inputs[0], self.env) return (tmp.nodes, tmp.names) + def exec_command(self, cmd, **kw): + if self.env.WINRC_TGT_F == '/fo': + # Since winres include paths may contain spaces, they do not fit in + # response files and are best passed as environment variables + replace_cmd = [] + incpaths = [] + while cmd: + # filter include path flags + flag = cmd.pop(0) + if flag.upper().startswith('/I'): + if len(flag) == 2: + incpaths.append(cmd.pop(0)) + else: + incpaths.append(flag[2:]) + else: + replace_cmd.append(flag) + cmd = replace_cmd + if incpaths: + # append to existing environment variables in INCLUDE + env = kw['env'] = dict(kw.get('env') or self.env.env or os.environ) + pre_includes = env.get('INCLUDE', '') + env['INCLUDE'] = pre_includes + os.pathsep + os.pathsep.join(incpaths) + + return super(winrc, self).exec_command(cmd, **kw) + + def quote_flag(self, flag): + if self.env.WINRC_TGT_F == '/fo': + # winres does not support quotes around flags in response files + return flag + + return super(winrc, self).quote_flag(flag) + + def configure(conf): """ Detects the programs RC or windres, depending on the C/C++ compiler in use diff --git a/third_party/waf/waflib/extras/clang_compilation_database.py b/third_party/waf/waflib/extras/clang_compilation_database.py index 17f66949376..bd29db93fd5 100644 --- a/third_party/waf/waflib/extras/clang_compilation_database.py +++ b/third_party/waf/waflib/extras/clang_compilation_database.py @@ -126,7 +126,7 @@ def patch_execute(): Invoke clangdb command before build """ if self.cmd.startswith('build'): - Scripting.run_command('clangdb') + Scripting.run_command(self.cmd.replace('build','clangdb')) old_execute_build(self) diff --git a/third_party/waf/waflib/extras/classic_runner.py b/third_party/waf/waflib/extras/classic_runner.py new file mode 100644 index 00000000000..b08c794e880 --- /dev/null +++ b/third_party/waf/waflib/extras/classic_runner.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# encoding: utf-8 +# Thomas Nagy, 2021 (ita) + +from waflib import Utils, Runner + +""" +Re-enable the classic threading system from waf 1.x + +def configure(conf): + conf.load('classic_runner') +""" + +class TaskConsumer(Utils.threading.Thread): + """ + Task consumers belong to a pool of workers + + They wait for tasks in the queue and then use ``task.process(...)`` + """ + def __init__(self, spawner): + Utils.threading.Thread.__init__(self) + """ + Obtain :py:class:`waflib.Task.TaskBase` instances from this queue. + """ + self.spawner = spawner + self.daemon = True + self.start() + + def run(self): + """ + Loop over the tasks to execute + """ + try: + self.loop() + except Exception: + pass + + def loop(self): + """ + Obtain tasks from :py:attr:`waflib.Runner.TaskConsumer.ready` and call + :py:meth:`waflib.Task.TaskBase.process`. If the object is a function, execute it. + """ + master = self.spawner.master + while 1: + if not master.stop: + try: + tsk = master.ready.get() + if tsk: + tsk.log_display(tsk.generator.bld) + master.process_task(tsk) + else: + break + finally: + master.out.put(tsk) + +class Spawner(object): + """ + Daemon thread that consumes tasks from :py:class:`waflib.Runner.Parallel` producer and + spawns a consuming thread :py:class:`waflib.Runner.Consumer` for each + :py:class:`waflib.Task.Task` instance. + """ + def __init__(self, master): + self.master = master + """:py:class:`waflib.Runner.Parallel` producer instance""" + + self.pool = [TaskConsumer(self) for i in range(master.numjobs)] + +Runner.Spawner = Spawner diff --git a/third_party/waf/waflib/extras/color_gcc.py b/third_party/waf/waflib/extras/color_gcc.py index b68c5ebf2df..09729035fec 100644 --- a/third_party/waf/waflib/extras/color_gcc.py +++ b/third_party/waf/waflib/extras/color_gcc.py @@ -19,7 +19,7 @@ class ColorGCCFormatter(Logs.formatter): func = frame.f_code.co_name if func == 'exec_command': cmd = frame.f_locals.get('cmd') - if isinstance(cmd, list) and ('gcc' in cmd[0] or 'g++' in cmd[0]): + if isinstance(cmd, list) and (len(cmd) > 0) and ('gcc' in cmd[0] or 'g++' in cmd[0]): lines = [] for line in rec.msg.splitlines(): if 'warning: ' in line: diff --git a/third_party/waf/waflib/extras/eclipse.py b/third_party/waf/waflib/extras/eclipse.py index bb787416e9f..49ca9686b7b 100644 --- a/third_party/waf/waflib/extras/eclipse.py +++ b/third_party/waf/waflib/extras/eclipse.py @@ -10,6 +10,9 @@ Usage: def options(opt): opt.load('eclipse') +To add additional targets beside standard ones (configure, dist, install, check) +the environment ECLIPSE_EXTRA_TARGETS can be set (ie. to ['test', 'lint', 'docs']) + $ waf configure eclipse """ @@ -25,6 +28,8 @@ cdt_core = oe_cdt + '.core' cdt_bld = oe_cdt + '.build.core' extbuilder_dir = '.externalToolBuilders' extbuilder_name = 'Waf_Builder.launch' +settings_dir = '.settings' +settings_name = 'language.settings.xml' class eclipse(Build.BuildContext): cmd = 'eclipse' @@ -131,9 +136,11 @@ class eclipse(Build.BuildContext): path = p.path_from(self.srcnode) if (path.startswith("/")): - cpppath.append(path) + if path not in cpppath: + cpppath.append(path) else: - workspace_includes.append(path) + if path not in workspace_includes: + workspace_includes.append(path) if is_cc and path not in source_dirs: source_dirs.append(path) @@ -156,6 +163,61 @@ class eclipse(Build.BuildContext): project = self.impl_create_javaproject(javasrcpath, javalibpath) self.write_conf_to_xml('.classpath', project) + # Create editor language settings to have correct standards applied in IDE, as per project configuration + try: + os.mkdir(settings_dir) + except OSError: + pass # Ignore if dir already exists + + lang_settings = Document() + project = lang_settings.createElement('project') + + # Language configurations for C and C++ via cdt + if hasc: + configuration = self.add(lang_settings, project, 'configuration', + {'id' : 'org.eclipse.cdt.core.default.config.1', 'name': 'Default'}) + + extension = self.add(lang_settings, configuration, 'extension', {'point': 'org.eclipse.cdt.core.LanguageSettingsProvider'}) + + provider = self.add(lang_settings, extension, 'provider', + { 'copy-of': 'extension', + 'id': 'org.eclipse.cdt.ui.UserLanguageSettingsProvider'}) + + provider = self.add(lang_settings, extension, 'provider-reference', + { 'id': 'org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider', + 'ref': 'shared-provider'}) + + provider = self.add(lang_settings, extension, 'provider-reference', + { 'id': 'org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider', + 'ref': 'shared-provider'}) + + # C and C++ are kept as separated providers so appropriate flags are used also in mixed projects + if self.env.CC: + provider = self.add(lang_settings, extension, 'provider', + { 'class': 'org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector', + 'console': 'false', + 'id': 'org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector.1', + 'keep-relative-paths' : 'false', + 'name': 'CDT GCC Built-in Compiler Settings', + 'parameter': '%s %s ${FLAGS} -E -P -v -dD "${INPUTS}"'%(self.env.CC[0],' '.join(self.env['CFLAGS'])), + 'prefer-non-shared': 'true' }) + + self.add(lang_settings, provider, 'language-scope', { 'id': 'org.eclipse.cdt.core.gcc'}) + + if self.env.CXX: + provider = self.add(lang_settings, extension, 'provider', + { 'class': 'org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector', + 'console': 'false', + 'id': 'org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector.2', + 'keep-relative-paths' : 'false', + 'name': 'CDT GCC Built-in Compiler Settings', + 'parameter': '%s %s ${FLAGS} -E -P -v -dD "${INPUTS}"'%(self.env.CXX[0],' '.join(self.env['CXXFLAGS'])), -- Samba Shared Repository