Accepting request 662758 from devel:tools:building
OBS-URL: https://build.opensuse.org/request/show/662758 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/scons?expand=0&rev=38
This commit is contained in:
commit
ebf362dc72
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:37b2d8ba2b869a397cf0007026b793230a97d6aa9545db9568755cd282dd5f53
|
||||
size 5481813
|
3
3.0.2.tar.gz
Normal file
3
3.0.2.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c2c2dc505969bdb0797e1d3725f300ac796e4a0a140db137d3065b8f2ae1d27f
|
||||
size 5496414
|
@ -1,26 +0,0 @@
|
||||
--- 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']
|
@ -1,114 +0,0 @@
|
||||
--- 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')
|
@ -1,6 +1,7 @@
|
||||
src/engine/SCons/ActionTests.py
|
||||
src/engine/SCons/dblite.py
|
||||
src/engine/SCons/EnvironmentValuesTest.py
|
||||
src/engine/SCons/Node/FS.py
|
||||
src/engine/SCons/Options/__init__.py
|
||||
src/engine/SCons/Platform/aix.py
|
||||
src/engine/SCons/Platform/cygwin.py
|
||||
@ -169,6 +170,15 @@ test/Java/source-files.py
|
||||
test/Java/swig-dependencies.py
|
||||
test/LEX/live.py
|
||||
test/long-lines/signature.py
|
||||
test/Parallel/failed-build.py
|
||||
test/virtualenv/unactivated/virtualenv_unactivated_python.py
|
||||
test/virtualenv/activated/virtualenv_detect_virtualenv.py
|
||||
test/virtualenv/activated/virtualenv_activated_python.py
|
||||
test/virtualenv/activated/option/ignore-virtualenv.py
|
||||
test/virtualenv/activated/option/enable-virtualenv.py
|
||||
test/MSVC/MSVC_BATCH-spaces-targetdir.py
|
||||
test/Java/Java-1.8.py
|
||||
test/Fortran/gfortran.py
|
||||
test/MinGW/MinGWSharedLibrary.py
|
||||
test/MinGW/WINDOWS_INSERT_DEF.py
|
||||
test/MSVC/batch-longlines.py
|
||||
|
@ -1,400 +0,0 @@
|
||||
From 9864e8bf0a69f6aa35bb6af794da9988b1bbc50b Mon Sep 17 00:00:00 2001
|
||||
From: Mats Wichmann <mats@linux.com>
|
||||
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 <mats@linux.com>
|
||||
---
|
||||
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)
|
||||
|
||||
|
@ -1,31 +0,0 @@
|
||||
--- 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)
|
@ -1,39 +0,0 @@
|
||||
--- 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:]
|
||||
|
@ -1,713 +0,0 @@
|
||||
--- a/src/engine/SCons/ActionTests.py
|
||||
+++ b/src/engine/SCons/ActionTests.py
|
||||
@@ -47,7 +47,6 @@ import SCons.Environment
|
||||
import SCons.Errors
|
||||
|
||||
import TestCmd
|
||||
-import TestUnit
|
||||
|
||||
# Initial setup of the common environment for all tests,
|
||||
# a temporary working directory containing a
|
||||
--- a/src/engine/SCons/CacheDirTests.py
|
||||
+++ b/src/engine/SCons/CacheDirTests.py
|
||||
@@ -29,7 +29,6 @@ import sys
|
||||
import unittest
|
||||
|
||||
from TestCmd import TestCmd
|
||||
-import TestUnit
|
||||
|
||||
import SCons.CacheDir
|
||||
|
||||
@@ -287,16 +286,7 @@ class FileTestCase(BaseTestCase):
|
||||
SCons.CacheDir.CacheRetrieveSilent = save_CacheRetrieveSilent
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.TestSuite()
|
||||
- tclasses = [
|
||||
- CacheDirTestCase,
|
||||
- FileTestCase,
|
||||
- ]
|
||||
- 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
|
||||
# indent-tabs-mode:nil
|
||||
--- a/src/engine/SCons/DefaultsTests.py
|
||||
+++ b/src/engine/SCons/DefaultsTests.py
|
||||
@@ -32,7 +32,6 @@ import unittest
|
||||
from collections import UserDict
|
||||
|
||||
import TestCmd
|
||||
-import TestUnit
|
||||
|
||||
import SCons.Errors
|
||||
|
||||
@@ -77,13 +76,7 @@ class DefaultsTestCase(unittest.TestCase
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.TestSuite()
|
||||
- tclasses = [ DefaultsTestCase,
|
||||
- ]
|
||||
- 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
|
||||
--- a/src/engine/SCons/ErrorsTests.py
|
||||
+++ b/src/engine/SCons/ErrorsTests.py
|
||||
@@ -26,8 +26,6 @@ __revision__ = "__FILE__ __REVISION__ __
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
-import TestUnit
|
||||
-
|
||||
import SCons.Errors
|
||||
|
||||
|
||||
@@ -101,8 +99,7 @@ class ErrorsTestCase(unittest.TestCase):
|
||||
assert e.node == "node"
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.makeSuite(ErrorsTestCase, 'test_')
|
||||
- TestUnit.run(suite)
|
||||
+ unittest.main()
|
||||
|
||||
# Local Variables:
|
||||
# tab-width:4
|
||||
--- a/src/engine/SCons/ExecutorTests.py
|
||||
+++ b/src/engine/SCons/ExecutorTests.py
|
||||
@@ -26,8 +26,6 @@ __revision__ = "__FILE__ __REVISION__ __
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
-import TestUnit
|
||||
-
|
||||
import SCons.Executor
|
||||
|
||||
|
||||
@@ -483,12 +481,7 @@ class ExecutorTestCase(unittest.TestCase
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.TestSuite()
|
||||
- tclasses = [ ExecutorTestCase ]
|
||||
- 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
|
||||
--- a/src/engine/SCons/MemoizeTests.py
|
||||
+++ b/src/engine/SCons/MemoizeTests.py
|
||||
@@ -26,8 +26,6 @@ __revision__ = "__FILE__ __REVISION__ __
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
-import TestUnit
|
||||
-
|
||||
import SCons.Memoize
|
||||
|
||||
# Enable memoization counting
|
||||
@@ -165,15 +163,7 @@ class CountValueTestCase(unittest.TestCa
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.TestSuite()
|
||||
- tclasses = [
|
||||
- CountDictTestCase,
|
||||
- CountValueTestCase,
|
||||
- ]
|
||||
- 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
|
||||
--- a/src/engine/SCons/Node/AliasTests.py
|
||||
+++ b/src/engine/SCons/Node/AliasTests.py
|
||||
@@ -26,8 +26,6 @@ __revision__ = "__FILE__ __REVISION__ __
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
-import TestUnit
|
||||
-
|
||||
import SCons.Errors
|
||||
import SCons.Node.Alias
|
||||
|
||||
@@ -113,16 +111,7 @@ class AliasBuildInfoTestCase(unittest.Te
|
||||
bi = SCons.Node.Alias.AliasBuildInfo()
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.TestSuite()
|
||||
- tclasses = [
|
||||
- AliasTestCase,
|
||||
- AliasBuildInfoTestCase,
|
||||
- AliasNodeInfoTestCase,
|
||||
- ]
|
||||
- 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
|
||||
--- a/src/engine/SCons/Node/NodeTests.py
|
||||
+++ b/src/engine/SCons/Node/NodeTests.py
|
||||
@@ -30,8 +30,6 @@ import re
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
-import TestUnit
|
||||
-
|
||||
import SCons.Errors
|
||||
import SCons.Node
|
||||
import SCons.Util
|
||||
@@ -1349,15 +1347,7 @@ class NodeListTestCase(unittest.TestCase
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.TestSuite()
|
||||
- tclasses = [ BuildInfoBaseTestCase,
|
||||
- NodeInfoBaseTestCase,
|
||||
- NodeTestCase,
|
||||
- NodeListTestCase ]
|
||||
- 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
|
||||
--- a/src/engine/SCons/Node/PythonTests.py
|
||||
+++ b/src/engine/SCons/Node/PythonTests.py
|
||||
@@ -26,8 +26,6 @@ __revision__ = "__FILE__ __REVISION__ __
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
-import TestUnit
|
||||
-
|
||||
import SCons.Errors
|
||||
import SCons.Node.Python
|
||||
|
||||
@@ -113,16 +111,7 @@ class ValueBuildInfoTestCase(unittest.Te
|
||||
bi = SCons.Node.Python.ValueBuildInfo()
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.TestSuite()
|
||||
- tclasses = [
|
||||
- ValueTestCase,
|
||||
- ValueBuildInfoTestCase,
|
||||
- ValueNodeInfoTestCase,
|
||||
- ]
|
||||
- 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
|
||||
--- a/src/engine/SCons/Platform/PlatformTests.py
|
||||
+++ b/src/engine/SCons/Platform/PlatformTests.py
|
||||
@@ -28,8 +28,6 @@ import SCons.compat
|
||||
import collections
|
||||
import unittest
|
||||
|
||||
-import TestUnit
|
||||
-
|
||||
import SCons.Errors
|
||||
import SCons.Platform
|
||||
import SCons.Environment
|
||||
@@ -204,17 +202,8 @@ class PlatformEscapeTestCase(unittest.Te
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.TestSuite()
|
||||
-
|
||||
- tclasses = [ PlatformTestCase,
|
||||
- TempFileMungeTestCase,
|
||||
- PlatformEscapeTestCase,
|
||||
- ]
|
||||
- for tclass in tclasses:
|
||||
- names = unittest.getTestCaseNames(tclass, 'test_')
|
||||
- suite.addTests(list(map(tclass, names)))
|
||||
+ unittest.main()
|
||||
|
||||
- TestUnit.run(suite)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width:4
|
||||
--- a/src/engine/SCons/SConfTests.py
|
||||
+++ b/src/engine/SCons/SConfTests.py
|
||||
@@ -33,8 +33,6 @@ from types import *
|
||||
import unittest
|
||||
|
||||
import TestCmd
|
||||
-import TestUnit
|
||||
-
|
||||
|
||||
sys.stdout = io.StringIO()
|
||||
|
||||
--- a/src/engine/SCons/Scanner/DTests.py
|
||||
+++ b/src/engine/SCons/Scanner/DTests.py
|
||||
@@ -26,7 +26,6 @@ __revision__ = "__FILE__ __REVISION__ __
|
||||
import unittest
|
||||
|
||||
import TestCmd
|
||||
-import TestUnit
|
||||
|
||||
import SCons.Scanner.D
|
||||
|
||||
@@ -266,14 +265,7 @@ class DScannerTestCase(unittest.TestCase
|
||||
self.helper('multiline.d', ['A.d'])
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.TestSuite()
|
||||
- tclasses = [
|
||||
- DScannerTestCase,
|
||||
- ]
|
||||
- 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
|
||||
--- a/src/engine/SCons/Scanner/DirTests.py
|
||||
+++ b/src/engine/SCons/Scanner/DirTests.py
|
||||
@@ -28,7 +28,6 @@ import sys
|
||||
import unittest
|
||||
|
||||
import TestCmd
|
||||
-import TestUnit
|
||||
|
||||
import SCons.Node.FS
|
||||
import SCons.Scanner.Dir
|
||||
@@ -121,14 +120,8 @@ class DirEntryScannerTestCase(DirScanner
|
||||
sss = list(map(str, deps))
|
||||
assert sss == [], sss
|
||||
|
||||
-def suite():
|
||||
- suite = unittest.TestSuite()
|
||||
- suite.addTest(DirScannerTestCase())
|
||||
- suite.addTest(DirEntryScannerTestCase())
|
||||
- return suite
|
||||
-
|
||||
if __name__ == "__main__":
|
||||
- TestUnit.run(suite())
|
||||
+ unittest.main()
|
||||
|
||||
# Local Variables:
|
||||
# tab-width:4
|
||||
--- a/src/engine/SCons/Scanner/LaTeXTests.py
|
||||
+++ b/src/engine/SCons/Scanner/LaTeXTests.py
|
||||
@@ -31,7 +31,6 @@ import sys
|
||||
import unittest
|
||||
|
||||
import TestCmd
|
||||
-import TestUnit
|
||||
|
||||
import SCons.Node.FS
|
||||
import SCons.Scanner.LaTeX
|
||||
@@ -156,16 +155,8 @@ class LaTeXScannerTestCase3(unittest.Tes
|
||||
files = ['inc5.xyz', 'subdir/inc4.eps']
|
||||
deps_match(self, deps, files)
|
||||
|
||||
-
|
||||
-def suite():
|
||||
- suite = unittest.TestSuite()
|
||||
- suite.addTest(LaTeXScannerTestCase1())
|
||||
- suite.addTest(LaTeXScannerTestCase2())
|
||||
- suite.addTest(LaTeXScannerTestCase3())
|
||||
- return suite
|
||||
-
|
||||
if __name__ == "__main__":
|
||||
- TestUnit.run(suite())
|
||||
+ unittest.main()
|
||||
|
||||
# Local Variables:
|
||||
# tab-width:4
|
||||
--- a/src/engine/SCons/Scanner/ProgTests.py
|
||||
+++ b/src/engine/SCons/Scanner/ProgTests.py
|
||||
@@ -28,7 +28,6 @@ import sys
|
||||
import unittest
|
||||
|
||||
import TestCmd
|
||||
-import TestUnit
|
||||
|
||||
import SCons.Node.FS
|
||||
import SCons.Scanner.Prog
|
||||
@@ -274,7 +273,7 @@ def suite():
|
||||
return suite
|
||||
|
||||
if __name__ == "__main__":
|
||||
- TestUnit.run(suite())
|
||||
+ unittest.main()
|
||||
|
||||
# Local Variables:
|
||||
# tab-width:4
|
||||
--- a/src/engine/SCons/Scanner/RCTests.py
|
||||
+++ b/src/engine/SCons/Scanner/RCTests.py
|
||||
@@ -29,7 +29,6 @@ import collections
|
||||
import os
|
||||
|
||||
import TestCmd
|
||||
-import TestUnit
|
||||
|
||||
import SCons.Scanner.RC
|
||||
import SCons.Node.FS
|
||||
@@ -167,7 +166,7 @@ def suite():
|
||||
return suite
|
||||
|
||||
if __name__ == "__main__":
|
||||
- TestUnit.run(suite())
|
||||
+ unittest.main()
|
||||
|
||||
# Local Variables:
|
||||
# tab-width:4
|
||||
--- a/src/engine/SCons/Script/MainTests.py
|
||||
+++ b/src/engine/SCons/Script/MainTests.py
|
||||
@@ -25,8 +25,6 @@ __revision__ = "__FILE__ __REVISION__ __
|
||||
|
||||
import unittest
|
||||
|
||||
-import TestUnit
|
||||
-
|
||||
import SCons.Errors
|
||||
import SCons.Script.Main
|
||||
|
||||
@@ -41,12 +39,7 @@ import SCons.Script.Main
|
||||
# of private functionality.
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.TestSuite()
|
||||
- tclasses = []
|
||||
- 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
|
||||
--- a/src/engine/SCons/SubstTests.py
|
||||
+++ b/src/engine/SCons/SubstTests.py
|
||||
@@ -32,8 +32,6 @@ import unittest
|
||||
|
||||
from collections import UserDict
|
||||
|
||||
-import TestUnit
|
||||
-
|
||||
import SCons.Errors
|
||||
|
||||
from SCons.Subst import *
|
||||
@@ -1243,21 +1241,7 @@ class subst_dict_TestCase(unittest.TestC
|
||||
assert SOURCES == ['s3', 'v-rstr-s4', 'v-s5'], SOURCES
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.TestSuite()
|
||||
- tclasses = [
|
||||
- CLVar_TestCase,
|
||||
- LiteralTestCase,
|
||||
- SpecialAttrWrapperTestCase,
|
||||
- quote_spaces_TestCase,
|
||||
- scons_subst_TestCase,
|
||||
- scons_subst_list_TestCase,
|
||||
- scons_subst_once_TestCase,
|
||||
- subst_dict_TestCase,
|
||||
- ]
|
||||
- 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
|
||||
--- a/src/engine/SCons/TaskmasterTests.py
|
||||
+++ b/src/engine/SCons/TaskmasterTests.py
|
||||
@@ -30,7 +30,6 @@ import copy
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
-import TestUnit
|
||||
|
||||
import SCons.Taskmaster
|
||||
import SCons.Errors
|
||||
@@ -1239,8 +1238,7 @@ Taskmaster: No candidate anymore.
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.makeSuite(TaskmasterTestCase, 'test_')
|
||||
- TestUnit.run(suite)
|
||||
+ unittest.main()
|
||||
|
||||
# Local Variables:
|
||||
# tab-width:4
|
||||
--- a/src/engine/SCons/Tool/JavaCommonTests.py
|
||||
+++ b/src/engine/SCons/Tool/JavaCommonTests.py
|
||||
@@ -27,8 +27,6 @@ import os.path
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
-import TestUnit
|
||||
-
|
||||
import SCons.Scanner.IDL
|
||||
import SCons.Tool.JavaCommon
|
||||
|
||||
@@ -568,12 +566,7 @@ public class Foo
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.TestSuite()
|
||||
- tclasses = [ parse_javaTestCase ]
|
||||
- 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
|
||||
--- a/src/engine/SCons/Tool/javacTests.py
|
||||
+++ b/src/engine/SCons/Tool/javacTests.py
|
||||
@@ -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()
|
||||
--- a/src/engine/SCons/Tool/wixTests.py
|
||||
+++ b/src/engine/SCons/Tool/wixTests.py
|
||||
@@ -33,7 +33,6 @@ from SCons.Tool.wix import *
|
||||
from SCons.Environment import Environment
|
||||
|
||||
import TestCmd
|
||||
-import TestUnit
|
||||
|
||||
|
||||
# create fake candle and light, so the tool's exists() method will succeed
|
||||
@@ -53,8 +52,7 @@ class WixTestCase(unittest.TestCase):
|
||||
assert env.subst('$WIXSRCSUF') == '.wxs'
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.makeSuite(WixTestCase, 'test_')
|
||||
- TestUnit.run(suite)
|
||||
+ unittest.main()
|
||||
|
||||
# Local Variables:
|
||||
# tab-width:4
|
||||
--- a/src/engine/SCons/UtilTests.py
|
||||
+++ b/src/engine/SCons/UtilTests.py
|
||||
@@ -32,7 +32,6 @@ import unittest
|
||||
from collections import UserDict, UserList, UserString
|
||||
|
||||
import TestCmd
|
||||
-import TestUnit
|
||||
|
||||
import SCons.Errors
|
||||
|
||||
--- a/src/engine/SCons/Variables/BoolVariableTests.py
|
||||
+++ b/src/engine/SCons/Variables/BoolVariableTests.py
|
||||
@@ -26,8 +26,6 @@ __revision__ = "__FILE__ __REVISION__ __
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
-import TestUnit
|
||||
-
|
||||
import SCons.Errors
|
||||
import SCons.Variables
|
||||
|
||||
@@ -118,8 +116,7 @@ class BoolVariableTestCase(unittest.Test
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.makeSuite(BoolVariableTestCase, 'test_')
|
||||
- TestUnit.run(suite)
|
||||
+ unittest.main()
|
||||
|
||||
# Local Variables:
|
||||
# tab-width:4
|
||||
--- a/src/engine/SCons/Variables/EnumVariableTests.py
|
||||
+++ b/src/engine/SCons/Variables/EnumVariableTests.py
|
||||
@@ -26,8 +26,6 @@ __revision__ = "__FILE__ __REVISION__ __
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
-import TestUnit
|
||||
-
|
||||
import SCons.Errors
|
||||
import SCons.Variables
|
||||
|
||||
@@ -195,8 +193,7 @@ class EnumVariableTestCase(unittest.Test
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.makeSuite(EnumVariableTestCase, 'test_')
|
||||
- TestUnit.run(suite)
|
||||
+ unittest.main()
|
||||
|
||||
# Local Variables:
|
||||
# tab-width:4
|
||||
--- a/src/engine/SCons/Variables/ListVariableTests.py
|
||||
+++ b/src/engine/SCons/Variables/ListVariableTests.py
|
||||
@@ -27,8 +27,6 @@ import copy
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
-import TestUnit
|
||||
-
|
||||
import SCons.Errors
|
||||
import SCons.Variables
|
||||
|
||||
@@ -125,8 +123,7 @@ class ListVariableTestCase(unittest.Test
|
||||
n = l.__class__(copy.copy(l))
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.makeSuite(ListVariableTestCase, 'test_')
|
||||
- TestUnit.run(suite)
|
||||
+ unittest.main()
|
||||
|
||||
# Local Variables:
|
||||
# tab-width:4
|
||||
--- a/src/engine/SCons/Variables/PackageVariableTests.py
|
||||
+++ b/src/engine/SCons/Variables/PackageVariableTests.py
|
||||
@@ -30,8 +30,6 @@ import SCons.Errors
|
||||
import SCons.Variables
|
||||
|
||||
import TestCmd
|
||||
-import TestUnit
|
||||
-
|
||||
|
||||
class PackageVariableTestCase(unittest.TestCase):
|
||||
def test_PackageVariable(self):
|
||||
@@ -115,8 +113,7 @@ class PackageVariableTestCase(unittest.T
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.makeSuite(PackageVariableTestCase, 'test_')
|
||||
- TestUnit.run(suite)
|
||||
+ unittest.main()
|
||||
|
||||
# Local Variables:
|
||||
# tab-width:4
|
||||
--- a/src/engine/SCons/Variables/PathVariableTests.py
|
||||
+++ b/src/engine/SCons/Variables/PathVariableTests.py
|
||||
@@ -31,8 +31,6 @@ import SCons.Errors
|
||||
import SCons.Variables
|
||||
|
||||
import TestCmd
|
||||
-import TestUnit
|
||||
-
|
||||
|
||||
class PathVariableTestCase(unittest.TestCase):
|
||||
def test_PathVariable(self):
|
||||
@@ -228,8 +226,7 @@ class PathVariableTestCase(unittest.Test
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.makeSuite(PathVariableTestCase, 'test_')
|
||||
- TestUnit.run(suite)
|
||||
+ unittest.main()
|
||||
|
||||
# Local Variables:
|
||||
# tab-width:4
|
||||
--- a/src/engine/SCons/Variables/VariablesTests.py
|
||||
+++ b/src/engine/SCons/Variables/VariablesTests.py
|
||||
@@ -27,7 +27,6 @@ import sys
|
||||
import unittest
|
||||
|
||||
import TestSCons
|
||||
-import TestUnit
|
||||
|
||||
import SCons.Variables
|
||||
import SCons.Subst
|
||||
@@ -60,7 +59,9 @@ def check(key, value, env):
|
||||
def checkSave(file, expected):
|
||||
gdict = {}
|
||||
ldict = {}
|
||||
- exec(open(file, 'r').read(), gdict, ldict)
|
||||
+ with open(file, 'r') as f:
|
||||
+ exec(f.read(), gdict, ldict)
|
||||
+
|
||||
assert expected == ldict, "%s\n...not equal to...\n%s" % (expected, ldict)
|
||||
|
||||
class VariablesTestCase(unittest.TestCase):
|
||||
@@ -690,13 +691,7 @@ class UnknownVariablesTestCase(unittest.
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.TestSuite()
|
||||
- tclasses = [ VariablesTestCase,
|
||||
- UnknownVariablesTestCase ]
|
||||
- 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
|
||||
--- a/src/engine/SCons/WarningsTests.py
|
||||
+++ b/src/engine/SCons/WarningsTests.py
|
||||
@@ -26,8 +26,6 @@ __revision__ = "__FILE__ __REVISION__ __
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
-import TestUnit
|
||||
-
|
||||
import SCons.Warnings
|
||||
|
||||
class TestOutput(object):
|
||||
@@ -127,8 +125,7 @@ class WarningsTestCase(unittest.TestCase
|
||||
assert to.out == "Foo", to.out
|
||||
|
||||
if __name__ == "__main__":
|
||||
- suite = unittest.makeSuite(WarningsTestCase, 'test_')
|
||||
- TestUnit.run(suite)
|
||||
+ unittest.main()
|
||||
|
||||
# Local Variables:
|
||||
# tab-width:4
|
@ -1,3 +1,15 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Jan 3 13:21:11 UTC 2019 - davejplater@gmail.com
|
||||
|
||||
- Update to version 3.0.2, now works properly with python3 and
|
||||
fixes boo#1083830.
|
||||
- Removed incorporated patches: no_deprecated_asserts.patch,
|
||||
removed_splitunc.patch, fix-jN-for-python-37.patch,
|
||||
replace_TestSuite_main.patch, stop_custom_OrderedDict.patch,
|
||||
no_time-clock.patch and fix-rpm-tests-for-newer-rpmbuild.patch.
|
||||
- Upstream changes are too many to list see :
|
||||
/usr/share/doc/packages/scons/CHANGES.txt
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Oct 11 10:30:44 UTC 2018 - Matěj Cepl <mcepl@suse.com>
|
||||
|
||||
|
19
scons.spec
19
scons.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package scons
|
||||
#
|
||||
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -12,7 +12,7 @@
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ Name: %{modname}-%{flavor}
|
||||
%else
|
||||
Name: %{modname}
|
||||
%endif
|
||||
Version: 3.0.1
|
||||
Version: 3.0.2
|
||||
Release: 0
|
||||
Summary: Replacement for Make
|
||||
License: MIT
|
||||
@ -42,24 +42,15 @@ Group: Development/Tools/Building
|
||||
URL: http://www.scons.org/
|
||||
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
|
||||
Source1: scons-user.html-3.0.1.tar.bz2
|
||||
# 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
|
||||
BuildRequires: python3-setuptools
|
||||
Requires: python3-base >= 3.5
|
||||
%if %{with test}
|
||||
# For tests
|
||||
|
@ -1,162 +0,0 @@
|
||||
From 2180ff6d0388162586fff59e066bc1e3e4bb9600 Mon Sep 17 00:00:00 2001
|
||||
From: Mats Wichmann <mats@linux.com>
|
||||
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 <mats@linux.com>
|
||||
---
|
||||
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
|
Loading…
Reference in New Issue
Block a user