From 697e33ed224b539a42ff68121f7497f5bbf941b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 14 Jul 2019 08:35:24 +0200 Subject: New upstream version 3.0.5 --- src/engine/SCons/Action.py | 27 +- src/engine/SCons/Action.xml | 2 +- src/engine/SCons/ActionTests.py | 572 +++++++----- src/engine/SCons/Builder.py | 18 +- src/engine/SCons/BuilderTests.py | 20 +- src/engine/SCons/CacheDir.py | 17 +- src/engine/SCons/CacheDirTests.py | 16 +- src/engine/SCons/Conftest.py | 20 +- src/engine/SCons/Debug.py | 4 +- src/engine/SCons/Defaults.py | 14 +- src/engine/SCons/Defaults.xml | 32 +- src/engine/SCons/DefaultsTests.py | 13 +- src/engine/SCons/Environment.py | 15 +- src/engine/SCons/Environment.xml | 4 +- src/engine/SCons/EnvironmentTests.py | 24 +- src/engine/SCons/EnvironmentValues.py | 1 + src/engine/SCons/Errors.py | 25 +- src/engine/SCons/ErrorsTests.py | 34 +- src/engine/SCons/Executor.py | 6 +- src/engine/SCons/ExecutorTests.py | 13 +- src/engine/SCons/Job.py | 6 +- src/engine/SCons/JobTests.py | 130 ++- src/engine/SCons/Memoize.py | 4 +- src/engine/SCons/MemoizeTests.py | 16 +- src/engine/SCons/Node/Alias.py | 4 +- src/engine/SCons/Node/AliasTests.py | 17 +- src/engine/SCons/Node/FS.py | 325 ++++++- src/engine/SCons/Node/FSTests.py | 185 +++- src/engine/SCons/Node/NodeTests.py | 21 +- src/engine/SCons/Node/Python.py | 17 +- src/engine/SCons/Node/PythonTests.py | 23 +- src/engine/SCons/Node/__init__.py | 81 +- src/engine/SCons/Options/BoolOption.py | 50 -- src/engine/SCons/Options/EnumOption.py | 50 -- src/engine/SCons/Options/ListOption.py | 50 -- src/engine/SCons/Options/PackageOption.py | 50 -- src/engine/SCons/Options/PathOption.py | 76 -- src/engine/SCons/Options/__init__.py | 67 -- src/engine/SCons/PathList.py | 4 +- src/engine/SCons/PathListTests.py | 4 +- src/engine/SCons/Platform/PlatformTests.py | 25 +- src/engine/SCons/Platform/__init__.py | 64 +- src/engine/SCons/Platform/__init__.xml | 26 +- src/engine/SCons/Platform/aix.py | 4 +- src/engine/SCons/Platform/cygwin.py | 13 +- src/engine/SCons/Platform/darwin.py | 4 +- src/engine/SCons/Platform/hpux.py | 4 +- src/engine/SCons/Platform/irix.py | 4 +- src/engine/SCons/Platform/mingw.py | 39 + src/engine/SCons/Platform/os2.py | 4 +- src/engine/SCons/Platform/posix.py | 11 +- src/engine/SCons/Platform/posix.xml | 6 +- src/engine/SCons/Platform/sunos.py | 4 +- src/engine/SCons/Platform/sunos.xml | 2 +- src/engine/SCons/Platform/virtualenv.py | 120 +++ src/engine/SCons/Platform/virtualenvTests.py | 243 ++++++ src/engine/SCons/Platform/win32.py | 35 +- src/engine/SCons/Platform/win32.xml | 2 +- src/engine/SCons/SConf.py | 84 +- src/engine/SCons/SConfTests.py | 34 +- src/engine/SCons/SConsign.py | 7 +- src/engine/SCons/SConsignTests.py | 4 +- src/engine/SCons/Scanner/C.py | 4 +- src/engine/SCons/Scanner/CTests.py | 20 +- src/engine/SCons/Scanner/D.py | 4 +- src/engine/SCons/Scanner/DTests.py | 16 +- src/engine/SCons/Scanner/Dir.py | 4 +- src/engine/SCons/Scanner/DirTests.py | 13 +- src/engine/SCons/Scanner/Fortran.py | 6 +- src/engine/SCons/Scanner/FortranTests.py | 6 +- src/engine/SCons/Scanner/IDL.py | 4 +- src/engine/SCons/Scanner/IDLTests.py | 12 +- src/engine/SCons/Scanner/LaTeX.py | 20 +- src/engine/SCons/Scanner/LaTeXTests.py | 23 +- src/engine/SCons/Scanner/Prog.py | 4 +- src/engine/SCons/Scanner/ProgTests.py | 7 +- src/engine/SCons/Scanner/RC.py | 4 +- src/engine/SCons/Scanner/RCTests.py | 9 +- src/engine/SCons/Scanner/SWIG.py | 4 +- src/engine/SCons/Scanner/ScannerTests.py | 62 +- src/engine/SCons/Scanner/__init__.py | 4 +- src/engine/SCons/Scanner/__init__.xml | 2 +- src/engine/SCons/Script/Interactive.py | 4 +- src/engine/SCons/Script/Main.py | 25 +- src/engine/SCons/Script/Main.xml | 2 +- src/engine/SCons/Script/MainTests.py | 13 +- src/engine/SCons/Script/SConsOptions.py | 18 +- src/engine/SCons/Script/SConscript.py | 83 +- src/engine/SCons/Script/SConscript.xml | 25 +- src/engine/SCons/Script/SConscriptTests.py | 4 +- src/engine/SCons/Script/__init__.py | 27 +- src/engine/SCons/Subst.py | 24 +- src/engine/SCons/Subst.xml | 2 +- src/engine/SCons/SubstTests.py | 26 +- src/engine/SCons/Taskmaster.py | 13 +- src/engine/SCons/TaskmasterTests.py | 9 +- src/engine/SCons/Tool/386asm.py | 4 +- src/engine/SCons/Tool/386asm.xml | 2 +- src/engine/SCons/Tool/DCommon.py | 4 +- src/engine/SCons/Tool/DCommon.xml | 2 +- src/engine/SCons/Tool/FortranCommon.py | 4 +- src/engine/SCons/Tool/GettextCommon.py | 12 +- src/engine/SCons/Tool/JavaCommon.py | 192 +++- src/engine/SCons/Tool/JavaCommonTests.py | 56 +- src/engine/SCons/Tool/MSCommon/__init__.py | 4 +- src/engine/SCons/Tool/MSCommon/arch.py | 12 +- src/engine/SCons/Tool/MSCommon/common.py | 14 +- src/engine/SCons/Tool/MSCommon/netframework.py | 4 +- src/engine/SCons/Tool/MSCommon/sdk.py | 14 +- src/engine/SCons/Tool/MSCommon/vc.py | 328 +++++-- src/engine/SCons/Tool/MSCommon/vs.py | 19 +- src/engine/SCons/Tool/PharLapCommon.py | 4 +- src/engine/SCons/Tool/ToolTests.py | 4 +- src/engine/SCons/Tool/__init__.py | 535 +++++++----- src/engine/SCons/Tool/__init__.xml | 2 +- src/engine/SCons/Tool/aixc++.py | 4 +- src/engine/SCons/Tool/aixc++.xml | 2 +- src/engine/SCons/Tool/aixcc.py | 4 +- src/engine/SCons/Tool/aixcc.xml | 2 +- src/engine/SCons/Tool/aixcxx.py | 4 +- src/engine/SCons/Tool/aixf77.py | 4 +- src/engine/SCons/Tool/aixf77.xml | 2 +- src/engine/SCons/Tool/aixlink.py | 4 +- src/engine/SCons/Tool/aixlink.xml | 2 +- src/engine/SCons/Tool/applelink.py | 155 +++- src/engine/SCons/Tool/applelink.xml | 379 +++++--- src/engine/SCons/Tool/ar.py | 4 +- src/engine/SCons/Tool/ar.xml | 2 +- src/engine/SCons/Tool/as.py | 4 +- src/engine/SCons/Tool/as.xml | 2 +- src/engine/SCons/Tool/bcc32.py | 4 +- src/engine/SCons/Tool/bcc32.xml | 2 +- src/engine/SCons/Tool/c++.py | 4 +- src/engine/SCons/Tool/c++.xml | 2 +- src/engine/SCons/Tool/cc.py | 4 +- src/engine/SCons/Tool/cc.xml | 2 +- src/engine/SCons/Tool/clang.py | 15 +- src/engine/SCons/Tool/clang.xml | 2 +- src/engine/SCons/Tool/clangCommon/__init__.py | 17 + src/engine/SCons/Tool/clangxx.py | 17 +- src/engine/SCons/Tool/clangxx.xml | 2 +- src/engine/SCons/Tool/cvf.py | 4 +- src/engine/SCons/Tool/cvf.xml | 2 +- src/engine/SCons/Tool/cxx.py | 4 +- src/engine/SCons/Tool/cyglink.xml | 2 +- src/engine/SCons/Tool/default.py | 4 +- src/engine/SCons/Tool/default.xml | 2 +- src/engine/SCons/Tool/dmd.py | 4 +- src/engine/SCons/Tool/dmd.xml | 2 +- src/engine/SCons/Tool/docbook/__init__.py | 4 +- src/engine/SCons/Tool/docbook/__init__.xml | 2 +- src/engine/SCons/Tool/docbook/docs/manual.xml | 2 +- src/engine/SCons/Tool/dvi.py | 4 +- src/engine/SCons/Tool/dvi.xml | 2 +- src/engine/SCons/Tool/dvipdf.py | 4 +- src/engine/SCons/Tool/dvipdf.xml | 2 +- src/engine/SCons/Tool/dvips.py | 4 +- src/engine/SCons/Tool/dvips.xml | 2 +- src/engine/SCons/Tool/f03.py | 4 +- src/engine/SCons/Tool/f03.xml | 2 +- src/engine/SCons/Tool/f08.py | 4 +- src/engine/SCons/Tool/f08.xml | 2 +- src/engine/SCons/Tool/f77.py | 4 +- src/engine/SCons/Tool/f77.xml | 2 +- src/engine/SCons/Tool/f90.py | 4 +- src/engine/SCons/Tool/f90.xml | 2 +- src/engine/SCons/Tool/f95.py | 4 +- src/engine/SCons/Tool/f95.xml | 2 +- src/engine/SCons/Tool/filesystem.py | 4 +- src/engine/SCons/Tool/fortran.py | 4 +- src/engine/SCons/Tool/fortran.xml | 15 +- src/engine/SCons/Tool/g++.py | 4 +- src/engine/SCons/Tool/g++.xml | 2 +- src/engine/SCons/Tool/g77.py | 4 +- src/engine/SCons/Tool/g77.xml | 2 +- src/engine/SCons/Tool/gas.py | 4 +- src/engine/SCons/Tool/gas.xml | 2 +- src/engine/SCons/Tool/gcc.py | 51 +- src/engine/SCons/Tool/gcc.xml | 2 +- src/engine/SCons/Tool/gdc.py | 4 +- src/engine/SCons/Tool/gdc.xml | 2 +- src/engine/SCons/Tool/gettext.xml | 2 +- src/engine/SCons/Tool/gettext_tool.py | 16 +- src/engine/SCons/Tool/gfortran.py | 6 +- src/engine/SCons/Tool/gfortran.xml | 2 +- src/engine/SCons/Tool/gnulink.py | 4 +- src/engine/SCons/Tool/gnulink.xml | 2 +- src/engine/SCons/Tool/gs.py | 4 +- src/engine/SCons/Tool/gs.xml | 2 +- src/engine/SCons/Tool/gxx.py | 8 +- src/engine/SCons/Tool/hpc++.py | 4 +- src/engine/SCons/Tool/hpc++.xml | 2 +- src/engine/SCons/Tool/hpcc.py | 4 +- src/engine/SCons/Tool/hpcc.xml | 2 +- src/engine/SCons/Tool/hpcxx.py | 4 +- src/engine/SCons/Tool/hplink.py | 4 +- src/engine/SCons/Tool/hplink.xml | 2 +- src/engine/SCons/Tool/icc.py | 4 +- src/engine/SCons/Tool/icc.xml | 2 +- src/engine/SCons/Tool/icl.py | 4 +- src/engine/SCons/Tool/icl.xml | 2 +- src/engine/SCons/Tool/ifl.py | 4 +- src/engine/SCons/Tool/ifl.xml | 2 +- src/engine/SCons/Tool/ifort.py | 4 +- src/engine/SCons/Tool/ifort.xml | 2 +- src/engine/SCons/Tool/ilink.py | 4 +- src/engine/SCons/Tool/ilink.xml | 2 +- src/engine/SCons/Tool/ilink32.py | 4 +- src/engine/SCons/Tool/ilink32.xml | 2 +- src/engine/SCons/Tool/install.py | 4 +- src/engine/SCons/Tool/install.xml | 2 +- src/engine/SCons/Tool/intelc.py | 6 +- src/engine/SCons/Tool/intelc.xml | 2 +- src/engine/SCons/Tool/ipkg.py | 4 +- src/engine/SCons/Tool/jar.py | 135 ++- src/engine/SCons/Tool/jar.xml | 2 +- src/engine/SCons/Tool/javac.py | 24 +- src/engine/SCons/Tool/javac.xml | 515 +++++------ src/engine/SCons/Tool/javacTests.py | 11 +- src/engine/SCons/Tool/javah.py | 14 +- src/engine/SCons/Tool/javah.xml | 2 +- src/engine/SCons/Tool/latex.py | 4 +- src/engine/SCons/Tool/latex.xml | 2 +- src/engine/SCons/Tool/ldc.py | 4 +- src/engine/SCons/Tool/ldc.xml | 2 +- src/engine/SCons/Tool/lex.py | 48 +- src/engine/SCons/Tool/lex.xml | 11 +- src/engine/SCons/Tool/link.py | 185 ++-- src/engine/SCons/Tool/link.xml | 2 +- src/engine/SCons/Tool/linkloc.py | 4 +- src/engine/SCons/Tool/linkloc.xml | 2 +- src/engine/SCons/Tool/m4.py | 4 +- src/engine/SCons/Tool/m4.xml | 2 +- src/engine/SCons/Tool/masm.py | 4 +- src/engine/SCons/Tool/masm.xml | 2 +- src/engine/SCons/Tool/midl.py | 6 +- src/engine/SCons/Tool/midl.xml | 2 +- src/engine/SCons/Tool/mingw.py | 132 +-- src/engine/SCons/Tool/mingw.xml | 2 +- src/engine/SCons/Tool/msgfmt.py | 18 +- src/engine/SCons/Tool/msgfmt.xml | 2 +- src/engine/SCons/Tool/msginit.py | 18 +- src/engine/SCons/Tool/msginit.xml | 2 +- src/engine/SCons/Tool/msgmerge.py | 19 +- src/engine/SCons/Tool/msgmerge.xml | 2 +- src/engine/SCons/Tool/mslib.py | 6 +- src/engine/SCons/Tool/mslib.xml | 2 +- src/engine/SCons/Tool/mslink.py | 6 +- src/engine/SCons/Tool/mslink.xml | 2 +- src/engine/SCons/Tool/mssdk.py | 4 +- src/engine/SCons/Tool/mssdk.xml | 2 +- src/engine/SCons/Tool/msvc.py | 19 +- src/engine/SCons/Tool/msvc.xml | 14 +- src/engine/SCons/Tool/msvs.py | 40 +- src/engine/SCons/Tool/msvs.xml | 968 ++++++++++++--------- src/engine/SCons/Tool/msvsTests.py | 13 +- src/engine/SCons/Tool/mwcc.py | 4 +- src/engine/SCons/Tool/mwcc.xml | 2 +- src/engine/SCons/Tool/mwld.py | 4 +- src/engine/SCons/Tool/mwld.xml | 2 +- src/engine/SCons/Tool/nasm.py | 4 +- src/engine/SCons/Tool/nasm.xml | 2 +- src/engine/SCons/Tool/packaging.xml | 2 +- src/engine/SCons/Tool/packaging/__init__.py | 41 +- src/engine/SCons/Tool/packaging/__init__.xml | 61 +- src/engine/SCons/Tool/packaging/ipk.py | 12 +- src/engine/SCons/Tool/packaging/msi.py | 15 +- src/engine/SCons/Tool/packaging/rpm.py | 57 +- src/engine/SCons/Tool/packaging/src_tarbz2.py | 6 +- src/engine/SCons/Tool/packaging/src_targz.py | 6 +- src/engine/SCons/Tool/packaging/src_tarxz.py | 43 + src/engine/SCons/Tool/packaging/src_zip.py | 4 +- src/engine/SCons/Tool/packaging/tarbz2.py | 8 +- src/engine/SCons/Tool/packaging/targz.py | 6 +- src/engine/SCons/Tool/packaging/tarxz.py | 44 + src/engine/SCons/Tool/packaging/zip.py | 4 +- src/engine/SCons/Tool/pdf.py | 4 +- src/engine/SCons/Tool/pdf.xml | 2 +- src/engine/SCons/Tool/pdflatex.py | 4 +- src/engine/SCons/Tool/pdflatex.xml | 2 +- src/engine/SCons/Tool/pdftex.py | 4 +- src/engine/SCons/Tool/pdftex.xml | 2 +- src/engine/SCons/Tool/qt.py | 43 +- src/engine/SCons/Tool/qt.xml | 2 +- src/engine/SCons/Tool/rmic.py | 19 +- src/engine/SCons/Tool/rmic.xml | 2 +- src/engine/SCons/Tool/rpcgen.py | 6 +- src/engine/SCons/Tool/rpcgen.xml | 2 +- src/engine/SCons/Tool/rpm.py | 4 +- src/engine/SCons/Tool/rpmutils.py | 4 +- src/engine/SCons/Tool/sgiar.py | 4 +- src/engine/SCons/Tool/sgiar.xml | 2 +- src/engine/SCons/Tool/sgic++.py | 4 +- src/engine/SCons/Tool/sgic++.xml | 2 +- src/engine/SCons/Tool/sgicc.py | 4 +- src/engine/SCons/Tool/sgicc.xml | 2 +- src/engine/SCons/Tool/sgicxx.py | 4 +- src/engine/SCons/Tool/sgilink.py | 4 +- src/engine/SCons/Tool/sgilink.xml | 2 +- src/engine/SCons/Tool/sunar.py | 4 +- src/engine/SCons/Tool/sunar.xml | 2 +- src/engine/SCons/Tool/sunc++.py | 4 +- src/engine/SCons/Tool/sunc++.xml | 2 +- src/engine/SCons/Tool/suncc.py | 4 +- src/engine/SCons/Tool/suncc.xml | 2 +- src/engine/SCons/Tool/suncxx.py | 4 +- src/engine/SCons/Tool/sunf77.py | 4 +- src/engine/SCons/Tool/sunf77.xml | 2 +- src/engine/SCons/Tool/sunf90.py | 4 +- src/engine/SCons/Tool/sunf90.xml | 2 +- src/engine/SCons/Tool/sunf95.py | 4 +- src/engine/SCons/Tool/sunf95.xml | 2 +- src/engine/SCons/Tool/sunlink.py | 4 +- src/engine/SCons/Tool/sunlink.xml | 2 +- src/engine/SCons/Tool/swig.py | 42 +- src/engine/SCons/Tool/swig.xml | 9 +- src/engine/SCons/Tool/tar.py | 4 +- src/engine/SCons/Tool/tar.xml | 2 +- src/engine/SCons/Tool/tex.py | 32 +- src/engine/SCons/Tool/tex.xml | 2 +- src/engine/SCons/Tool/textfile.py | 4 +- src/engine/SCons/Tool/textfile.xml | 6 +- src/engine/SCons/Tool/tlib.py | 4 +- src/engine/SCons/Tool/tlib.xml | 2 +- src/engine/SCons/Tool/wix.py | 4 +- src/engine/SCons/Tool/wixTests.py | 8 +- src/engine/SCons/Tool/xgettext.py | 18 +- src/engine/SCons/Tool/xgettext.xml | 2 +- src/engine/SCons/Tool/yacc.py | 45 +- src/engine/SCons/Tool/yacc.xml | 2 +- src/engine/SCons/Tool/zip.py | 4 +- src/engine/SCons/Tool/zip.xml | 2 +- src/engine/SCons/Util.py | 170 ++-- src/engine/SCons/UtilTests.py | 321 +++++-- src/engine/SCons/Variables/BoolVariable.py | 4 +- src/engine/SCons/Variables/BoolVariableTests.py | 9 +- src/engine/SCons/Variables/EnumVariable.py | 4 +- src/engine/SCons/Variables/EnumVariableTests.py | 9 +- src/engine/SCons/Variables/ListVariable.py | 4 +- src/engine/SCons/Variables/ListVariableTests.py | 9 +- src/engine/SCons/Variables/PackageVariable.py | 4 +- src/engine/SCons/Variables/PackageVariableTests.py | 9 +- src/engine/SCons/Variables/PathVariable.py | 4 +- src/engine/SCons/Variables/PathVariableTests.py | 9 +- src/engine/SCons/Variables/VariablesTests.py | 44 +- src/engine/SCons/Variables/__init__.py | 11 +- src/engine/SCons/Warnings.py | 17 +- src/engine/SCons/WarningsTests.py | 9 +- src/engine/SCons/__init__.py | 12 +- src/engine/SCons/compat/__init__.py | 6 +- src/engine/SCons/compat/_scons_dbm.py | 4 +- src/engine/SCons/cpp.py | 41 +- src/engine/SCons/cppTests.py | 145 ++- src/engine/SCons/dblite.py | 16 +- src/engine/SCons/exitfuncs.py | 4 +- 355 files changed, 5976 insertions(+), 3302 deletions(-) delete mode 100644 src/engine/SCons/Options/BoolOption.py delete mode 100644 src/engine/SCons/Options/EnumOption.py delete mode 100644 src/engine/SCons/Options/ListOption.py delete mode 100644 src/engine/SCons/Options/PackageOption.py delete mode 100644 src/engine/SCons/Options/PathOption.py delete mode 100644 src/engine/SCons/Options/__init__.py create mode 100644 src/engine/SCons/Platform/mingw.py create mode 100644 src/engine/SCons/Platform/virtualenv.py create mode 100644 src/engine/SCons/Platform/virtualenvTests.py create mode 100644 src/engine/SCons/Tool/clangCommon/__init__.py create mode 100644 src/engine/SCons/Tool/packaging/src_tarxz.py create mode 100644 src/engine/SCons/Tool/packaging/tarxz.py (limited to 'src/engine/SCons') diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index 97040a4..f1ca2cf 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -77,7 +77,7 @@ way for wrapping up the functions. """ -# Copyright (c) 2001 - 2017 The SCons Foundation +# Copyright (c) 2001 - 2019 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -98,7 +98,7 @@ way for wrapping up the functions. # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -__revision__ = "src/engine/SCons/Action.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" +__revision__ = "src/engine/SCons/Action.py 103260fce95bf5db1c35fb2371983087d85dd611 2019-07-13 18:25:30 bdbaddog" import os import pickle @@ -107,6 +107,7 @@ import sys import subprocess import itertools import inspect +from collections import OrderedDict import SCons.Debug from SCons.Debug import logInstanceCreation @@ -115,8 +116,7 @@ import SCons.Util import SCons.Subst # we use these a lot, so try to optimize them -is_String = SCons.Util.is_String -is_List = SCons.Util.is_List +from SCons.Util import is_String, is_List class _null(object): pass @@ -258,8 +258,7 @@ def _code_contents(code, docstring=None): # function. Note that we have to call _object_contents on each # constants because the code object of nested functions can # show-up among the constants. - - z = [_object_contents(cc) for cc in code.co_consts[1:]] + z = [_object_contents(cc) for cc in code.co_consts if cc != docstring] contents.extend(b',(') contents.extend(bytearray(',', 'utf-8').join(z)) contents.extend(b')') @@ -803,7 +802,7 @@ def _subproc(scons_env, cmd, error = 'ignore', **kw): kw['env'] = new_env try: - return subprocess.Popen(cmd, **kw) + pobj = subprocess.Popen(cmd, **kw) except EnvironmentError as e: if error == 'raise': raise # return a dummy Popen instance that only returns error @@ -817,7 +816,13 @@ def _subproc(scons_env, cmd, error = 'ignore', **kw): def readline(self): return '' def __iter__(self): return iter(()) stdout = stderr = f() - return dummyPopen(e) + pobj = dummyPopen(e) + finally: + # clean up open file handles stored in parent's kw + for k, v in kw.items(): + if hasattr(v, 'close'): + v.close() + return pobj class CommandAction(_ActionAction): @@ -837,8 +842,8 @@ class CommandAction(_ActionAction): _ActionAction.__init__(self, **kw) if is_List(cmd): if [c for c in cmd if is_List(c)]: - raise TypeError("CommandAction should be given only " \ - "a single command") + raise TypeError("CommandAction should be given only " + "a single command") self.cmd_list = cmd def __str__(self): @@ -1289,7 +1294,7 @@ class ListAction(ActionBase): return result def get_varlist(self, target, source, env, executor=None): - result = SCons.Util.OrderedDict() + result = OrderedDict() for act in self.list: for var in act.get_varlist(target, source, env, executor): result[var] = True diff --git a/src/engine/SCons/Action.xml b/src/engine/SCons/Action.xml index 99f4e86..9cb186c 100644 --- a/src/engine/SCons/Action.xml +++ b/src/engine/SCons/Action.xml @@ -1,6 +1,6 @@ %s"%df) + if df: + return df + + if not df: + try: + # this should yield a path which matches what's in the sconsign + c_str = self.get_path() + df = dmap.get(c_str, None) + if MD5_TIMESTAMP_DEBUG: print("-->%s"%df) + if df: + return df + + if os.altsep: + c_str = c_str.replace(os.sep, os.altsep) + df = dmap.get(c_str, None) + if MD5_TIMESTAMP_DEBUG: print("-->%s"%df) + if df: + return df + + except AttributeError as e: + raise FileBuildInfoFileToCsigMappingError("No mapping from file name to content signature for :%s"%c_str) + + return df + + def changed_timestamp_then_content(self, target, prev_ni, node=None): + """ + Used when decider for file is Timestamp-MD5 + + NOTE: If the timestamp hasn't changed this will skip md5'ing the + file and just copy the prev_ni provided. If the prev_ni + is wrong. It will propagate it. + See: https://github.com/SCons/scons/issues/2980 + + Args: + self - dependency + target - target + prev_ni - The NodeInfo object loaded from previous builds .sconsign + node - Node instance. This is the only changed* function which requires + node to function. So if we detect that it's not passed. + we throw DeciderNeedsNode, and caller should handle this and pass node. + + Returns: + Boolean - Indicates if node(File) has changed. + """ + if node is None: + # We need required node argument to get BuildInfo to function + raise DeciderNeedsNode(self.changed_timestamp_then_content) + + # Now get sconsign name -> csig map and then get proper prev_ni if possible + bi = node.get_stored_info().binfo + rebuilt = False + try: + dependency_map = bi.dependency_map + except AttributeError as e: + dependency_map = self._build_dependency_map(bi) + rebuilt = True + + if len(dependency_map) == 0: + # If there's no dependency map, there's no need to find the + # prev_ni as there aren't any + # shortcut the rest of the logic + if MD5_TIMESTAMP_DEBUG: print("Skipping checks len(dmap)=0") + + # We still need to get the current file's csig + # This should be slightly faster than calling self.changed_content(target, new_prev_ni) + self.get_csig() + return True + + new_prev_ni = self._get_previous_signatures(dependency_map) + new = self.changed_timestamp_match(target, new_prev_ni) + + if MD5_TIMESTAMP_DEBUG: + old = self.changed_timestamp_match(target, prev_ni) + + if old != new: + print("Mismatch self.changed_timestamp_match(%s, prev_ni) old:%s new:%s"%(str(target), old, new)) + new_prev_ni = self._get_previous_signatures(dependency_map) + + + if not new: try: - self.get_ninfo().csig = prev_ni.csig + # NOTE: We're modifying the current node's csig in a query. + self.get_ninfo().csig = new_prev_ni.csig except AttributeError: pass return False - return self.changed_content(target, prev_ni) + return self.changed_content(target, new_prev_ni) def changed_timestamp_newer(self, target, prev_ni): try: @@ -3251,6 +3450,12 @@ class File(Base): return 1 def changed_timestamp_match(self, target, prev_ni): + """ + Return True if the timestamps don't match or if there is no previous timestamp + :param target: + :param prev_ni: Information about the node from the previous build + :return: + """ try: return self.get_timestamp() != prev_ni.timestamp except AttributeError: @@ -3272,7 +3477,9 @@ class File(Base): # ...and they'd like a local copy. e = LocalCopy(self, r, None) if isinstance(e, SCons.Errors.BuildError): - raise + # Likely this should be re-raising exception e + # (which would be BuildError) + raise e SCons.Node.store_info_map[self.store_info](self) if T: Trace(' 1\n') return 1 @@ -3293,11 +3500,14 @@ class File(Base): result = self if not self.exists(): norm_name = _my_normcase(self.name) - for dir in self.dir.get_all_rdirs(): - try: node = dir.entries[norm_name] - except KeyError: node = dir.file_on_disk(self.name) + for repo_dir in self.dir.get_all_rdirs(): + try: + node = repo_dir.entries[norm_name] + except KeyError: + node = repo_dir.file_on_disk(self.name) + if node and node.exists() and \ - (isinstance(node, File) or isinstance(node, Entry) \ + (isinstance(node, File) or isinstance(node, Entry) or not node.is_derived()): result = node # Copy over our local attributes to the repository @@ -3317,6 +3527,28 @@ class File(Base): self._memo['rfile'] = result return result + def find_repo_file(self): + """ + For this node, find if there exists a corresponding file in one or more repositories + :return: list of corresponding files in repositories + """ + retvals = [] + + norm_name = _my_normcase(self.name) + for repo_dir in self.dir.get_all_rdirs(): + try: + node = repo_dir.entries[norm_name] + except KeyError: + node = repo_dir.file_on_disk(self.name) + + if node and node.exists() and \ + (isinstance(node, File) or isinstance(node, Entry) \ + or not node.is_derived()): + retvals.append(node) + + return retvals + + def rstr(self): return str(self.rfile()) @@ -3374,6 +3606,8 @@ class File(Base): because multiple targets built by the same action will all have the same build signature, and we have to differentiate them somehow. + + Signature should normally be string of hex digits. """ try: return self.cachesig @@ -3383,10 +3617,13 @@ class File(Base): # Collect signatures for all children children = self.children() sigs = [n.get_cachedir_csig() for n in children] + # Append this node's signature... sigs.append(self.get_contents_sig()) + # ...and it's path sigs.append(self.get_internal_path()) + # Merge this all into a single signature result = self.cachesig = SCons.Util.MD5collect(sigs) return result diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index 3a36894..021d433 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001 - 2017 The SCons Foundation +# Copyright (c) 2001 - 2019 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -22,7 +22,7 @@ # from __future__ import division, print_function -__revision__ = "src/engine/SCons/Node/FSTests.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" +__revision__ = "src/engine/SCons/Node/FSTests.py 103260fce95bf5db1c35fb2371983087d85dd611 2019-07-13 18:25:30 bdbaddog" import SCons.compat @@ -41,6 +41,7 @@ import SCons.Errors import SCons.Node.FS import SCons.Util import SCons.Warnings +import SCons.Environment built_it = None @@ -605,7 +606,7 @@ class VariantDirTestCase(unittest.TestCase): print("File `%s' alter_targets() `%s' != expected `%s'" % (f, tp, expect)) errors = errors + 1 - self.failIf(errors) + self.assertFalse(errors) class BaseTestCase(_tempdirTestCase): def test_stat(self): @@ -1133,7 +1134,10 @@ class FSTestCase(_tempdirTestCase): e1 = fs.Entry(p) e2 = fs.Entry(path) assert e1 is e2, (e1, e2) - assert str(e1) is str(e2), (str(e1), str(e2)) + a=str(e1) + b=str(e2) + assert a == b, ("Strings should match for same file/node\n%s\n%s"%(a,b)) + # Test for a bug in 0.04 that did not like looking up # dirs with a trailing slash on Windows. @@ -1657,7 +1661,12 @@ class FSTestCase(_tempdirTestCase): import ntpath x = test.workpath(*dirs) drive, path = ntpath.splitdrive(x) - unc, path = ntpath.splitunc(path) + try: + unc, path = ntpath.splitunc(path) + except AttributeError: + # could be python 3.7 or newer, make sure splitdrive can do UNC + assert ntpath.splitdrive(r'\\split\drive\test')[0] == r'\\split\drive' + pass path = strip_slash(path) return '//' + path[1:] @@ -2455,6 +2464,139 @@ class FileTestCase(_tempdirTestCase): assert not build_f1.exists(), "%s did not realize that %s disappeared" % (build_f1, src_f1) assert not os.path.exists(build_f1.get_abspath()), "%s did not get removed after %s was removed" % (build_f1, src_f1) + def test_changed(self): + """ + Verify that changes between BuildInfo's list of souces, depends, and implicit + dependencies do not corrupt content signature values written to .SConsign + when using CacheDir and Timestamp-MD5 decider. + This is for issue #2980 + """ + # node should have + # 1 source (for example main.cpp) + # 0 depends + # N implicits (for example ['alpha.h', 'beta.h', 'gamma.h', '/usr/bin/g++']) + + class ChangedNode(SCons.Node.FS.File): + def __init__(self, name, directory=None, fs=None): + SCons.Node.FS.File.__init__(self, name, directory, fs) + self.name = name + self.Tag('found_includes', []) + self.stored_info = None + self.build_env = None + self.changed_since_last_build = 4 + self.timestamp = 1 + + def get_stored_info(self): + return self.stored_info + + def get_build_env(self): + return self.build_env + + def get_timestamp(self): + """ Fake timestamp so they always match""" + return self.timestamp + + def get_contents(self): + return self.name + + def get_ninfo(self): + """ mocked to ensure csig will equal the filename""" + try: + return self.ninfo + except AttributeError: + self.ninfo = FakeNodeInfo(self.name, self.timestamp) + return self.ninfo + + def get_csig(self): + ninfo = self.get_ninfo() + try: + return ninfo.csig + except AttributeError: + pass + + return "Should Never Happen" + + class ChangedEnvironment(SCons.Environment.Base): + + def __init__(self): + SCons.Environment.Base.__init__(self) + self.decide_source = self._changed_timestamp_then_content + + class FakeNodeInfo(object): + def __init__(self, csig, timestamp): + self.csig = csig + self.timestamp = timestamp + + #Create nodes + fs = SCons.Node.FS.FS() + d = self.fs.Dir('.') + + node = ChangedNode('main.o',d,fs) # main.o + s1 = ChangedNode('main.cpp',d,fs) # main.cpp + s1.timestamp = 2 # this changed + i1 = ChangedNode('alpha.h',d,fs) # alpha.h - The bug is caused because the second build adds this file + i1.timestamp = 2 # This is the new file. + i2 = ChangedNode('beta.h',d,fs) # beta.h + i3 = ChangedNode('gamma.h',d,fs) # gamma.h - In the bug beta.h's csig from binfo overwrites this ones + i4 = ChangedNode('/usr/bin/g++',d,fs) # /usr/bin/g++ + + node.add_source([s1]) + node.add_dependency([]) + node.implicit = [i1, i2, i3, i4] + node.implicit_set = set() + # node._add_child(node.implicit, node.implicit_set, [n7, n8, n9]) + # node._add_child(node.implicit, node.implicit_set, [n10, n11, n12]) + + # Mock out node's scan method + # node.scan = lambda *args: None + + # Mock out nodes' children() ? + # Should return Node's. + # All those nodes should have changed_since_last_build set to match Timestamp-MD5's + # decider method... + + # Generate sconsign entry needed + sconsign_entry = SCons.SConsign.SConsignEntry() + sconsign_entry.binfo = node.new_binfo() + sconsign_entry.ninfo = node.new_ninfo() + + # mock out loading info from sconsign + # This will cause node.get_stored_info() to return our freshly created sconsign_entry + node.stored_info = sconsign_entry + + # binfo = information from previous build (from sconsign) + # We'll set the following attributes (which are lists): "bsources", "bsourcesigs", + # "bdepends","bdependsigs", "bimplicit", "bimplicitsigs" + bi = sconsign_entry.binfo + bi.bsources = ['main.cpp'] + bi.bsourcesigs=[FakeNodeInfo('main.cpp',1),] + + bi.bdepends = [] + bi.bdependsigs = [] + + bi.bimplicit = ['beta.h','gamma.h'] + bi.bimplicitsigs = [FakeNodeInfo('beta.h',1), FakeNodeInfo('gamma.h',1)] + + ni = sconsign_entry.ninfo + # We'll set the following attributes (which are lists): sources, depends, implicit lists + + #Set timestamp-md5 + #Call changed + #Check results + node.build_env = ChangedEnvironment() + + changed = node.changed() + + # change to true to debug + if False: + print("Changed:%s"%changed) + print("%15s -> csig:%s"%(s1.name, s1.ninfo.csig)) + print("%15s -> csig:%s"%(i1.name, i1.ninfo.csig)) + print("%15s -> csig:%s"%(i2.name, i2.ninfo.csig)) + print("%15s -> csig:%s"%(i3.name, i3.ninfo.csig)) + print("%15s -> csig:%s"%(i4.name, i4.ninfo.csig)) + + self.assertEqual(i2.name,i2.ninfo.csig, "gamma.h's fake csig should equal gamma.h but equals:%s"%i2.ninfo.csig) class GlobTestCase(_tempdirTestCase): @@ -3747,38 +3889,7 @@ class AbsolutePathTestCase(unittest.TestCase): if __name__ == "__main__": - suite = unittest.TestSuite() - suite.addTest(VariantDirTestCase()) - suite.addTest(find_fileTestCase()) - suite.addTest(StringDirTestCase()) - suite.addTest(stored_infoTestCase()) - suite.addTest(has_src_builderTestCase()) - suite.addTest(prepareTestCase()) - suite.addTest(SConstruct_dirTestCase()) - suite.addTest(clearTestCase()) - suite.addTest(disambiguateTestCase()) - suite.addTest(postprocessTestCase()) - suite.addTest(SpecialAttrTestCase()) - suite.addTest(SaveStringsTestCase()) - tclasses = [ - AbsolutePathTestCase, - BaseTestCase, - CacheDirTestCase, - DirTestCase, - DirBuildInfoTestCase, - DirNodeInfoTestCase, - EntryTestCase, - FileTestCase, - FileBuildInfoTestCase, - FileNodeInfoTestCase, - FSTestCase, - GlobTestCase, - RepositoryTestCase, - ] - for tclass in tclasses: - names = unittest.getTestCaseNames(tclass, 'test_') - suite.addTests(list(map(tclass, names))) - TestUnit.run(suite) + unittest.main() # Local Variables: # tab-width:4 diff --git a/src/engine/SCons/Node/NodeTests.py b/src/engine/SCons/Node/NodeTests.py index e50616a..39b928b 100644 --- a/src/engine/SCons/Node/NodeTests.py +++ b/src/engine/SCons/Node/NodeTests.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001 - 2017 The SCons Foundation +# Copyright (c) 2001 - 2019 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -20,7 +20,7 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -__revision__ = "src/engine/SCons/Node/NodeTests.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" +__revision__ = "src/engine/SCons/Node/NodeTests.py 103260fce95bf5db1c35fb2371983087d85dd611 2019-07-13 18:25:30 bdbaddog" import SCons.compat @@ -30,8 +30,6 @@ import re import sys import unittest -import TestUnit - import SCons.Errors import SCons.Node import SCons.Util @@ -1337,9 +1335,9 @@ class NodeListTestCase(unittest.TestCase): assert s == "['n3', 'n2', 'n1']", s r = repr(nl) - r = re.sub('at (0[xX])?[0-9a-fA-F]+', 'at 0x', r) + r = re.sub(r'at (0[xX])?[0-9a-fA-F]+', 'at 0x', r) # Don't care about ancestry: just leaf value of MyNode - r = re.sub('<.*?\.MyNode', ' +(scripts, [exports, variant_dir, duplicate, must_exist]) + -(dirs=subdirs, [name=script, exports, variant_dir, duplicate]) - +(dirs=subdirs, [name=script, exports, variant_dir, duplicate, must_exist]) + @@ -563,6 +567,17 @@ TODO??? SConscript('build/SConscript', src_dir='src') --> + +The optional +must_exist +argument, if true, causes an exception to be raised if a requested +&SConscript; file is not found. The current default is false, +causing only a warning to be omitted, but this behavior is deprecated. +For scripts which truly intend to be optional, transition to +explicty supplying +must_exist=False to the call. + + Here are some composite examples: diff --git a/src/engine/SCons/Script/SConscriptTests.py b/src/engine/SCons/Script/SConscriptTests.py index 2b10446..fb06ac4 100644 --- a/src/engine/SCons/Script/SConscriptTests.py +++ b/src/engine/SCons/Script/SConscriptTests.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001 - 2017 The SCons Foundation +# Copyright (c) 2001 - 2019 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Script/SConscriptTests.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" +__revision__ = "src/engine/SCons/Script/SConscriptTests.py 103260fce95bf5db1c35fb2371983087d85dd611 2019-07-13 18:25:30 bdbaddog" import SCons.Script.SConscript diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index ffafadf..834c70d 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -12,7 +12,7 @@ it goes here. """ # -# Copyright (c) 2001 - 2017 The SCons Foundation +# Copyright (c) 2001 - 2019 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -34,7 +34,7 @@ it goes here. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Script/__init__.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" +__revision__ = "src/engine/SCons/Script/__init__.py 103260fce95bf5db1c35fb2371983087d85dd611 2019-07-13 18:25:30 bdbaddog" import time start_time = time.time() @@ -81,8 +81,8 @@ import SCons.Action import SCons.Builder import SCons.Environment import SCons.Node.FS -import SCons.Options import SCons.Platform +import SCons.Platform.virtualenv import SCons.Scanner import SCons.SConf import SCons.Subst @@ -150,6 +150,7 @@ Environment = SCons.Environment.Environment #OptParser = SCons.SConsOptions.OptParser FindPathDirs = SCons.Scanner.FindPathDirs Platform = SCons.Platform.Platform +Virtualenv = SCons.Platform.virtualenv.Virtualenv Return = _SConscript.Return Scanner = SCons.Scanner.Base Tool = SCons.Tool.Tool @@ -162,12 +163,6 @@ ListVariable = SCons.Variables.ListVariable PackageVariable = SCons.Variables.PackageVariable PathVariable = SCons.Variables.PathVariable -# Deprecated names that will go away some day. -BoolOption = SCons.Options.BoolOption -EnumOption = SCons.Options.EnumOption -ListOption = SCons.Options.ListOption -PackageOption = SCons.Options.PackageOption -PathOption = SCons.Options.PathOption # Action factories. Chmod = SCons.Defaults.Chmod @@ -283,12 +278,20 @@ def HelpFunction(text, append=False): # Will be non-zero if we are reading an SConscript file. sconscript_reading = 0 +_no_missing_sconscript = False +_warn_missing_sconscript_deprecated = True + +def set_missing_sconscript_error(flag=1): + """Set behavior on missing file in SConscript() call. Returns previous value""" + global _no_missing_sconscript + old = _no_missing_sconscript + _no_missing_sconscript = flag + return old + # def Variables(files=[], args=ARGUMENTS): return SCons.Variables.Variables(files, args) -def Options(files=[], args=ARGUMENTS): - return SCons.Options.Options(files, args) # The list of global functions to add to the SConscript name space # that end up calling corresponding methods or Builders in the @@ -374,7 +377,9 @@ GlobalDefaultBuilders = [ 'SharedObject', 'StaticLibrary', 'StaticObject', + 'Substfile', 'Tar', + 'Textfile', 'TypeLibrary', 'Zip', 'Package', diff --git a/src/engine/SCons/Subst.py b/src/engine/SCons/Subst.py index 90c12a0..4fc8461 100644 --- a/src/engine/SCons/Subst.py +++ b/src/engine/SCons/Subst.py @@ -5,7 +5,7 @@ SCons string substitution. """ # -# Copyright (c) 2001 - 2017 The SCons Foundation +# Copyright (c) 2001 - 2019 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -26,7 +26,7 @@ SCons string substitution. # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -__revision__ = "src/engine/SCons/Subst.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" +__revision__ = "src/engine/SCons/Subst.py 103260fce95bf5db1c35fb2371983087d85dd611 2019-07-13 18:25:30 bdbaddog" import collections import re @@ -86,6 +86,9 @@ class Literal(object): def __neq__(self, other): return not self.__eq__(other) + def __hash__(self): + return hash(self.lstr) + class SpecialAttrWrapper(object): """This is a wrapper for what we call a 'Node special attribute.' This is any of the attributes of a Node that we can reference from @@ -338,7 +341,10 @@ SUBST_RAW = 1 SUBST_SIG = 2 _rm = re.compile(r'\$[()]') -_rm_split = re.compile(r'(\$[()])') + +# Note the pattern below only matches $( or $) when there is no +# preceeding $. (Thus the (? -%scons; - -%builders-mod; - -%functions-mod; - -%tools-mod; - -%variables-mod; -]> + + %scons; + + %builders-mod; + + %functions-mod; + + %tools-mod; + + %variables-mod; + ]> - - - -Sets construction variables for the Apple linker -(similar to the GNU linker). - - - -FRAMEWORKPATHPREFIX -_FRAMEWORKPATH -_FRAMEWORKS -LINKCOM -SHLINKFLAGS -SHLINKCOM -LDMODULEPREFIX -LDMODULESUFFIX -LDMODULEFLAGS -LDMODULECOM - - -FRAMEWORKSFLAGS - - - -"> - - -On Mac OS X with gcc, -general user-supplied frameworks options to be added at -the end of a command -line building a loadable module. -(This has been largely superseded by -the &cv-link-FRAMEWORKPATH;, &cv-link-FRAMEWORKPATHPREFIX;, -&cv-link-FRAMEWORKPREFIX; and &cv-link-FRAMEWORKS; variables -described above.) - - - - - - - -On Mac OS X with gcc, a list of the framework names to be linked into a -program or shared library or bundle. -The default value is the empty list. -For example: - - - - env.AppendUnique(FRAMEWORKS=Split('System Cocoa SystemConfiguration')) - - - - - - - - -On Mac OS X with gcc, -the prefix to be used for linking in frameworks -(see &cv-link-FRAMEWORKS;). -The default value is -. - - - - - - - -On Mac OS X with gcc, -an automatically-generated construction variable -containing the linker command-line options -for linking with FRAMEWORKS. - - - - - - - -On Mac OS X with gcc, -a list containing the paths to search for frameworks. -Used by the compiler to find framework-style includes like -#include <Fmwk/Header.h>. -Used by the linker to find user-specified frameworks when linking (see -&cv-link-FRAMEWORKS;). -For example: - - - - env.AppendUnique(FRAMEWORKPATH='#myframeworkdir') - - - -will add - - - - ... -Fmyframeworkdir - - - -to the compiler and linker command lines. - - - - - - - -On Mac OS X with gcc, the prefix to be used for the FRAMEWORKPATH entries. -(see &cv-link-FRAMEWORKPATH;). -The default value is -. - - - - - - - -On Mac OS X with gcc, an automatically-generated construction variable -containing the linker command-line options corresponding to -&cv-link-FRAMEWORKPATH;. - - - + + + + Sets construction variables for the Apple linker + (similar to the GNU linker). + + + + FRAMEWORKPATHPREFIX + _FRAMEWORKPATH + _FRAMEWORKS + LINKCOM + SHLINKFLAGS + SHLINKCOM + LDMODULEPREFIX + LDMODULESUFFIX + LDMODULEFLAGS + LDMODULECOM + APPLELINK_CURRENT_VERSION + APPLELINK_COMPATIBILITY_VERSION + APPLELINK_NO_CURRENT_VERSION + APPLELINK_NO_COMPATIBILITY_VERSION + _APPLELINK_CURRENT_VERSION + _APPLELINK_COMPATIBILITY_VERSION + + + FRAMEWORKSFLAGS + + + + + + + + On Mac OS X this is used to set the linker flag: + + -compatibility_version + + + The value is specified as X[.Y[.Z]] where X is between 1 and 65535, Y can be omitted or between 1 and + 255, Z can be omitted or between 1 and 255. This value will be derived from &cv-link-SHLIBVERSION; if + not + specified. The lowest digit will be dropped and replaced by a 0. + + + If the &cv-link-APPLELINK_NO_COMPATIBILITY_VERSION; is set then no -compatibility_version will be + output. + + See MacOS's ld manpage for more details + + + + + + + Set this to any True (1|True|non-empty string) value to disable adding -compatibility_version flag when + generating versioned shared libraries. + + + This overrides &cv-link-APPLELINK_COMPATIBILITY_VERSION;. + + + + + + + + + A macro (by default a generator function) used to create the linker flags to specify + apple's linker's -compatibility_version flag. + The default generator uses &cv-link-APPLELINK_COMPATIBILITY_VERSION; + and &cv-link-APPLELINK_NO_COMPATIBILITY_VERSION; and &cv-link-SHLIBVERSION; + to determine the correct flag. + + + + + + + + + On Mac OS X this is used to set the linker flag: + + -current_version + + + The value is specified as X[.Y[.Z]] where X is between 1 and 65535, Y can be omitted or between 1 and + 255, Z can be omitted or between 1 and 255. This value will be set to &cv-link-SHLIBVERSION; if not + specified. + + + If the &cv-link-APPLELINK_NO_CURRENT_VERSION; is set then no -current_version will be + output. + + See MacOS's ld manpage for more details + + + + + + + + + Set this to any True (1|True|non-empty string) value to disable adding -current_version flag when + generating versioned shared libraries. + + + This overrides &cv-link-APPLELINK_CURRENT_VERSION;. + + + + + + + + A macro (by default a generator function) used to create the linker flags to specify apple's linker's + -current_version flag. The default generator uses &cv-link-APPLELINK_CURRENT_VERSION; and + &cv-link-APPLELINK_NO_CURRENT_VERSION; and &cv-link-SHLIBVERSION; to determine the correct flag. + + + + + + "> + + + On Mac OS X with gcc, + general user-supplied frameworks options to be added at + the end of a command + line building a loadable module. + (This has been largely superseded by + the &cv-link-FRAMEWORKPATH;, &cv-link-FRAMEWORKPATHPREFIX;, + &cv-link-FRAMEWORKPREFIX; and &cv-link-FRAMEWORKS; variables + described above.) + + + + + + + + On Mac OS X with gcc, a list of the framework names to be linked into a + program or shared library or bundle. + The default value is the empty list. + For example: + + + + env.AppendUnique(FRAMEWORKS=Split('System Cocoa SystemConfiguration')) + + + + + + + + + On Mac OS X with gcc, + the prefix to be used for linking in frameworks + (see &cv-link-FRAMEWORKS;). + The default value is + . + + + + + + + + On Mac OS X with gcc, + an automatically-generated construction variable + containing the linker command-line options + for linking with FRAMEWORKS. + + + + + + + + On Mac OS X with gcc, + a list containing the paths to search for frameworks. + Used by the compiler to find framework-style includes like + #include <Fmwk/Header.h>. + Used by the linker to find user-specified frameworks when linking (see + &cv-link-FRAMEWORKS;). + For example: + + + + env.AppendUnique(FRAMEWORKPATH='#myframeworkdir') + + + + will add + + + + ... -Fmyframeworkdir + + + + to the compiler and linker command lines. + + + + + + + + On Mac OS X with gcc, the prefix to be used for the FRAMEWORKPATH entries. + (see &cv-link-FRAMEWORKPATH;). + The default value is + . + + + + + + + + On Mac OS X with gcc, an automatically-generated construction variable + containing the linker command-line options corresponding to + &cv-link-FRAMEWORKPATH;. + + + diff --git a/src/engine/SCons/Tool/ar.py b/src/engine/SCons/Tool/ar.py index 4d2a005..bef719f 100644 --- a/src/engine/SCons/Tool/ar.py +++ b/src/engine/SCons/Tool/ar.py @@ -9,7 +9,7 @@ selection method. """ # -# Copyright (c) 2001 - 2017 The SCons Foundation +# Copyright (c) 2001 - 2019 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/ar.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" +__revision__ = "src/engine/SCons/Tool/ar.py 103260fce95bf5db1c35fb2371983087d85dd611 2019-07-13 18:25:30 bdbaddog" import SCons.Defaults import SCons.Tool diff --git a/src/engine/SCons/Tool/ar.xml b/src/engine/SCons/Tool/ar.xml index 9b9e0a0..573c80b 100644 --- a/src/engine/SCons/Tool/ar.xml +++ b/src/engine/SCons/Tool/ar.xml @@ -1,6 +1,6 @@ -%scons; - -%builders-mod; - -%functions-mod; - -%tools-mod; - -%variables-mod; -]> + + %scons; + + %builders-mod; + + %functions-mod; + + %tools-mod; + + %variables-mod; + ]> - - - -Sets construction variables for the &javac; compiler. - - - -JAVAC -JAVACFLAGS -JAVACCOM -JAVACLASSSUFFIX -JAVASUFFIX -JAVABOOTCLASSPATH -JAVACLASSPATH -JAVASOURCEPATH - - -JAVACCOMSTR - - + + + + Sets construction variables for the &javac; compiler. + + + + JAVAC + JAVACFLAGS + JAVACCOM + JAVACLASSSUFFIX + JAVAINCLUDES + JAVASUFFIX + JAVABOOTCLASSPATH + JAVACLASSPATH + JAVASOURCEPATH + + + JAVACCOMSTR + + - - - -Builds one or more Java class files. -The sources may be any combination of explicit -.java files, -or directory trees which will be scanned -for .java files. - + + + + Builds one or more Java class files. + The sources may be any combination of explicit + .java + files, + or directory trees which will be scanned + for .java files. + - -SCons will parse each source .java file -to find the classes -(including inner classes) -defined within that file, -and from that figure out the -target .class files that will be created. -The class files will be placed underneath -the specified target directory. - + + SCons will parse each source .java file + to find the classes + (including inner classes) + defined within that file, + and from that figure out the + target .class files that will be created. + The class files will be placed underneath + the specified target directory. + - -SCons will also search each Java file -for the Java package name, -which it assumes can be found on a line -beginning with the string -package -in the first column; -the resulting .class files -will be placed in a directory reflecting -the specified package name. -For example, -the file -Foo.java -defining a single public -Foo -class and -containing a package name of -sub.dir -will generate a corresponding -sub/dir/Foo.class -class file. - + + SCons will also search each Java file + for the Java package name, + which it assumes can be found on a line + beginning with the string + package + in the first column; + the resulting .class files + will be placed in a directory reflecting + the specified package name. + For example, + the file + Foo.java + defining a single public + Foo + class and + containing a package name of + sub.dir + will generate a corresponding + sub/dir/Foo.class + class file. + - -Examples: - + + Examples: + - -env.Java(target = 'classes', source = 'src') -env.Java(target = 'classes', source = ['src1', 'src2']) -env.Java(target = 'classes', source = ['File1.java', 'File2.java']) - + + env.Java(target = 'classes', source = 'src') + env.Java(target = 'classes', source = ['src1', 'src2']) + env.Java(target = 'classes', source = ['File1.java', 'File2.java']) + - -Java source files can use the native encoding for the underlying OS. -Since SCons compiles in simple ASCII mode by default, -the compiler will generate warnings about unmappable characters, -which may lead to errors as the file is processed further. -In this case, the user must specify the LANG -environment variable to tell the compiler what encoding is used. -For portibility, it's best if the encoding is hard-coded -so that the compile will work if it is done on a system -with a different encoding. - + + Java source files can use the native encoding for the underlying OS. + Since SCons compiles in simple ASCII mode by default, + the compiler will generate warnings about unmappable characters, + which may lead to errors as the file is processed further. + In this case, the user must specify the + LANG + environment variable to tell the compiler what encoding is used. + For portibility, it's best if the encoding is hard-coded + so that the compile will work if it is done on a system + with a different encoding. + - -env = Environment() -env['ENV']['LANG'] = 'en_GB.UTF-8' - - - + + env = Environment() + env['ENV']['LANG'] = 'en_GB.UTF-8' + + + - - - -Specifies the list of directories that -will be added to the -&javac; command line -via the option. -The individual directory names will be -separated by the operating system's path separate character -(: on UNIX/Linux/POSIX, -; on Windows). - - - + + + + Specifies the list of directories that + will be added to the + &javac; command line + via the option. + The individual directory names will be + separated by the operating system's path separate character + (: on UNIX/Linux/POSIX, + ; + on Windows). + + + - - - -The Java compiler. - - - + + + + Include path for Java header files (such as jni.h) + + + - - - -The command line used to compile a directory tree containing -Java source files to -corresponding Java class files. -Any options specified in the &cv-link-JAVACFLAGS; construction variable -are included on this command line. - - - + + + + The Java compiler. + + + - - - -The string displayed when compiling -a directory tree of Java source files to -corresponding Java class files. -If this is not set, then &cv-link-JAVACCOM; (the command line) is displayed. - + + + + The command line used to compile a directory tree containing + Java source files to + corresponding Java class files. + Any options specified in the &cv-link-JAVACFLAGS; construction variable + are included on this command line. + + + - -env = Environment(JAVACCOMSTR = "Compiling class files $TARGETS from $SOURCES") - - - + + + + The string displayed when compiling + a directory tree of Java source files to + corresponding Java class files. + If this is not set, then &cv-link-JAVACCOM; (the command line) is displayed. + - - - -General options that are passed to the Java compiler. - - - + + env = Environment(JAVACCOMSTR = "Compiling class files $TARGETS from $SOURCES") + + + - - - -The directory in which Java class files may be found. -This is stripped from the beginning of any Java .class -file names supplied to the -JavaH -builder. - - - + + + + General options that are passed to the Java compiler. + + + - - - -Specifies the list of directories that -will be searched for Java -.class file. -The directories in this list will be added to the -&javac; and &javah; command lines -via the option. -The individual directory names will be -separated by the operating system's path separate character -(: on UNIX/Linux/POSIX, -; on Windows). - + + + + The directory in which Java class files may be found. + This is stripped from the beginning of any Java .class + file names supplied to the + JavaH + builder. + + + - -Note that this currently just adds the specified -directory via the option. -&SCons; does not currently search the -&cv-JAVACLASSPATH; directories for dependency -.class files. - - - + + + + Specifies the list of directories that + will be searched for Java + .class + file. + The directories in this list will be added to the + &javac; and &javah; command lines + via the option. + The individual directory names will be + separated by the operating system's path separate character + (: on UNIX/Linux/POSIX, + ; + on Windows). + - - - -The suffix for Java class files; -.class -by default. - - - + + Note that this currently just adds the specified + directory via the option. + &SCons; does not currently search the + &cv-JAVACLASSPATH; directories for dependency + .class + files. + + + - - - -Specifies the list of directories that -will be searched for input -.java file. -The directories in this list will be added to the -&javac; command line -via the option. -The individual directory names will be -separated by the operating system's path separate character -(: on UNIX/Linux/POSIX, -; on Windows). - + + + + The suffix for Java class files; + .class + by default. + + + - -Note that this currently just adds the specified -directory via the option. -&SCons; does not currently search the -&cv-JAVASOURCEPATH; directories for dependency -.java files. - - - + + + + Specifies the list of directories that + will be searched for input + .java + file. + The directories in this list will be added to the + &javac; command line + via the option. + The individual directory names will be + separated by the operating system's path separate character + (: on UNIX/Linux/POSIX, + ; + on Windows). + - - - -The suffix for Java files; -.java -by default. - - - + + Note that this currently just adds the specified + directory via the option. + &SCons; does not currently search the + &cv-JAVASOURCEPATH; directories for dependency + .java + files. + + + - - - -Specifies the Java version being used by the &b-Java; builder. -This is not currently used to select one -version of the Java compiler vs. another. -Instead, you should set this to specify the version of Java -supported by your &javac; compiler. -The default is 1.4. - + + + + The suffix for Java files; + .java + by default. + + + - -This is sometimes necessary because -Java 1.5 changed the file names that are created -for nested anonymous inner classes, -which can cause a mismatch with the files -that &SCons; expects will be generated by the &javac; compiler. -Setting &cv-JAVAVERSION; to 1.5 -(or 1.6, as appropriate) -can make &SCons; realize that a Java 1.5 or 1.6 -build is actually up to date. - - - + + + + Specifies the Java version being used by the &b-Java; builder. + This is not currently used to select one + version of the Java compiler vs. another. + Instead, you should set this to specify the version of Java + supported by your &javac; compiler. + The default is 1.4. + + + + This is sometimes necessary because + Java 1.5 changed the file names that are created + for nested anonymous inner classes, + which can cause a mismatch with the files + that &SCons; expects will be generated by the &javac; compiler. + Setting &cv-JAVAVERSION; to + 1.5 + (or 1.6, as appropriate) + can make &SCons; realize that a Java 1.5 or 1.6 + build is actually up to date. + + + diff --git a/src/engine/SCons/Tool/javacTests.py b/src/engine/SCons/Tool/javacTests.py index 0debbb6..067ff3e 100644 --- a/src/engine/SCons/Tool/javacTests.py +++ b/src/engine/SCons/Tool/javacTests.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001 - 2017 The SCons Foundation +# Copyright (c) 2001 - 2019 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -24,8 +24,6 @@ import os import unittest -import TestUnit - import SCons.Tool.javac class DummyNode(object): @@ -40,14 +38,14 @@ class pathoptTestCase(unittest.TestCase): popt = SCons.Tool.javac.pathopt('-foopath', 'FOOPATH') env = {'FOOPATH': path} actual = popt(None, None, env, None) - self.assertEquals(expect, actual) + self.assertEqual(expect, actual) def assert_pathopt_default(self, expect, path, default): popt = SCons.Tool.javac.pathopt('-foopath', 'FOOPATH', default='DPATH') env = {'FOOPATH': path, 'DPATH': default} actual = popt(None, None, env, None) - self.assertEquals(expect, actual) + self.assertEqual(expect, actual) def test_unset(self): self.assert_pathopt([], None) @@ -101,5 +99,4 @@ class pathoptTestCase(unittest.TestCase): '') if __name__ == "__main__": - suite = unittest.makeSuite(pathoptTestCase, 'test_') - TestUnit.run(suite) + unittest.main() diff --git a/src/engine/SCons/Tool/javah.py b/src/engine/SCons/Tool/javah.py index 0e1885c..84183cb 100644 --- a/src/engine/SCons/Tool/javah.py +++ b/src/engine/SCons/Tool/javah.py @@ -9,7 +9,7 @@ selection method. """ # -# Copyright (c) 2001 - 2017 The SCons Foundation +# Copyright (c) 2001 - 2019 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/javah.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" +__revision__ = "src/engine/SCons/Tool/javah.py 103260fce95bf5db1c35fb2371983087d85dd611 2019-07-13 18:25:30 bdbaddog" import os.path @@ -40,6 +40,8 @@ import SCons.Builder import SCons.Node.FS import SCons.Tool.javac import SCons.Util +from SCons.Tool.JavaCommon import get_java_install_dirs + def emit_java_headers(target, source, env): """Create and return lists of Java stub header files that will @@ -120,6 +122,14 @@ def generate(env): java_javah = SCons.Tool.CreateJavaHBuilder(env) java_javah.emitter = emit_java_headers + if env['PLATFORM'] == 'win32': + # Ensure that we have a proper path for clang + javah = SCons.Tool.find_program_path(env, 'javah', + default_paths=get_java_install_dirs(env['PLATFORM'])) + if javah: + javah_bin_dir = os.path.dirname(javah) + env.AppendENVPath('PATH', javah_bin_dir) + env['_JAVAHOUTFLAG'] = JavaHOutFlagGenerator env['JAVAH'] = 'javah' env['JAVAHFLAGS'] = SCons.Util.CLVar('') diff --git a/src/engine/SCons/Tool/javah.xml b/src/engine/SCons/Tool/javah.xml index f362e3e..f72a6cd 100644 --- a/src/engine/SCons/Tool/javah.xml +++ b/src/engine/SCons/Tool/javah.xml @@ -1,6 +1,6 @@