Hello community, here is the log from the commit of package scons for openSUSE:Factory checked in at 2018-10-12 13:09:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/scons (Old) and /work/SRC/openSUSE:Factory/.scons.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "scons" Fri Oct 12 13:09:37 2018 rev:37 rq:641268 version:3.0.1 Changes: -------- --- /work/SRC/openSUSE:Factory/scons/scons.changes 2018-07-26 10:17:37.259852221 +0200 +++ /work/SRC/openSUSE:Factory/.scons.new/scons.changes 2018-10-12 13:09:54.223367227 +0200 @@ -1,0 +2,28 @@ +Thu Oct 11 10:30:44 UTC 2018 - Matěj Cepl <[email protected]> + +- Switch off more failing tests. + +------------------------------------------------------------------- +Mon Oct 8 12:01:14 UTC 2018 - Matěj Cepl <[email protected]> + +- Make package not to be noarch (bsc#1109755) + +------------------------------------------------------------------- +Fri Oct 5 01:35:18 CEST 2018 - [email protected] + +- Make package multibuild for separate testing +- Block failing tests (and block %check section completely on + non-Intel archs, as the tests are apparently not designed for + that). +- Fix patches from the upstream to improve compatbiilty: + fix-jN-for-python-37.patch + fix-rpm-tests-for-newer-rpmbuild.patch + no_deprecated_asserts.patch + no_time-clock.patch + removed_splitunc.patch + replace_TestSuite_main.patch + stop_custom_OrderedDict.patch +- Remove replace-imp-with-importlib.patch for now (to stabilize + the package first) + +------------------------------------------------------------------- Old: ---- replace-imp-with-importlib.patch scons-3.0.1.tar.gz New: ---- 3.0.1.tar.gz _multibuild fix-jN-for-python-37.patch fix-rpm-tests-for-newer-rpmbuild.patch grep-filter-list.txt no_deprecated_asserts.patch no_time-clock.patch removed_splitunc.patch replace_TestSuite_main.patch stop_custom_OrderedDict.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ scons.spec ++++++ --- /var/tmp/diff_new_pack.IPSHTa/_old 2018-10-12 13:09:54.811366390 +0200 +++ /var/tmp/diff_new_pack.IPSHTa/_new 2018-10-12 13:09:54.811366390 +0200 @@ -12,27 +12,75 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # -Name: scons +%define modname scons + +%global flavor @BUILD_FLAVOR@%{nil} +%bcond_with test + +# Tests on non-Intel archs have too many failing tests +# https://pairlist4.pair.net/pipermail/scons-users/2018-October/007311.html +%ifnarch aarch64 armv7l ppc64 ppc64le s390x +%if "%{flavor}" == "test" +%bcond_without test +%endif +%endif + +%if %{with test} +Name: %{modname}-%{flavor} +%else +Name: %{modname} +%endif Version: 3.0.1 Release: 0 Summary: Replacement for Make License: MIT Group: Development/Tools/Building URL: http://www.scons.org/ -Source0: http://prdownloads.sourceforge.net/scons/%{name}-%{version}.tar.gz +Source0: https://github.com/SCons/%{modname}/archive/%{version}.tar.gz #http://www.scons.org/doc/%%{version}/HTML/scons-user.html Source1: scons-user.html-%{version}.tar.bz2 -# Sets _mandir to _datadir/man instead of _prefix/man -Patch0: %{name}-3.0.0-fix-install.patch -Patch1: replace-imp-with-importlib.patch -BuildRequires: fdupes -BuildRequires: python3-devel >= 3.5 +# Adjust to exclude all failing tests +Source2: grep-filter-list.txt +# Upstream compatibilitt patches +Patch0: no_deprecated_asserts.patch +Patch1: removed_splitunc.patch +Patch2: fix-jN-for-python-37.patch +Patch3: replace_TestSuite_main.patch +Patch4: stop_custom_OrderedDict.patch +Patch5: no_time-clock.patch +# Specific fixes +Patch6: fix-rpm-tests-for-newer-rpmbuild.patch +# Patch7: replace-imp-with-importlib.patch +# Local modification +Patch8: scons-3.0.0-fix-install.patch +BuildRequires: grep +BuildRequires: python3-base >= 3.5 +BuildRequires: python3-lxml Requires: python3-base >= 3.5 -BuildArch: noarch +%if %{with test} +# For tests +BuildRequires: clang +BuildRequires: docbook-xsl-pdf2index +BuildRequires: docbook5-xsl-stylesheets +BuildRequires: gcc-c++ +BuildRequires: libxml2-devel +BuildRequires: libxslt-devel +BuildRequires: libxslt-tools +BuildRequires: xmlgraphics-fop +# texlive texlive-latex3 biber texmaker ghostscript +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: bison +BuildRequires: git +BuildRequires: libtool +BuildRequires: pcre-devel +BuildRequires: subversion +BuildRequires: swig +%endif %description SCons is a make replacement that provides a range of enhanced features, @@ -42,27 +90,49 @@ full power of Python to control compilation. %prep -%setup -q -a1 -%patch0 -p1 -%patch1 -p1 +%setup -q -n %{modname}-%{version} +%autopatch -p1 -sed -i -e '/QT_LIBPATH = os.path.join.*QTDIR/s/lib/%{_lib}/' engine/SCons/Tool/qt.py +sed -i -e '/QT_LIBPATH = os.path.join.*QTDIR/s/lib/%{_lib}/' \ + src/engine/SCons/Tool/qt.py +sed -i 's|%{_bindir}/env python|%{_bindir}/python3|' src/script/* -sed -i 's|%{_bindir}/env python|%{_bindir}/python3|' script/* +cp %{SOURCE2} grep-filter-list.txt %build -export CFLAGS="%{optflags}" -%python3_build +python3 bootstrap.py build/scons +cd build/scons +%py3_build %install -%python3_install -%fdupes %{buildroot}%{_bindir} +%if !%{with test} +cd build/scons +ls -lh build/lib +%py3_install \ + --standard-lib \ + --no-install-bat \ + --no-version-script \ + --install-scripts=%{_bindir} \ + --record installed_files.txt +%endif + +%check +%if %{with test} +TEMP_FILE=$(mktemp --tmpdir %{modname}-test.XXXXXX) +trap 'rm -f -- "$TEMP_FILE"' INT TERM HUP EXIT +find src/ test/ -name \*.py \ + | grep -F -v -f grep-filter-list.txt >$TEMP_FILE +python3 runtest.py -f $TEMP_FILE +%endif %files -%license LICENSE.txt -%doc CHANGES.txt README.txt RELEASE.txt scons-user.html +%license LICENSE +%doc src/CHANGES.txt README.rst src/RELEASE.txt +%if !%{with test} %{_bindir}/* -%{_libexecdir}/scons-%{version} +%{python3_sitelib}/SCons +%{python3_sitelib}/%{modname}*.egg-info %{_mandir}/man1/*%{ext_man} +%endif %changelog ++++++ scons-3.0.1.tar.gz -> 3.0.1.tar.gz ++++++ ++++ 1000979 lines of diff (skipped) ++++++ _multibuild ++++++ <multibuild> <package>test</package> </multibuild> ++++++ fix-jN-for-python-37.patch ++++++ --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -1253,7 +1253,11 @@ def _build_targets(fs, options, targets, BuildTask.options = options - python_has_threads = sysconfig.get_config_var('WITH_THREAD') + # As of 3.7, python removed support for threadless platforms. + # See https://www.python.org/dev/peps/pep-0011/ + is_37_or_later = sys.version_info.major > 3 or \ + sys.version_info.major == 3 and sys.version_info.minor >= 7 + python_has_threads = sysconfig.get_config_var('WITH_THREAD') or is_37_or_later # to check if python configured with threads. global num_jobs num_jobs = options.num_jobs --- a/runtest.py +++ b/runtest.py @@ -781,7 +781,7 @@ tests_passing = 0 tests_failing = 0 -def run_test(t, io_lock, async=True): +def run_test(t, io_lock, run_async=True): global tests_completed, tests_passing, tests_failing header = "" command_args = ['-tt'] ++++++ fix-rpm-tests-for-newer-rpmbuild.patch ++++++ --- a/src/engine/SCons/Tool/packaging/rpm.py +++ b/src/engine/SCons/Tool/packaging/rpm.py @@ -51,10 +51,9 @@ def package(env, target, source, PACKAGE if str(target[0])!="%s-%s"%(NAME, VERSION): raise UserError( "Setting target is not supported for rpm." ) else: - # This should be overridable from the construction environment, - # which it is by using ARCHITECTURE=. + # Deduce the build architecture, but allow it to be overridden + # by setting ARCHITECTURE in the construction env. buildarchitecture = SCons.Tool.rpmutils.defaultMachine() - if 'ARCHITECTURE' in kw: buildarchitecture = kw['ARCHITECTURE'] @@ -126,20 +125,18 @@ def build_specfile(target, source, env): """ Builds a RPM specfile from a dictionary with string metadata and by analyzing a tree of nodes. """ - file = open(target[0].get_abspath(), 'w') - - try: - file.write( build_specfile_header(env) ) - file.write( build_specfile_sections(env) ) - file.write( build_specfile_filesection(env, source) ) - file.close() - - # call a user specified function - if 'CHANGE_SPECFILE' in env: - env['CHANGE_SPECFILE'](target, source) + with open(target[0].get_abspath(), 'w') as file: + try: + file.write(build_specfile_header(env)) + file.write(build_specfile_sections(env)) + file.write(build_specfile_filesection(env, source)) + + # call a user specified function + if 'CHANGE_SPECFILE' in env: + env['CHANGE_SPECFILE'](target, source) - except KeyError as e: - raise SCons.Errors.UserError( '"%s" package field for RPM is missing.' % e.args[0] ) + except KeyError as e: + raise SCons.Errors.UserError('"%s" package field for RPM is missing.' % e.args[0]) # @@ -201,7 +198,8 @@ def build_specfile_header(spec): 'PACKAGEVERSION' : '%%define release %s\nRelease: %%{release}\n', 'X_RPM_GROUP' : 'Group: %s\n', 'SUMMARY' : 'Summary: %s\n', - 'LICENSE' : 'License: %s\n', } + 'LICENSE' : 'License: %s\n', + } str = str + SimpleTagCompiler(mandatory_header_fields).compile( spec ) @@ -211,6 +209,7 @@ def build_specfile_header(spec): 'X_RPM_URL' : 'Url: %s\n', 'SOURCE_URL' : 'Source: %s\n', 'SUMMARY_' : 'Summary(%s): %s\n', + 'ARCHITECTURE' : 'BuildArch: %s\n', 'X_RPM_DISTRIBUTION' : 'Distribution: %s\n', 'X_RPM_ICON' : 'Icon: %s\n', 'X_RPM_PACKAGER' : 'Packager: %s\n', @@ -229,19 +228,33 @@ def build_specfile_header(spec): 'X_RPM_PREFIX' : 'Prefix: %s\n', # internal use - 'X_RPM_BUILDROOT' : 'BuildRoot: %s\n', } + 'X_RPM_BUILDROOT' : 'BuildRoot: %s\n', + } # fill in default values: - # Adding a BuildRequires renders the .rpm unbuildable under System, which + # Adding a BuildRequires renders the .rpm unbuildable under systems which # are not managed by rpm, since the database to resolve this dependency is # missing (take Gentoo as an example) -# if not s.has_key('x_rpm_BuildRequires'): -# s['x_rpm_BuildRequires'] = 'scons' + #if 'X_RPM_BUILDREQUIRES' not in spec: + # spec['X_RPM_BUILDREQUIRES'] = 'scons' if 'X_RPM_BUILDROOT' not in spec: spec['X_RPM_BUILDROOT'] = '%{_tmppath}/%{name}-%{version}-%{release}' str = str + SimpleTagCompiler(optional_header_fields, mandatory=0).compile( spec ) + + # Add any extra specfile definitions the user may have supplied. + # These flags get no processing, they are just added. + # github #3164: if we don't turn off debug package generation + # the tests which build packages all fail. If there are no + # extra flags, default to adding this one. If the user wants + # to turn this back on, supply the flag set to None. + + if 'X_RPM_EXTRADEFS' not in spec: + spec['X_RPM_EXTRADEFS'] = ['%global debug_package %{nil}'] + for extra in spec['X_RPM_EXTRADEFS']: + str += extra + '\n' + return str # --- a/src/engine/SCons/Tool/packaging/tarbz2.py +++ b/src/engine/SCons/Tool/packaging/tarbz2.py @@ -32,7 +32,7 @@ from SCons.Tool.packaging import stripin def package(env, target, source, PACKAGEROOT, **kw): bld = env['BUILDERS']['Tar'] - bld.set_suffix('.tar.gz') + bld.set_suffix('.tar.bz2') target, source = putintopackageroot(target, source, env, PACKAGEROOT) target, source = stripinstallbuilder(target, source, env) return bld(env, target, source, TARFLAGS='-jc') ++++++ grep-filter-list.txt ++++++ src/engine/SCons/ActionTests.py src/engine/SCons/dblite.py src/engine/SCons/EnvironmentValuesTest.py src/engine/SCons/Options/__init__.py src/engine/SCons/Platform/aix.py src/engine/SCons/Platform/cygwin.py src/engine/SCons/Platform/darwin.py src/engine/SCons/Platform/hpux.py src/engine/SCons/Platform/irix.py src/engine/SCons/Platform/os2.py src/engine/SCons/Platform/sunos.py src/engine/SCons/SConfTests.py src/engine/SCons/Script/__init__.py src/engine/SCons/Script/SConscript.py src/engine/SCons/Tool/aixcc.py src/engine/SCons/Tool/aixf77.py src/engine/SCons/Tool/aixlink.py src/engine/SCons/Tool/applelink.py src/engine/SCons/Tool/cvf.py src/engine/SCons/Tool/cyglink.py src/engine/SCons/Tool/docbook/docbook-xsl-1.76.1/extensions/docbook.py src/engine/SCons/Tool/docbook/docbook-xsl-1.76.1/extensions/xslt.py src/engine/SCons/Tool/f03.py src/engine/SCons/Tool/f08.py src/engine/SCons/Tool/f95.py src/engine/SCons/Tool/gcc.py src/engine/SCons/Tool/gfortran.py src/engine/SCons/Tool/gnulink.py src/engine/SCons/Tool/gxx.py src/engine/SCons/Tool/hpcc.py src/engine/SCons/Tool/hplink.py src/engine/SCons/Tool/icc.py src/engine/SCons/Tool/ifl.py src/engine/SCons/Tool/ifort.py src/engine/SCons/Tool/midl.py src/engine/SCons/Tool/MSCommon/arch.py src/engine/SCons/Tool/MSCommon/netframework.py src/engine/SCons/Tool/MSCommon/sdk.py src/engine/SCons/Tool/MSCommon/vc.py src/engine/SCons/Tool/MSCommon/vs.py src/engine/SCons/Tool/mslib.py src/engine/SCons/Tool/mslink.py src/engine/SCons/Tool/mssdk.py src/engine/SCons/Tool/msvc.py src/engine/SCons/Tool/msvs.py src/engine/SCons/Tool/sgicc.py src/engine/SCons/Tool/sgilink.py src/engine/SCons/Tool/suncc.py src/engine/SCons/Tool/sunf77.py src/engine/SCons/Tool/sunf90.py src/engine/SCons/Tool/sunf95.py src/engine/SCons/Tool/sunlink.py src/engine/SCons/Tool/textfile.py src/engine/SCons/Tool/386asm.py src/engine/SCons/UtilTests.py src/engine/SCons/Variables/__init__.py src/script/scons-configure-cache.py src/script/sconsign.py src/script/scons-time.py src/setup.py src/test_files.py src/test_interrupts.py src/test_pychecker.py src/test_setup.py src/test_strings.py test/Actions/pre-post-fixture/work4/build.py test/AS/fixture/myas_args.py test/AS/fixture/myas.py test/AS/ml.py test/AS/nasm.py test/CC/CCVERSION-fixture/versioned.py test/Configure/implicit-cache.py test/CPPDEFINES/scan.py test/D/AllAtOnce/sconstest-dmd.py test/D/AllAtOnce/sconstest-gdc.py test/D/AllAtOnce/sconstest-ldc.py test/D/CoreScanner/sconstest-dmd.py test/D/CoreScanner/sconstest-gdc.py test/D/CoreScanner/sconstest-ldc.py test/D/DMD.py test/D/DMD2_Alt.py test/D/DMD2.py test/Deprecated/SourceSignatures/no-csigs.py test/D/GDC_Alt.py test/D/GDC.py test/D/HelloWorld/CompileAndLinkOneStep/sconstest-dmd.py test/D/HelloWorld/CompileAndLinkOneStep/sconstest-gdc.py test/D/HelloWorld/CompileAndLinkOneStep/sconstest-ldc.py test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-dmd.py test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-gdc.py test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-ldc.py test/D/HSTeoh/sconstest-arLibIssue_dmd.py test/D/HSTeoh/sconstest-arLibIssue_gdc.py test/D/HSTeoh/sconstest-arLibIssue_ldc.py test/D/HSTeoh/sconstest-libCompileOptions_dmd.py test/D/HSTeoh/sconstest-libCompileOptions_gdc.py test/D/HSTeoh/sconstest-libCompileOptions_ldc.py test/D/HSTeoh/sconstest-linkingProblem_dmd.py test/D/HSTeoh/sconstest-linkingProblem_gdc.py test/D/HSTeoh/sconstest-linkingProblem_ldc.py test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_dmd.py test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_gdc.py test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_ldc.py test/D/Issues/2939_Ariovistus/sconstest-correctLinkOptions_dmd.py test/D/Issues/2939_Ariovistus/sconstest-correctLinkOptions_gdc.py test/D/Issues/2939_Ariovistus/sconstest-correctLinkOptions_ldc.py test/D/Issues/2940_Ariovistus/sconstest-correctLinkOptions_dmd.py test/D/Issues/2940_Ariovistus/sconstest-correctLinkOptions_gdc.py test/D/Issues/2940_Ariovistus/sconstest-correctLinkOptions_ldc.py test/D/LDC_Alt.py test/D/LDC.py test/D/MixedDAndC/sconstest-dmd.py test/D/MixedDAndC/sconstest-gdc.py test/D/MixedDAndC/sconstest-ldc.py test/Docbook/basedir/htmlhelp/htmlhelp_cmd.py test/Docbook/basedir/htmlhelp/htmlhelp.py test/Docbook/basedir/htmlchunked/htmlchunked_cmd.py test/Docbook/basedir/htmlchunked/htmlchunked.py test/Docbook/basedir/slideshtml/slideshtml_cmd.py test/Docbook/basedir/slideshtml/slideshtml.py test/Docbook/basic/epub/epub_cmd.py test/Docbook/basic/htmlhelp/htmlhelp_cmd.py test/Docbook/basic/html/html_cmd.py test/Docbook/basic/htmlchunked/htmlchunked_cmd.py test/Docbook/basic/slideshtml/slideshtml_cmd.py test/Docbook/basic/slideshtml/slideshtml.py test/Docbook/basic/xinclude/xinclude.py test/Docbook/dependencies/xinclude/xinclude.py test/Docbook/rootname/htmlhelp/htmlhelp.py test/Docbook/rootname/htmlchunked/htmlchunked.py test/Docbook/rootname/slideshtml/slideshtml.py test/D/Scanner.py test/D/SharedObjects/sconstest-dmd.py test/D/SharedObjects/sconstest-gdc.py test/D/SharedObjects/sconstest-ldc.py test/DVIPDF/makeindex.py test/DVIPS/DVIPS.py test/Errors/preparation.py test/fixture/mycompile.py test/fixture/mylink.py test/fixture/myrewrite.py test/Fortran/fixture/myfortran_flags.py test/Fortran/fixture/myfortran.py test/Fortran/FORTRANPATH.py test/Fortran/F77PATH.py test/Fortran/F90PATH.py test/IDL/midl.py test/Install/non-ascii-name.py test/Intel/icpc-link.py test/Interactive/implicit-VariantDir.py test/Interactive/variant_dir.py test/Java/DerivedSourceTest.py test/Java/JARFLAGS.py test/Java/JARCHDIR.py test/Java/JAR.py test/Java/JAVABOOTCLASSPATH.py test/Java/JAVACFLAGS.py test/Java/JAVACLASSPATH.py test/Java/JAVAH.py test/Java/JAVASOURCEPATH.py test/Java/Java-1.4.py test/Java/Java-1.5.py test/Java/Java-1.6.py test/Java/multi-step.py test/Java/nested-classes.py test/Java/no-JARCHDIR.py test/Java/RMIC.py test/Java/source-files.py test/Java/swig-dependencies.py test/LEX/live.py test/long-lines/signature.py test/MinGW/MinGWSharedLibrary.py test/MinGW/WINDOWS_INSERT_DEF.py test/MSVC/batch-longlines.py test/MSVC/embed-manifest.py test/MSVC/hierarchical.py test/MSVC/msvc.py test/MSVC/MSVC_UWP_APP.py test/MSVC/multiple-pdb.py test/MSVC/pdb-manifest.py test/MSVC/pdb-VariantDir-path.py test/MSVC/pch-basics.py test/MSVC/PCH-source.py test/MSVC/pch-spaces-subdir.py test/MSVC/PCHSTOP-errors.py test/MSVC/query_vcbat.py test/MSVC/TARGET_ARCH.py test/MSVS/common-prefix.py test/MSVS/CPPPATH-Dirs.py test/MSVS/runfile.py test/MSVS/vs-10.0-exec.py test/MSVS/vs-10.0Exp-exec.py test/MSVS/vs-10.0-scc-files.py test/MSVS/vs-10.0-scc-legacy-files.py test/MSVS/vs-11.0-exec.py test/MSVS/vs-11.0Exp-exec.py test/MSVS/vs-11.0-scc-files.py test/MSVS/vs-11.0-scc-legacy-files.py test/MSVS/vs-14.0-exec.py test/MSVS/vs-14.0Exp-exec.py test/MSVS/vs-14.0-scc-files.py test/MSVS/vs-14.0-scc-legacy-files.py test/MSVS/vs-6.0-exec.py test/MSVS/vs-7.0-exec.py test/MSVS/vs-7.0-scc-files.py test/MSVS/vs-7.0-scc-legacy-files.py test/MSVS/vs-7.1-exec.py test/MSVS/vs-7.1-scc-files.py test/MSVS/vs-7.1-scc-legacy-files.py test/MSVS/vs-8.0-exec.py test/MSVS/vs-8.0Exp-exec.py test/MSVS/vs-8.0-scc-files.py test/MSVS/vs-8.0-scc-legacy-files.py test/MSVS/vs-9.0-exec.py test/MSVS/vs-9.0Exp-exec.py test/MSVS/vs-9.0-scc-files.py test/MSVS/vs-9.0-scc-legacy-files.py test/option--tree.py test/packaging/ipkg.py test/packaging/msi/explicit-target.py test/packaging/msi/file-placement.py test/packaging/msi/package.py test/packaging/multiple-packages-at-once.py test/packaging/option--package-type.py test/packaging/rpm/cleanup.py test/packaging/rpm/internationalization.py test/packaging/rpm/multipackage.py test/packaging/rpm/package.py test/packaging/rpm/tagging.py test/packaging/zip.py test/PharLap.py test/print_statement.py test/QT/copied-env.py test/QT/CPPPATH-appended.py test/QT/CPPPATH.py test/QT/generated-ui.py test/QT/installed.py test/QT/manual.py test/QT/moc-from-header.py test/QT/QTFLAGS.py test/QT/source-from-ui.py test/QT/Tool.py test/QT/up-to-date.py test/Repository/JavaH.py test/Repository/Java.py test/Repository/RMIC.py test/Rpcgen/live.py test/SConsignFile/use-dbhash.py test/SConsignFile/use-dbm.py test/SConsignFile/use-dumbdbm.py test/SConsignFile/use-gdbm.py test/sconsign/script/bad.py test/sconsign/script/Configure.py test/sconsign/script/dblite.py test/sconsign/script/no-SConsignFile.py test/sconsign/script/SConsignFile.py test/sconsign/script/Signatures.py test/scons-time/run/aegis.py test/scons-time/run/config/python.py test/scons-time/run/option/python.py test/SWIG/build-dir.py test/SWIG/generated_swigfile.py test/SWIG/implicit-dependencies.py test/SWIG/live.py test/SWIG/module-deduced-name.py test/SWIG/module-parens.py test/SWIG/module-quoted.py test/SWIG/module-spaces.py test/SWIG/noproxy.py test/SWIG/recursive-includes-cpp.py test/SWIG/remove-modules.py test/SWIG/subdir.py test/SWIG/SWIGOUTDIR.py test/SWIG/SWIGOUTDIR-python.py test/SWIG/SWIGPATH.py test/SWIG/SWIG.py test/TEX/auxiliaries.py test/TEX/biber_biblatex.py test/TEX/biber_biblatex2.py test/TEX/biblatex_plain.py test/TEX/biblatex.py test/TEX/bibliography.py test/TEX/bibtex-latex-rerun.py test/TEX/clean.py test/TEX/configure.py test/TEX/dryrun.py test/TEX/eps_graphics.py test/TEX/eps_graphics2.py test/TEX/generated_files.py test/TEX/glossaries.py test/TEX/glossary.py test/TEX/input_docClass.py test/TEX/lstinputlisting.py test/TEX/makeindex.py test/TEX/multibib.py test/TEX/multi-line_include_options.py test/TEX/multiple_include.py test/TEX/multiple_include_subdir.py test/TEX/multi-run.py test/TEX/newglossary.py test/TEX/nomencl.py test/TEX/PDF_single_source.py test/TEX/recursive_scanner_dependencies_import.py test/TEX/recursive_scanner_dependencies_input.py test/TEX/rename_result.py test/TEX/subdir-as-include.py test/TEX/subdir-input.py test/TEX/subdir_variantdir_include.py test/TEX/subdir_variantdir_include2.py test/TEX/subdir_variantdir_input.py test/TEX/synctex.py test/TEX/TEX.py test/TEX/usepackage.py test/TEX/variant_dir_bibunit.py test/TEX/variant_dir_dup0.py test/TEX/variant_dir_newglossary.py test/TEX/variant_dir.py test/TEX/variant_dir_style_dup0.py test/timestamp-fallback.py test/toolpath/relative_import/image/tools/TestTool1/__init__.py test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/__init__.py test/Win32/bad-drive.py test/Win32/default-drive.py test/Win32/file-is-type-not-func.py test/Win32/mingw.py test/Win32/scons-bat-error.py test/Win32/win32pathmadness.py test/YACC/YACC-fixture/myyacc.py test/YACC/YACCFLAGS-fixture/myyacc.py ++++++ no_deprecated_asserts.patch ++++++ >From 9864e8bf0a69f6aa35bb6af794da9988b1bbc50b Mon Sep 17 00:00:00 2001 From: Mats Wichmann <[email protected]> Date: Tue, 25 Sep 2018 17:48:03 -0600 Subject: [PATCH] Stop using deprecated unittest asserts failUnless and failIf have been deprecated since 2.7 and 3.1, the docs call them aliases that exist for historical reasons. In Python 3.7, the default DeprecationWarnings make things very noisy, so flip these to assertTrue and assertFalse. Signed-off-by: Mats Wichmann <[email protected]> --- src/CHANGES.txt | 1 + src/engine/SCons/JobTests.py | 70 ++++++++++++------------ src/engine/SCons/Scanner/CTests.py | 2 +- src/engine/SCons/Scanner/DTests.py | 2 +- src/engine/SCons/Scanner/FortranTests.py | 2 +- src/engine/SCons/Scanner/IDLTests.py | 2 +- src/engine/SCons/Scanner/LaTeXTests.py | 2 +- src/engine/SCons/Scanner/RCTests.py | 2 +- src/engine/SCons/Scanner/ScannerTests.py | 52 +++++++++--------- 9 files changed, 68 insertions(+), 67 deletions(-) --- a/src/engine/SCons/JobTests.py +++ b/src/engine/SCons/JobTests.py @@ -75,7 +75,7 @@ class Task(object): return True def execute(self): - self.taskmaster.test_case.failUnless(self.was_prepared, + self.taskmaster.test_case.assertTrue(self.was_prepared, "the task wasn't prepared") self.taskmaster.guard.acquire() @@ -93,17 +93,17 @@ class Task(object): def executed(self): self.taskmaster.num_executed = self.taskmaster.num_executed + 1 - self.taskmaster.test_case.failUnless(self.was_prepared, + self.taskmaster.test_case.assertTrue(self.was_prepared, "the task wasn't prepared") - self.taskmaster.test_case.failUnless(self.was_executed, + self.taskmaster.test_case.assertTrue(self.was_executed, "the task wasn't really executed") - self.taskmaster.test_case.failUnless(isinstance(self, Task), + self.taskmaster.test_case.assertTrue(isinstance(self, Task), "the task wasn't really a Task instance") def failed(self): self.taskmaster.num_failed = self.taskmaster.num_failed + 1 self.taskmaster.stop = 1 - self.taskmaster.test_case.failUnless(self.was_prepared, + self.taskmaster.test_case.assertTrue(self.was_prepared, "the task wasn't prepared") def postprocess(self): @@ -135,17 +135,17 @@ class ExceptionTask(object): def executed(self): self.taskmaster.num_executed = self.taskmaster.num_executed + 1 - self.taskmaster.test_case.failUnless(self.was_prepared, + self.taskmaster.test_case.assertTrue(self.was_prepared, "the task wasn't prepared") - self.taskmaster.test_case.failUnless(self.was_executed, + self.taskmaster.test_case.assertTrue(self.was_executed, "the task wasn't really executed") - self.taskmaster.test_case.failUnless(self.__class__ is Task, + self.taskmaster.test_case.assertTrue(self.__class__ is Task, "the task wasn't really a Task instance") def failed(self): self.taskmaster.num_failed = self.taskmaster.num_failed + 1 self.taskmaster.stop = 1 - self.taskmaster.test_case.failUnless(self.was_prepared, + self.taskmaster.test_case.assertTrue(self.was_prepared, "the task wasn't prepared") def postprocess(self): @@ -228,15 +228,15 @@ class ParallelTestCase(unittest.TestCase jobs = SCons.Job.Jobs(num_jobs, taskmaster) jobs.run() - self.failUnless(not taskmaster.tasks_were_serial(), + self.assertTrue(not taskmaster.tasks_were_serial(), "the tasks were not executed in parallel") - self.failUnless(taskmaster.all_tasks_are_executed(), + self.assertTrue(taskmaster.all_tasks_are_executed(), "all the tests were not executed") - self.failUnless(taskmaster.all_tasks_are_iterated(), + self.assertTrue(taskmaster.all_tasks_are_iterated(), "all the tests were not iterated over") - self.failUnless(taskmaster.all_tasks_are_postprocessed(), + self.assertTrue(taskmaster.all_tasks_are_postprocessed(), "all the tests were not postprocessed") - self.failIf(taskmaster.num_failed, + self.assertFalse(taskmaster.num_failed, "some task(s) failed to execute") # Verify that parallel jobs will pull all of the completed tasks @@ -291,15 +291,15 @@ class SerialTestCase(unittest.TestCase): jobs = SCons.Job.Jobs(1, taskmaster) jobs.run() - self.failUnless(taskmaster.tasks_were_serial(), + self.assertTrue(taskmaster.tasks_were_serial(), "the tasks were not executed in series") - self.failUnless(taskmaster.all_tasks_are_executed(), + self.assertTrue(taskmaster.all_tasks_are_executed(), "all the tests were not executed") - self.failUnless(taskmaster.all_tasks_are_iterated(), + self.assertTrue(taskmaster.all_tasks_are_iterated(), "all the tests were not iterated over") - self.failUnless(taskmaster.all_tasks_are_postprocessed(), + self.assertTrue(taskmaster.all_tasks_are_postprocessed(), "all the tests were not postprocessed") - self.failIf(taskmaster.num_failed, + self.assertFalse(taskmaster.num_failed, "some task(s) failed to execute") class NoParallelTestCase(unittest.TestCase): @@ -312,18 +312,18 @@ class NoParallelTestCase(unittest.TestCa try: taskmaster = Taskmaster(num_tasks, self, RandomTask) jobs = SCons.Job.Jobs(2, taskmaster) - self.failUnless(jobs.num_jobs == 1, + self.assertTrue(jobs.num_jobs == 1, "unexpected number of jobs %d" % jobs.num_jobs) jobs.run() - self.failUnless(taskmaster.tasks_were_serial(), + self.assertTrue(taskmaster.tasks_were_serial(), "the tasks were not executed in series") - self.failUnless(taskmaster.all_tasks_are_executed(), + self.assertTrue(taskmaster.all_tasks_are_executed(), "all the tests were not executed") - self.failUnless(taskmaster.all_tasks_are_iterated(), + self.assertTrue(taskmaster.all_tasks_are_iterated(), "all the tests were not iterated over") - self.failUnless(taskmaster.all_tasks_are_postprocessed(), + self.assertTrue(taskmaster.all_tasks_are_postprocessed(), "all the tests were not postprocessed") - self.failIf(taskmaster.num_failed, + self.assertFalse(taskmaster.num_failed, "some task(s) failed to execute") finally: SCons.Job.Parallel = save_Parallel @@ -337,13 +337,13 @@ class SerialExceptionTestCase(unittest.T jobs = SCons.Job.Jobs(1, taskmaster) jobs.run() - self.failIf(taskmaster.num_executed, + self.assertFalse(taskmaster.num_executed, "a task was executed") - self.failUnless(taskmaster.num_iterated == 1, + self.assertTrue(taskmaster.num_iterated == 1, "exactly one task should have been iterated") - self.failUnless(taskmaster.num_failed == 1, + self.assertTrue(taskmaster.num_failed == 1, "exactly one task should have failed") - self.failUnless(taskmaster.num_postprocessed == 1, + self.assertTrue(taskmaster.num_postprocessed == 1, "exactly one task should have been postprocessed") class ParallelExceptionTestCase(unittest.TestCase): @@ -354,13 +354,13 @@ class ParallelExceptionTestCase(unittest jobs = SCons.Job.Jobs(num_jobs, taskmaster) jobs.run() - self.failIf(taskmaster.num_executed, + self.assertFalse(taskmaster.num_executed, "a task was executed") - self.failUnless(taskmaster.num_iterated >= 1, + self.assertTrue(taskmaster.num_iterated >= 1, "one or more task should have been iterated") - self.failUnless(taskmaster.num_failed >= 1, + self.assertTrue(taskmaster.num_failed >= 1, "one or more tasks should have failed") - self.failUnless(taskmaster.num_postprocessed >= 1, + self.assertTrue(taskmaster.num_postprocessed >= 1, "one or more tasks should have been postprocessed") #--------------------------------------------------------------------- @@ -491,10 +491,10 @@ class _SConsTaskTest(unittest.TestCase): for N in testnodes: state = N.get_state() - self.failUnless(state in [SCons.Node.no_state, N.expect_to_be], + self.assertTrue(state in [SCons.Node.no_state, N.expect_to_be], "Node %s got unexpected result: %s" % (N, state)) - self.failUnless([N for N in testnodes if N.get_state()], + self.assertTrue([N for N in testnodes if N.get_state()], "no nodes ran at all.") --- a/src/engine/SCons/Scanner/CTests.py +++ b/src/engine/SCons/Scanner/CTests.py @@ -218,7 +218,7 @@ def deps_match(self, deps, headers): global my_normpath scanned = list(map(my_normpath, list(map(str, deps)))) expect = list(map(my_normpath, headers)) - self.failUnless(scanned == expect, "expect %s != scanned %s" % (expect, scanned)) + self.assertTrue(scanned == expect, "expect %s != scanned %s" % (expect, scanned)) # define some tests: --- a/src/engine/SCons/Scanner/DTests.py +++ b/src/engine/SCons/Scanner/DTests.py @@ -80,7 +80,7 @@ def deps_match(self, deps, headers): global my_normpath scanned = list(map(my_normpath, list(map(str, deps)))) expect = list(map(my_normpath, headers)) - self.failUnless(scanned == expect, "expect %s != scanned %s" % (expect, scanned)) + self.assertTrue(scanned == expect, "expect %s != scanned %s" % (expect, scanned)) """ Examples from https://dlang.org/spec/module.html --- a/src/engine/SCons/Scanner/FortranTests.py +++ b/src/engine/SCons/Scanner/FortranTests.py @@ -258,7 +258,7 @@ class DummyEnvironment(object): def deps_match(self, deps, headers): scanned = list(map(os.path.normpath, list(map(str, deps)))) expect = list(map(os.path.normpath, headers)) - self.failUnless(scanned == expect, "expect %s != scanned %s" % (expect, scanned)) + self.assertTrue(scanned == expect, "expect %s != scanned %s" % (expect, scanned)) # define some tests: --- a/src/engine/SCons/Scanner/IDLTests.py +++ b/src/engine/SCons/Scanner/IDLTests.py @@ -243,7 +243,7 @@ if os.path.normcase('foo') == os.path.no def deps_match(self, deps, headers): scanned = list(map(my_normpath, list(map(str, deps)))) expect = list(map(my_normpath, headers)) - self.failUnless(scanned == expect, "expect %s != scanned %s" % (expect, scanned)) + self.assertTrue(scanned == expect, "expect %s != scanned %s" % (expect, scanned)) # define some tests: --- a/src/engine/SCons/Scanner/LaTeXTests.py +++ b/src/engine/SCons/Scanner/LaTeXTests.py @@ -123,7 +123,7 @@ def deps_match(self, deps, headers): global my_normpath scanned = list(map(my_normpath, list(map(str, deps)))) expect = list(map(my_normpath, headers)) - self.failUnless(scanned == expect, "expect %s != scanned %s" % (expect, scanned)) + self.assertTrue(scanned == expect, "expect %s != scanned %s" % (expect, scanned)) class LaTeXScannerTestCase1(unittest.TestCase): --- a/src/engine/SCons/Scanner/RCTests.py +++ b/src/engine/SCons/Scanner/RCTests.py @@ -117,7 +117,7 @@ if os.path.normcase('foo') == os.path.no def deps_match(self, deps, headers): scanned = sorted(map(my_normpath, list(map(str, deps)))) expect = sorted(map(my_normpath, headers)) - self.failUnless(scanned == expect, "expect %s != scanned %s" % (expect, scanned)) + self.assertTrue(scanned == expect, "expect %s != scanned %s" % (expect, scanned)) # define some tests: --- a/src/engine/SCons/Scanner/ScannerTests.py +++ b/src/engine/SCons/Scanner/ScannerTests.py @@ -132,16 +132,16 @@ class BaseTestCase(unittest.TestCase): scanned = scanner(filename, env, path) scanned_strs = [str(x) for x in scanned] - self.failUnless(self.filename == filename, "the filename was passed incorrectly") - self.failUnless(self.env == env, "the environment was passed incorrectly") - self.failUnless(scanned_strs == deps, "the dependencies were returned incorrectly") + self.assertTrue(self.filename == filename, "the filename was passed incorrectly") + self.assertTrue(self.env == env, "the environment was passed incorrectly") + self.assertTrue(scanned_strs == deps, "the dependencies were returned incorrectly") for d in scanned: - self.failUnless(not isinstance(d, str), "got a string in the dependencies") + self.assertTrue(not isinstance(d, str), "got a string in the dependencies") if len(args) > 0: - self.failUnless(self.arg == args[0], "the argument was passed incorrectly") + self.assertTrue(self.arg == args[0], "the argument was passed incorrectly") else: - self.failIf(hasattr(self, "arg"), "an argument was given when it shouldn't have been") + self.assertFalse(hasattr(self, "arg"), "an argument was given when it shouldn't have been") def test___call__dict(self): """Test calling Scanner.Base objects with a dictionary""" @@ -245,7 +245,7 @@ class BaseTestCase(unittest.TestCase): dict[s] = 777 i = hash(id(s)) h = hash(list(dict.keys())[0]) - self.failUnless(h == i, + self.assertTrue(h == i, "hash Scanner base class expected %s, got %s" % (i, h)) def test_scan_check(self): @@ -260,7 +260,7 @@ class BaseTestCase(unittest.TestCase): self.checked = {} path = s.path(env) scanned = s(DummyNode('x'), env, path) - self.failUnless(self.checked['x'] == 1, + self.assertTrue(self.checked['x'] == 1, "did not call check function") def test_recursive(self): @@ -269,42 +269,42 @@ class BaseTestCase(unittest.TestCase): s = SCons.Scanner.Base(function = self.func) n = s.recurse_nodes(nodes) - self.failUnless(n == [], + self.assertTrue(n == [], "default behavior returned nodes: %s" % n) s = SCons.Scanner.Base(function = self.func, recursive = None) n = s.recurse_nodes(nodes) - self.failUnless(n == [], + self.assertTrue(n == [], "recursive = None returned nodes: %s" % n) s = SCons.Scanner.Base(function = self.func, recursive = 1) n = s.recurse_nodes(nodes) - self.failUnless(n == n, + self.assertTrue(n == n, "recursive = 1 didn't return all nodes: %s" % n) def odd_only(nodes): return [n for n in nodes if n % 2] s = SCons.Scanner.Base(function = self.func, recursive = odd_only) n = s.recurse_nodes(nodes) - self.failUnless(n == [1, 3], + self.assertTrue(n == [1, 3], "recursive = 1 didn't return all nodes: %s" % n) def test_get_skeys(self): """Test the Scanner.Base get_skeys() method""" s = SCons.Scanner.Base(function = self.func) sk = s.get_skeys() - self.failUnless(sk == [], + self.assertTrue(sk == [], "did not initialize to expected []") s = SCons.Scanner.Base(function = self.func, skeys = ['.1', '.2']) sk = s.get_skeys() - self.failUnless(sk == ['.1', '.2'], + self.assertTrue(sk == ['.1', '.2'], "sk was %s, not ['.1', '.2']") s = SCons.Scanner.Base(function = self.func, skeys = '$LIST') env = DummyEnvironment(LIST = ['.3', '.4']) sk = s.get_skeys(env) - self.failUnless(sk == ['.3', '.4'], + self.assertTrue(sk == ['.3', '.4'], "sk was %s, not ['.3', '.4']") def test_select(self): @@ -432,19 +432,19 @@ class CurrentTestCase(unittest.TestCase) path = s.path(env) hnb = HasNoBuilder() s(hnb, env, path) - self.failUnless(hnb.called_has_builder, "did not call has_builder()") - self.failUnless(not hnb.called_is_up_to_date, "did call is_up_to_date()") - self.failUnless(hnb.func_called, "did not call func()") + self.assertTrue(hnb.called_has_builder, "did not call has_builder()") + self.assertTrue(not hnb.called_is_up_to_date, "did call is_up_to_date()") + self.assertTrue(hnb.func_called, "did not call func()") inc = IsNotCurrent() s(inc, env, path) - self.failUnless(inc.called_has_builder, "did not call has_builder()") - self.failUnless(inc.called_is_up_to_date, "did not call is_up_to_date()") - self.failUnless(not inc.func_called, "did call func()") + self.assertTrue(inc.called_has_builder, "did not call has_builder()") + self.assertTrue(inc.called_is_up_to_date, "did not call is_up_to_date()") + self.assertTrue(not inc.func_called, "did call func()") ic = IsCurrent() s(ic, env, path) - self.failUnless(ic.called_has_builder, "did not call has_builder()") - self.failUnless(ic.called_is_up_to_date, "did not call is_up_to_date()") - self.failUnless(ic.func_called, "did not call func()") + self.assertTrue(ic.called_has_builder, "did not call has_builder()") + self.assertTrue(ic.called_is_up_to_date, "did not call is_up_to_date()") + self.assertTrue(ic.func_called, "did not call func()") class ClassicTestCase(unittest.TestCase): @@ -566,7 +566,7 @@ class ClassicTestCase(unittest.TestCase) s = SCons.Scanner.Classic("Test", [], None, "", function=self.func, recursive=1) n = s.recurse_nodes(nodes) - self.failUnless(n == n, + self.assertTrue(n == n, "recursive = 1 didn't return all nodes: %s" % n) def odd_only(nodes): @@ -574,7 +574,7 @@ class ClassicTestCase(unittest.TestCase) s = SCons.Scanner.Classic("Test", [], None, "", function=self.func, recursive=odd_only) n = s.recurse_nodes(nodes) - self.failUnless(n == [1, 3], + self.assertTrue(n == [1, 3], "recursive = 1 didn't return all nodes: %s" % n) ++++++ no_time-clock.patch ++++++ --- a/runtest.py +++ b/runtest.py @@ -92,8 +92,10 @@ try: import threading try: # python3 from queue import Queue + PY3=True except ImportError as e: # python2 from Queue import Queue + PY3=False threading_ok = True except ImportError: print("Can't import threading or queue") @@ -764,10 +766,13 @@ os.environ["python_executable"] = python # but time.time() does a better job on Linux systems, so let that be # the non-Windows default. -if sys.platform == 'win32': - time_func = time.clock -else: - time_func = time.time +try: + time_func = time.perf_counter +except AttributeError: + if sys.platform == 'win32': + time_func = time.clock + else: + time_func = time.time if print_times: print_time_func = lambda fmt, time: sys.stdout.write(fmt % time) ++++++ removed_splitunc.patch ++++++ --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -132,7 +132,10 @@ def initialize_do_splitdrive(): global do_splitdrive global has_unc drive, path = os.path.splitdrive('X:/foo') - has_unc = hasattr(os.path, 'splitunc') + # splitunc is removed from python 3.7 and newer + # so we can also just test if splitdrive works with UNC + has_unc = (hasattr(os.path, 'splitunc') + or os.path.splitdrive(r'\\split\drive\test')[0] == r'\\split\drive') do_splitdrive = not not drive or has_unc --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -605,7 +605,7 @@ class VariantDirTestCase(unittest.TestCa 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): @@ -1657,7 +1657,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:] ++++++ replace_TestSuite_main.patch ++++++ ++++ 713 lines (skipped) ++++++ scons-3.0.0-fix-install.patch ++++++ --- /var/tmp/diff_new_pack.IPSHTa/_old 2018-10-12 13:09:56.003364693 +0200 +++ /var/tmp/diff_new_pack.IPSHTa/_new 2018-10-12 13:09:56.003364693 +0200 @@ -2,8 +2,8 @@ setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---- a/setup.py -+++ b/setup.py +--- a/src/setup.py ++++ b/src/setup.py @@ -376,7 +376,7 @@ class install_data(_install_data): if is_win32: dir = 'Doc' ++++++ stop_custom_OrderedDict.patch ++++++ >From 2180ff6d0388162586fff59e066bc1e3e4bb9600 Mon Sep 17 00:00:00 2001 From: Mats Wichmann <[email protected]> Date: Sun, 26 Aug 2018 22:54:00 -0600 Subject: [PATCH] Stop using custom OrderedDict OrdredDict is in the standard library for all supported Python versions (2.7 and 3.5+) and has improvements over the ActiveState recipe version of OrderedDict we have been using. Switch to importing from collections instead of getting it from SCons.Util (tests already did this). At the same time, reorganize the Util.py imports - import Iterable from collections.abc if possible (it is deprecated to import it from collections, will stop working in 3.8); try getting the User{Dict,List,String} from collections if possible - that is, try the 3.x way first. Signed-off-by: Mats Wichmann <[email protected]> --- src/engine/SCons/Action.py | 3 +- src/engine/SCons/Tool/javac.py | 3 +- src/engine/SCons/Util.py | 74 +++++----------------------------- 3 files changed, 13 insertions(+), 67 deletions(-) --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -107,6 +107,7 @@ import sys import subprocess import itertools import inspect +from collections import OrderedDict import SCons.Debug from SCons.Debug import logInstanceCreation @@ -1289,7 +1290,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 --- a/src/engine/SCons/Tool/javac.py +++ b/src/engine/SCons/Tool/javac.py @@ -34,6 +34,7 @@ __revision__ = "__FILE__ __REVISION__ __ import os import os.path +from collections import OrderedDict import SCons.Action import SCons.Builder @@ -70,7 +71,7 @@ def emit_java_classes(target, source, en if isinstance(entry, SCons.Node.FS.File): slist.append(entry) elif isinstance(entry, SCons.Node.FS.Dir): - result = SCons.Util.OrderedDict() + result = OrderedDict() dirnode = entry.rdir() def find_java_files(arg, dirpath, filenames): java_files = sorted([n for n in filenames --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -37,21 +37,18 @@ import pprint PY3 = sys.version_info[0] == 3 try: + from collections import UserDict, UserList, UserString +except ImportError: from UserDict import UserDict -except ImportError as e: - from collections import UserDict - -try: from UserList import UserList -except ImportError as e: - from collections import UserList - -from collections import Iterable + from UserString import UserString try: - from UserString import UserString -except ImportError as e: - from collections import UserString + from collections.abc import Iterable +except ImportError: + from collections import Iterable + +from collections import OrderedDict # Don't "from types import ..." these because we need to get at the # types module later to look for UnicodeType. @@ -63,7 +60,7 @@ MethodType = types.MethodType FunctionType = types.FunctionType try: - unicode + _ = type(unicode) except NameError: UnicodeType = str else: @@ -1034,59 +1031,6 @@ class CLVar(UserList): def __str__(self): return ' '.join(self.data) -# A dictionary that preserves the order in which items are added. -# Submitted by David Benjamin to ActiveState's Python Cookbook web site: -# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/107747 -# Including fixes/enhancements from the follow-on discussions. -class OrderedDict(UserDict): - def __init__(self, dict = None): - self._keys = [] - UserDict.__init__(self, dict) - - def __delitem__(self, key): - UserDict.__delitem__(self, key) - self._keys.remove(key) - - def __setitem__(self, key, item): - UserDict.__setitem__(self, key, item) - if key not in self._keys: self._keys.append(key) - - def clear(self): - UserDict.clear(self) - self._keys = [] - - def copy(self): - dict = OrderedDict() - dict.update(self) - return dict - - def items(self): - return list(zip(self._keys, list(self.values()))) - - def keys(self): - return self._keys[:] - - def popitem(self): - try: - key = self._keys[-1] - except IndexError: - raise KeyError('dictionary is empty') - - val = self[key] - del self[key] - - return (key, val) - - def setdefault(self, key, failobj = None): - UserDict.setdefault(self, key, failobj) - if key not in self._keys: self._keys.append(key) - - def update(self, dict): - for (key, val) in dict.items(): - self.__setitem__(key, val) - - def values(self): - return list(map(self.get, self._keys)) class Selector(OrderedDict): """A callable ordered dictionary that maps file suffixes to
