summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--QMTest/TestCmd.py14
-rw-r--r--QMTest/TestCommon.py25
-rw-r--r--ReleaseConfig2
-rw-r--r--bin/scons-proc.py6
-rwxr-xr-xruntest.py15
-rw-r--r--src/engine/SCons/Action.py13
-rw-r--r--src/engine/SCons/ActionTests.py81
-rw-r--r--src/engine/SCons/Environment.py19
-rw-r--r--src/engine/SCons/EnvironmentTests.py25
-rw-r--r--src/engine/SCons/Executor.py3
-rw-r--r--src/engine/SCons/Job.py10
-rw-r--r--src/engine/SCons/Node/FS.py53
-rw-r--r--src/engine/SCons/Node/FSTests.py10
-rw-r--r--src/engine/SCons/Node/NodeTests.py2
-rw-r--r--src/engine/SCons/Node/__init__.py7
-rw-r--r--src/engine/SCons/PathList.py2
-rw-r--r--src/engine/SCons/Platform/__init__.py2
-rw-r--r--src/engine/SCons/Platform/win32.py10
-rw-r--r--src/engine/SCons/SConf.py19
-rw-r--r--src/engine/SCons/SConfTests.py5
-rw-r--r--src/engine/SCons/Scanner/C.py2
-rw-r--r--src/engine/SCons/Scanner/IDL.py2
-rw-r--r--src/engine/SCons/Scanner/RC.py2
-rw-r--r--src/engine/SCons/Script/Interactive.py6
-rw-r--r--src/engine/SCons/Script/Main.py42
-rw-r--r--src/engine/SCons/Script/SConsOptions.py52
-rw-r--r--src/engine/SCons/Script/SConscript.py12
-rw-r--r--src/engine/SCons/Script/__init__.py6
-rw-r--r--src/engine/SCons/Subst.py9
-rw-r--r--src/engine/SCons/SubstTests.py11
-rw-r--r--src/engine/SCons/Taskmaster.py12
-rw-r--r--src/engine/SCons/Tool/BitKeeper.py1
-rw-r--r--src/engine/SCons/Tool/CVS.py1
-rw-r--r--src/engine/SCons/Tool/GettextCommon.py4
-rw-r--r--src/engine/SCons/Tool/MSCommon/common.py31
-rw-r--r--src/engine/SCons/Tool/MSCommon/netframework.py3
-rw-r--r--src/engine/SCons/Tool/MSCommon/sdk.py30
-rw-r--r--src/engine/SCons/Tool/MSCommon/vc.py4
-rw-r--r--src/engine/SCons/Tool/MSCommon/vs.py8
-rw-r--r--src/engine/SCons/Tool/Perforce.py6
-rw-r--r--src/engine/SCons/Tool/PharLapCommon.py38
-rw-r--r--src/engine/SCons/Tool/PharLapCommonTests.py69
-rw-r--r--src/engine/SCons/Tool/RCS.py1
-rw-r--r--src/engine/SCons/Tool/SCCS.py1
-rw-r--r--src/engine/SCons/Tool/Subversion.py1
-rw-r--r--src/engine/SCons/Tool/__init__.py2
-rw-r--r--src/engine/SCons/Tool/aixf77.py2
-rw-r--r--src/engine/SCons/Tool/cyglink.py2
-rw-r--r--src/engine/SCons/Tool/docbook/__init__.py36
-rw-r--r--src/engine/SCons/Tool/gnulink.py2
-rw-r--r--src/engine/SCons/Tool/icl.py2
-rw-r--r--src/engine/SCons/Tool/install.py16
-rw-r--r--src/engine/SCons/Tool/intelc.py17
-rw-r--r--src/engine/SCons/Tool/mslink.py2
-rw-r--r--src/engine/SCons/Tool/msvs.py44
-rw-r--r--src/engine/SCons/Tool/packaging/__init__.py7
-rw-r--r--src/engine/SCons/Tool/packaging/ipk.py8
-rw-r--r--src/engine/SCons/Tool/packaging/msi.py16
-rw-r--r--src/engine/SCons/Tool/packaging/rpm.py20
-rw-r--r--src/engine/SCons/Tool/sunar.py2
-rw-r--r--src/engine/SCons/Tool/tex.py6
-rw-r--r--src/engine/SCons/Tool/textfile.py4
-rw-r--r--src/engine/SCons/Tool/xgettext.py6
-rw-r--r--src/engine/SCons/Tool/yacc.py10
-rw-r--r--src/engine/SCons/Util.py116
-rw-r--r--src/engine/SCons/UtilTests.py43
-rw-r--r--src/engine/SCons/Variables/BoolVariable.py4
-rw-r--r--src/engine/SCons/Variables/EnumVariable.py4
-rw-r--r--src/engine/SCons/Variables/ListVariable.py8
-rw-r--r--src/engine/SCons/Variables/PackageVariable.py10
-rw-r--r--src/engine/SCons/Variables/PathVariable.py9
-rw-r--r--src/engine/SCons/Variables/__init__.py7
-rw-r--r--src/engine/SCons/compat/__init__.py56
-rw-r--r--src/engine/SCons/compat/_scons_builtins.py107
-rw-r--r--src/engine/SCons/compat/_scons_hashlib.py76
-rw-r--r--src/engine/SCons/cppTests.py3
-rw-r--r--src/engine/SCons/dblite.py8
-rw-r--r--src/script/scons-time.py45
-rw-r--r--src/script/sconsign.py35
-rw-r--r--test/TEX/bibliography.py3
-rw-r--r--test/compat/all.py65
-rw-r--r--test/compat/any.py63
-rw-r--r--test/option/profile.py21
-rw-r--r--test/sconsign/script/bad.py6
-rw-r--r--test/update-release-info/update-release-info.py12
85 files changed, 306 insertions, 1276 deletions
diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py
index 30489738..cd559b75 100644
--- a/QMTest/TestCmd.py
+++ b/QMTest/TestCmd.py
@@ -317,20 +317,6 @@ except ImportError:
exec('from UserList import UserList')
exec('from UserString import UserString')
-try:
- # pre-2.7 doesn't have the memoryview() built-in
- memoryview
-except NameError:
- class memoryview:
- def __init__(self, obj):
- # wrapping buffer in () keeps the fixer from changing it
- self.obj = (buffer)(obj)
- def __getitem__(self, indx):
- if isinstance(indx, slice):
- return self.obj[indx.start:indx.stop]
- else:
- return self.obj[indx]
-
__all__ = [
'diff_re',
'fail_test',
diff --git a/QMTest/TestCommon.py b/QMTest/TestCommon.py
index c4a5373b..dc4c97c2 100644
--- a/QMTest/TestCommon.py
+++ b/QMTest/TestCommon.py
@@ -123,31 +123,6 @@ __all__.extend([ 'TestCommon',
'dll_suffix',
])
-try:
- sorted
-except NameError:
- # Pre-2.4 Python has no sorted() function.
- #
- # The pre-2.4 Python list.sort() method does not support
- # list.sort(key=) nor list.sort(reverse=) keyword arguments, so
- # we must implement the functionality of those keyword arguments
- # by hand instead of passing them to list.sort().
- def sorted(iterable, cmp=None, key=None, reverse=False):
- if key is not None:
- result = [(key(x), x) for x in iterable]
- else:
- result = iterable[:]
- if cmp is None:
- # Pre-2.3 Python does not support list.sort(None).
- result.sort()
- else:
- result.sort(cmp)
- if key is not None:
- result = [t1 for t0,t1 in result]
- if reverse:
- result.reverse()
- return result
-
# Variables that describe the prefixes and suffixes on this system.
if sys.platform == 'win32':
exe_suffix = '.exe'
diff --git a/ReleaseConfig b/ReleaseConfig
index ced44c68..e1f462ac 100644
--- a/ReleaseConfig
+++ b/ReleaseConfig
@@ -38,7 +38,7 @@ version_tuple = (2, 4, 2, 'alpha', 0)
# when that version is used. Python versions prior to deprecate_python_version
# cause a warning to be issued (assuming it's not disabled). These values are
# mandatory and must be present in the configuration file.
-unsupported_python_version = (2, 3, 0)
+unsupported_python_version = (2, 6, 0)
deprecated_python_version = (2, 7, 0)
# If release_date is (yyyy, mm, dd, hh, mm, ss), that is used as the release
diff --git a/bin/scons-proc.py b/bin/scons-proc.py
index 9567db8c..d6a770bd 100644
--- a/bin/scons-proc.py
+++ b/bin/scons-proc.py
@@ -14,11 +14,7 @@ import os
import re
import string
import sys
-try:
- from io import StringIO # usable as of 2.6; takes unicode only
-except ImportError:
- # No 'io' module or no StringIO in io
- exec('from cStringIO import StringIO')
+from io import StringIO # usable as of 2.6; takes unicode only
import SConsDoc
from SConsDoc import tf as stf
diff --git a/runtest.py b/runtest.py
index b7cbdc69..1b5c7ddd 100755
--- a/runtest.py
+++ b/runtest.py
@@ -17,8 +17,6 @@
# build directory and sets PYTHONPATH to reference modules unpacked
# during build process for testing purposes (build/test-*).
#
-# -3 Run with the python -3 option,
-#
# -a Run all tests found under the current directory.
# It is also possible to specify a list of
# subdirectories to search.
@@ -108,7 +106,6 @@ list_only = None
printcommand = 1
package = None
print_passed_summary = None
-python3incompatibilities = None
scons = None
scons_exec = None
testlistfile = None
@@ -128,7 +125,6 @@ Usage: runtest.py [OPTIONS] [TEST ...]
"""
helpstr = usagestr + """\
Options:
- -3 Warn about Python 3.x incompatibilities.
-a --all Run all tests.
-b --baseline BASE Run test scripts against baseline BASE.
--builddir DIR Directory in which packages were built.
@@ -210,7 +206,7 @@ parser.add_option('--xml',
#print "args:", args
-opts, args = getopt.getopt(args, "3b:def:hj:klnP:p:qsv:Xx:t",
+opts, args = getopt.getopt(args, "b:def:hj:klnP:p:qsv:Xx:t",
['baseline=', 'builddir=',
'debug', 'external', 'file=', 'help', 'no-progress',
'jobs=',
@@ -223,9 +219,7 @@ opts, args = getopt.getopt(args, "3b:def:hj:klnP:p:qsv:Xx:t",
'verbose='])
for o, a in opts:
- if o in ['-3']:
- python3incompatibilities = 1
- elif o in ['-b', '--baseline']:
+ if o in ['-b', '--baseline']:
baseline = a
elif o in ['--builddir']:
builddir = a
@@ -634,9 +628,6 @@ if old_pythonpath:
os.pathsep + \
old_pythonpath
-if python3incompatibilities:
- os.environ['SCONS_HORRIBLE_REGRESSION_TEST_HACK'] = '1'
-
# ---[ test discovery ]------------------------------------
@@ -769,8 +760,6 @@ def run_test(t, io_lock, async=True):
global tests_completed
header = ""
command_args = ['-tt']
- if python3incompatibilities:
- command_args.append('-3')
if debug:
command_args.append(debug)
command_args.append(t.path)
diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py
index 5a348259..4dfde31d 100644
--- a/src/engine/SCons/Action.py
+++ b/src/engine/SCons/Action.py
@@ -235,11 +235,7 @@ def _code_contents(code):
# The code contents depends on the number of local variables
# but not their actual names.
contents.append("%s,%s" % (code.co_argcount, len(code.co_varnames)))
- try:
- contents.append(",%s,%s" % (len(code.co_cellvars), len(code.co_freevars)))
- except AttributeError:
- # Older versions of Python do not support closures.
- contents.append(",0,0")
+ contents.append(",%s,%s" % (len(code.co_cellvars), len(code.co_freevars)))
# The code contents depends on any constants accessed by the
# function. Note that we have to call _object_contents on each
@@ -276,11 +272,7 @@ def _function_contents(func):
contents.append(',()')
# The function contents depends on the closure captured cell values.
- try:
- closure = func.func_closure or []
- except AttributeError:
- # Older versions of Python do not support closures.
- closure = []
+ closure = func.func_closure or []
#xxx = [_object_contents(x.cell_contents) for x in closure]
try:
@@ -946,7 +938,6 @@ class LazyAction(CommandGeneratorAction, CommandAction):
def __init__(self, var, kw):
if SCons.Debug.track_instances: logInstanceCreation(self, 'Action.LazyAction')
- #FUTURE CommandAction.__init__(self, '${'+var+'}', **kw)
CommandAction.__init__(self, '${'+var+'}', **kw)
self.var = SCons.Util.to_String(var)
self.gen_kw = kw
diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py
index e069d51d..631d7c15 100644
--- a/src/engine/SCons/ActionTests.py
+++ b/src/engine/SCons/ActionTests.py
@@ -229,7 +229,6 @@ def test_varlist(pos_call, str_call, cmd, cmdstrfunc, **kw):
def test_positional_args(pos_callback, cmd, **kw):
"""Test that Action() returns the expected type and that positional args work.
"""
- #FUTURE act = SCons.Action.Action(cmd, **kw)
act = SCons.Action.Action(cmd, **kw)
pos_callback(act)
assert act.varlist is (), act.varlist
@@ -237,7 +236,6 @@ def test_positional_args(pos_callback, cmd, **kw):
if not isinstance(act, SCons.Action._ActionAction):
# only valid cmdstrfunc is None
def none(a): pass
- #FUTURE test_varlist(pos_callback, none, cmd, None, **kw)
test_varlist(pos_callback, none, cmd, None, **kw)
else:
# _ActionAction should have set these
@@ -251,25 +249,21 @@ def test_positional_args(pos_callback, cmd, **kw):
def cmdstr(a):
assert hasattr(a, 'strfunction')
assert a.cmdstr == 'cmdstr', a.cmdstr
- #FUTURE test_varlist(pos_callback, cmdstr, cmd, 'cmdstr', **kw)
test_varlist(pos_callback, cmdstr, cmd, 'cmdstr', **kw)
def fun(): pass
def strfun(a, fun=fun):
assert a.strfunction is fun, a.strfunction
assert a.cmdstr == _null, a.cmdstr
- #FUTURE test_varlist(pos_callback, strfun, cmd, fun, **kw)
test_varlist(pos_callback, strfun, cmd, fun, **kw)
def none(a):
assert hasattr(a, 'strfunction')
assert a.cmdstr is None, a.cmdstr
- #FUTURE test_varlist(pos_callback, none, cmd, None, **kw)
test_varlist(pos_callback, none, cmd, None, **kw)
"""Test handling of bad cmdstrfunc arguments """
try:
- #FUTURE a = SCons.Action.Action(cmd, [], **kw)
a = SCons.Action.Action(cmd, [], **kw)
except SCons.Errors.UserError, e:
s = str(e)
@@ -1193,81 +1187,6 @@ class CommandActionTestCase(unittest.TestCase):
r = act([], [], env)
assert r == 0, r
- def _DO_NOT_EXECUTE_test_pipe_execute(self):
- """Test capturing piped output from an action
-
- We used to have PIPE_BUILD support built right into
- Action.execute() for the benefit of the SConf subsystem, but we've
- moved that logic back into SConf itself. We'll leave this code
- here, just in case we ever want to resurrect this functionality
- in the future, but change the name of the test so it doesn't
- get executed as part of the normal test suite.
- """
- pipe = open( pipe_file, "w" )
- self.env = Environment(ENV = {'ACTPY_PIPE' : '1'}, PIPE_BUILD = 1,
- PSTDOUT = pipe, PSTDERR = pipe)
- # everything should also work when piping output
- self.test_execute()
- self.env['PSTDOUT'].close()
- pipe_out = test.read( pipe_file )
-
- act_out = "act.py: stdout: executed act.py"
- act_err = "act.py: stderr: executed act.py"
-
- # Since we are now using select(), stdout and stderr can be
- # intermixed, so count the lines separately.
- outlines = re.findall(act_out, pipe_out)
- errlines = re.findall(act_err, pipe_out)
- assert len(outlines) == 6, pipe_out + repr(outlines)
- assert len(errlines) == 6, pipe_out + repr(errlines)
-
- # test redirection operators
- def test_redirect(self, redir, stdout_msg, stderr_msg):
- cmd = r'%s %s %s xyzzy %s' % (_python_, act_py, outfile, redir)
- # Write the output and error messages to files because
- # Windows can't handle strings that are too big in its
- # external environment (os.spawnve() returns EINVAL,
- # "Invalid argument").
- stdout_file = test.workpath('stdout_msg')
- stderr_file = test.workpath('stderr_msg')
- open(stdout_file, 'w').write(stdout_msg)
- open(stderr_file, 'w').write(stderr_msg)
- pipe = open( pipe_file, "w" )
- act = SCons.Action.CommandAction(cmd)
- env = Environment( ENV = {'ACTPY_PIPE' : '1',
- 'PIPE_STDOUT_FILE' : stdout_file,
- 'PIPE_STDERR_FILE' : stderr_file},
- PIPE_BUILD = 1,
- PSTDOUT = pipe, PSTDERR = pipe )
- r = act([], [], env)
- pipe.close()
- assert r == 0
- return (test.read(outfile2, 'r'), test.read(pipe_file, 'r'))
-
- (redirected, pipe_out) = test_redirect(self,'> %s' % outfile2,
- act_out, act_err)
- assert redirected == act_out
- assert pipe_out == act_err
-
- (redirected, pipe_out) = test_redirect(self,'2> %s' % outfile2,
- act_out, act_err)
- assert redirected == act_err
- assert pipe_out == act_out
-
- (redirected, pipe_out) = test_redirect(self,'> %s 2>&1' % outfile2,
- act_out, act_err)
- assert (redirected == act_out + act_err or
- redirected == act_err + act_out)
- assert pipe_out == ""
-
- act_err = "Long Command Output\n"*3000
- # the size of the string should exceed the system's default block size
- act_out = ""
- (redirected, pipe_out) = test_redirect(self,'> %s' % outfile2,
- act_out, act_err)
- assert (redirected == act_out)
- assert (pipe_out == act_err)
-
def test_set_handler(self):
"""Test setting the command handler...
"""
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py
index 7e2f8963..45b24c5f 100644
--- a/src/engine/SCons/Environment.py
+++ b/src/engine/SCons/Environment.py
@@ -857,25 +857,6 @@ class SubstitutionEnvironment(object):
self[key] = t
return self
-# def MergeShellPaths(self, args, prepend=1):
-# """
-# Merge the dict in args into the shell environment in env['ENV'].
-# Shell path elements are appended or prepended according to prepend.
-
-# Uses Pre/AppendENVPath, so it always appends or prepends uniquely.
-
-# Example: env.MergeShellPaths({'LIBPATH': '/usr/local/lib'})
-# prepends /usr/local/lib to env['ENV']['LIBPATH'].
-# """
-
-# for pathname, pathval in args.items():
-# if not pathval:
-# continue
-# if prepend:
-# self.PrependENVPath(pathname, pathval)
-# else:
-# self.AppendENVPath(pathname, pathval)
-
def default_decide_source(dependency, target, prev_ni):
f = SCons.Defaults.DefaultEnvironment().decide_source
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py
index 9a9d2b03..05679063 100644
--- a/src/engine/SCons/EnvironmentTests.py
+++ b/src/engine/SCons/EnvironmentTests.py
@@ -862,31 +862,6 @@ sys.exit(0)
assert env['A'] == ['aaa'], env['A']
assert env['B'] == ['bbb'], env['B']
-# def test_MergeShellPaths(self):
-# """Test the MergeShellPaths() method
-# """
-# env = Environment()
-# env.MergeShellPaths({})
-# assert not env['ENV'].has_key('INCLUDE'), env['INCLUDE']
-# env.MergeShellPaths({'INCLUDE': r'c:\Program Files\Stuff'})
-# assert env['ENV']['INCLUDE'] == r'c:\Program Files\Stuff', env['ENV']['INCLUDE']
-# env.MergeShellPaths({'INCLUDE': r'c:\Program Files\Stuff'})
-# assert env['ENV']['INCLUDE'] == r'c:\Program Files\Stuff', env['ENV']['INCLUDE']
-# env.MergeShellPaths({'INCLUDE': r'xyz'})
-# assert env['ENV']['INCLUDE'] == r'xyz%sc:\Program Files\Stuff'%os.pathsep, env['ENV']['INCLUDE']
-
-# env = Environment()
-# env['ENV']['INCLUDE'] = 'xyz'
-# env.MergeShellPaths({'INCLUDE':['c:/inc1', 'c:/inc2']} )
-# assert env['ENV']['INCLUDE'] == r'c:/inc1%sc:/inc2%sxyz'%(os.pathsep, os.pathsep), env['ENV']['INCLUDE']
-
-# # test prepend=0
-# env = Environment()
-# env.MergeShellPaths({'INCLUDE': r'c:\Program Files\Stuff'}, prepend=0)
-# assert env['ENV']['INCLUDE'] == r'c:\Program Files\Stuff', env['ENV']['INCLUDE']
-# env.MergeShellPaths({'INCLUDE': r'xyz'}, prepend=0)
-# assert env['ENV']['INCLUDE'] == r'c:\Program Files\Stuff%sxyz'%os.pathsep, env['ENV']['INCLUDE']
-
class BaseTestCase(unittest.TestCase,TestEnvironmentFixture):
diff --git a/src/engine/SCons/Executor.py b/src/engine/SCons/Executor.py
index 59e57e3c..71671bf7 100644
--- a/src/engine/SCons/Executor.py
+++ b/src/engine/SCons/Executor.py
@@ -122,7 +122,6 @@ def execute_action_list(obj, target, kw):
kw = obj.get_kw(kw)
status = 0
for act in obj.get_action_list():
- #args = (self.get_all_targets(), self.get_all_sources(), env)
args = ([], [], env)
status = act(*args, **kw)
if isinstance(status, SCons.Errors.BuildError):
@@ -244,14 +243,12 @@ class Executor(object):
return self._changed_targets_list
def _get_source(self, *args, **kw):
- #return SCons.Util.NodeList([rfile(self.batches[0].sources[0]).get_subst_proxy()])
return rfile(self.batches[0].sources[0]).get_subst_proxy()
def _get_sources(self, *args, **kw):
return SCons.Util.NodeList([rfile(n).get_subst_proxy() for n in self.get_all_sources()])
def _get_target(self, *args, **kw):
- #return SCons.Util.NodeList([self.batches[0].targets[0].get_subst_proxy()])
return self.batches[0].targets[0].get_subst_proxy()
def _get_targets(self, *args, **kw):
diff --git a/src/engine/SCons/Job.py b/src/engine/SCons/Job.py
index 184f5ba3..42b009ea 100644
--- a/src/engine/SCons/Job.py
+++ b/src/engine/SCons/Job.py
@@ -70,7 +70,7 @@ class Jobs(object):
def __init__(self, num, taskmaster):
"""
- create 'num' jobs using the given taskmaster.
+ Create 'num' jobs using the given taskmaster.
If 'num' is 1 or less, then a serial job will be used,
otherwise a parallel job with 'num' worker threads will
@@ -126,10 +126,10 @@ class Jobs(object):
c) SIGHUP: Controlling shell exiting
We handle all of these cases by stopping the taskmaster. It
- turns out that it very difficult to stop the build process
+ turns out that it's very difficult to stop the build process
by throwing asynchronously an exception such as
KeyboardInterrupt. For example, the python Condition
- variables (threading.Condition) and queue's do not seem to
+ variables (threading.Condition) and queues do not seem to be
asynchronous-exception-safe. It would require adding a whole
bunch of try/finally block and except KeyboardInterrupt all
over the place.
@@ -177,7 +177,7 @@ class Serial(object):
The taskmaster's next_task() method should return the next task
that needs to be executed, or None if there are no more tasks. The
taskmaster's executed() method will be called for each task when it
- is successfully executed or failed() will be called if it failed to
+ is successfully executed, or failed() will be called if it failed to
execute (e.g. execute() raised an exception)."""
self.taskmaster = taskmaster
@@ -351,7 +351,7 @@ else:
The taskmaster's next_task() method should return the next
task that needs to be executed, or None if there are no more
tasks. The taskmaster's executed() method will be called
- for each task when it is successfully executed or failed()
+ for each task when it is successfully executed, or failed()
will be called if the task failed to execute (i.e. execute()
raised an exception).
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py
index 4e78852a..4a4942b7 100644
--- a/src/engine/SCons/Node/FS.py
+++ b/src/engine/SCons/Node/FS.py
@@ -186,7 +186,7 @@ needs_normpath_check = re.compile(
# We need to renormalize the path if it contains a '.'
# directory, but NOT if it is a single '.' '/' characters. We
# do not want to match a single '.' because this case is checked
- # for explicitely since this is common enough case.
+ # for explicitly since this is common enough case.
#
# Note that we check for all the following cases:
#
@@ -1165,15 +1165,6 @@ class LocalFS(object):
return ''
-#class RemoteFS:
-# # Skeleton for the obvious methods we might need from the
-# # abstraction layer for a remote filesystem.
-# def upload(self, local_src, remote_dst):
-# pass
-# def download(self, remote_src, local_dst):
-# pass
-
-
class FS(LocalFS):
def __init__(self, path = None):
@@ -2234,7 +2225,6 @@ class Dir(Base):
# the overall list will also be filtered later,
# after we exit this loop.
if pattern[0] != '.':
- #disk_names = [ d for d in disk_names if d[0] != '.' ]
disk_names = [x for x in disk_names if x[0] != '.']
disk_names = fnmatch.filter(disk_names, pattern)
dirEntry = dir.Entry
@@ -2627,13 +2617,6 @@ class File(Base):
the directory of this file."""
return self.dir.File(name)
- #def generate_build_dict(self):
- # """Return an appropriate dictionary of values for building
- # this File."""
- # return {'Dir' : self.Dir,
- # 'File' : self.File,
- # 'RDirs' : self.RDirs}
-
def _morph(self):
"""Turn a file system node into a File object."""
self.scanner_paths = {}
@@ -2907,9 +2890,7 @@ class File(Base):
pass
if scanner:
- # result = [n.disambiguate() for n in scanner(self, env, path)]
- result = scanner(self, env, path)
- result = [N.disambiguate() for N in result]
+ result = [n.disambiguate() for n in scanner(self, env, path)]
else:
result = []
@@ -3519,36 +3500,6 @@ class FileFinder(object):
filedir, filename = os.path.split(filename)
if filedir:
- # More compact code that we can't use until we drop
- # support for Python 1.5.2:
- #
- #def filedir_lookup(p, fd=filedir):
- # """
- # A helper function that looks up a directory for a file
- # we're trying to find. This only creates the Dir Node
- # if it exists on-disk, since if the directory doesn't
- # exist we know we won't find any files in it... :-)
- # """
- # dir, name = os.path.split(fd)
- # if dir:
- # p = filedir_lookup(p, dir)
- # if not p:
- # return None
- # norm_name = _my_normcase(name)
- # try:
- # node = p.entries[norm_name]
- # except KeyError:
- # return p.dir_on_disk(name)
- # if isinstance(node, Dir):
- # return node
- # if isinstance(node, Entry):
- # node.must_be_same(Dir)
- # return node
- # if isinstance(node, Dir) or isinstance(node, Entry):
- # return node
- # return None
- #paths = [_f for _f in map(filedir_lookup, paths) if _f]
-
self.default_filedir = filedir
paths = [_f for _f in map(self.filedir_lookup, paths) if _f]
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py
index 0c1e71fa..fc27859a 100644
--- a/src/engine/SCons/Node/FSTests.py
+++ b/src/engine/SCons/Node/FSTests.py
@@ -751,16 +751,6 @@ class FileNodeInfoTestCase(_tempdirTestCase):
size = st[stat.ST_SIZE]
assert ni.size != size, (ni.size, size)
- #fff.clear()
- #ni.update(fff)
-
- #st = os.stat('fff')
-
- #mtime = st[stat.ST_MTIME]
- #assert ni.timestamp == mtime, (ni.timestamp, mtime)
- #size = st[stat.ST_SIZE]
- #assert ni.size == size, (ni.size, size)
-
class FileBuildInfoTestCase(_tempdirTestCase):
def test___init__(self):
"""Test File.BuildInfo initialization"""
diff --git a/src/engine/SCons/Node/NodeTests.py b/src/engine/SCons/Node/NodeTests.py
index 1478419e..3802f8c3 100644
--- a/src/engine/SCons/Node/NodeTests.py
+++ b/src/engine/SCons/Node/NodeTests.py
@@ -358,8 +358,6 @@ class NodeTestCase(unittest.TestCase):
ggg.path = "ggg"
fff.sources = ["hhh", "iii"]
ggg.sources = ["hhh", "iii"]
- # [Charles C. 1/7/2002] Uhhh, why are there no asserts here?
- # [SK, 15 May 2003] I dunno, let's add some...
built_it = None
fff.build()
assert built_it
diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py
index 5aa96000..40ee8f06 100644
--- a/src/engine/SCons/Node/__init__.py
+++ b/src/engine/SCons/Node/__init__.py
@@ -577,7 +577,7 @@ class Node(object):
self.always_build = None
self.includes = None
self.attributes = self.Attrs() # Generic place to stick information about the Node.
- self.side_effect = 0 # true iff this node is a side effect
+ self.side_effect = 0 # true if this node is a side effect
self.side_effects = [] # the side effects of building this target
self.linked = 0 # is this node linked to the variant directory?
self.changed_since_last_build = 0
@@ -1281,11 +1281,6 @@ class Node(object):
def _add_child(self, collection, set, child):
"""Adds 'child' to 'collection', first checking 'set' to see if it's
already present."""
- #if type(child) is not type([]):
- # child = [child]
- #for c in child:
- # if not isinstance(c, Node):
- # raise TypeError, c
added = None
for c in child:
if c not in set:
diff --git a/src/engine/SCons/PathList.py b/src/engine/SCons/PathList.py
index 350e1ac3..77e30c40 100644
--- a/src/engine/SCons/PathList.py
+++ b/src/engine/SCons/PathList.py
@@ -27,7 +27,7 @@ __doc__ = """SCons.PathList
A module for handling lists of directory paths (the sort of things
that get set as CPPPATH, LIBPATH, etc.) with as much caching of data and
-efficiency as we can while still keeping the evaluation delayed so that we
+efficiency as we can, while still keeping the evaluation delayed so that we
Do the Right Thing (almost) regardless of how the variable is specified.
"""
diff --git a/src/engine/SCons/Platform/__init__.py b/src/engine/SCons/Platform/__init__.py
index 653f7224..7f3e90bd 100644
--- a/src/engine/SCons/Platform/__init__.py
+++ b/src/engine/SCons/Platform/__init__.py
@@ -12,7 +12,7 @@ environment. Consequently, we'll examine both sys.platform and os.name
(and anything else that might come in to play) in order to return some
specification which is unique enough for our purposes.
-Note that because this subsysem just *selects* a callable that can
+Note that because this subsystem just *selects* a callable that can
modify a construction environment, it's possible for people to define
their own "platform specification" in an arbitrary callable function.
No one needs to use or tie in to this subsystem in order to roll
diff --git a/src/engine/SCons/Platform/win32.py b/src/engine/SCons/Platform/win32.py
index 5f20685c..4cfabea2 100644
--- a/src/engine/SCons/Platform/win32.py
+++ b/src/engine/SCons/Platform/win32.py
@@ -60,10 +60,8 @@ except AttributeError:
else:
parallel_msg = None
- import builtins
-
- _builtin_file = builtins.file
- _builtin_open = builtins.open
+ _builtin_file = file
+ _builtin_open = open
class _scons_file(_builtin_file):
def __init__(self, *args, **kw):
@@ -78,8 +76,8 @@ else:
0)
return fp
- builtins.file = _scons_file
- builtins.open = _scons_open
+ file = _scons_file
+ open = _scons_open
try:
import threading
diff --git a/src/engine/SCons/SConf.py b/src/engine/SCons/SConf.py
index 987b8ea9..286f2306 100644
--- a/src/engine/SCons/SConf.py
+++ b/src/engine/SCons/SConf.py
@@ -254,14 +254,7 @@ class SConfBuildTask(SCons.Taskmaster.AlwaysTask):
else:
self.display('Caught exception while building "%s":\n' %
self.targets[0])
- try:
- excepthook = sys.excepthook
- except AttributeError:
- # Earlier versions of Python don't have sys.excepthook...
- def excepthook(type, value, tb):
- traceback.print_tb(tb)
- print type, value
- excepthook(*self.exc_info())
+ sys.excepthook(*self.exc_info())
return SCons.Taskmaster.Task.failed(self)
def collect_node_states(self):
@@ -355,8 +348,6 @@ class SConfBuildTask(SCons.Taskmaster.AlwaysTask):
raise SCons.Errors.ExplicitExit(self.targets[0],exc_value.code)
except Exception, e:
for t in self.targets:
- #binfo = t.get_binfo()
- #binfo.__class__ = SConfBuildInfo
binfo = SConfBuildInfo()
binfo.merge(t.get_binfo())
binfo.set_build_result(1, s.getvalue())
@@ -375,8 +366,6 @@ class SConfBuildTask(SCons.Taskmaster.AlwaysTask):
raise e
else:
for t in self.targets:
- #binfo = t.get_binfo()
- #binfo.__class__ = SConfBuildInfo
binfo = SConfBuildInfo()
binfo.merge(t.get_binfo())
binfo.set_build_result(0, s.getvalue())
@@ -399,16 +388,16 @@ class SConfBase(object):
tests, be sure to call the Finish() method, which returns the modified
environment.
Some words about caching: In most cases, it is not necessary to cache
- Test results explicitely. Instead, we use the scons dependency checking
+ Test results explicitly. Instead, we use the scons dependency checking
mechanism. For example, if one wants to compile a test program
(SConf.TryLink), the compiler is only called, if the program dependencies
have changed. However, if the program could not be compiled in a former
- SConf run, we need to explicitely cache this error.
+ SConf run, we need to explicitly cache this error.
"""
def __init__(self, env, custom_tests = {}, conf_dir='$CONFIGUREDIR',
log_file='$CONFIGURELOG', config_h = None, _depth = 0):
- """Constructor. Pass additional tests in the custom_tests-dictinary,
+ """Constructor. Pass additional tests in the custom_tests-dictionary,
e.g. custom_tests={'CheckPrivate':MyPrivateTest}, where MyPrivateTest
defines a custom test.
Note also the conf_dir and log_file arguments (you may want to
diff --git a/src/engine/SCons/SConfTests.py b/src/engine/SCons/SConfTests.py
index 9bdfceb9..f9ee0d0a 100644
--- a/src/engine/SCons/SConfTests.py
+++ b/src/engine/SCons/SConfTests.py
@@ -100,11 +100,10 @@ class SConfTestCase(unittest.TestCase):
# original builtin functions whenever we have to reset
# all of our global state.
- import builtins
import SCons.Platform.win32
- builtins.file = SCons.Platform.win32._builtin_file
- builtins.open = SCons.Platform.win32._builtin_open
+ file = SCons.Platform.win32._builtin_file
+ open = SCons.Platform.win32._builtin_open
def _baseTryXXX(self, TryFunc):
# TryCompile and TryLink are much the same, so we can test them
diff --git a/src/engine/SCons/Scanner/C.py b/src/engine/SCons/Scanner/C.py
index 3311a095..e6ac7205 100644
--- a/src/engine/SCons/Scanner/C.py
+++ b/src/engine/SCons/Scanner/C.py
@@ -1,6 +1,6 @@
"""SCons.Scanner.C
-This module implements the depenency scanner for C/C++ code.
+This module implements the dependency scanner for C/C++ code.
"""
diff --git a/src/engine/SCons/Scanner/IDL.py b/src/engine/SCons/Scanner/IDL.py
index 18084e85..86ee0066 100644
--- a/src/engine/SCons/Scanner/IDL.py
+++ b/src/engine/SCons/Scanner/IDL.py
@@ -1,6 +1,6 @@
"""SCons.Scanner.IDL
-This module implements the depenency scanner for IDL (Interface
+This module implements the dependency scanner for IDL (Interface
Definition Language) files.
"""
diff --git a/src/engine/SCons/Scanner/RC.py b/src/engine/SCons/Scanner/RC.py
index 437b861e..61393ae9 100644
--- a/src/engine/SCons/Scanner/RC.py
+++ b/src/engine/SCons/Scanner/RC.py
@@ -1,6 +1,6 @@
"""SCons.Scanner.RC
-This module implements the depenency scanner for RC (Interface
+This module implements the dependency scanner for RC (Interface
Definition Language) files.
"""
diff --git a/src/engine/SCons/Script/Interactive.py b/src/engine/SCons/Script/Interactive.py
index ffb50962..5450ff50 100644
--- a/src/engine/SCons/Script/Interactive.py
+++ b/src/engine/SCons/Script/Interactive.py
@@ -304,14 +304,8 @@ class SConsInteractiveCmd(cmd.Cmd):
return self._strip_initial_spaces(doc)
def _strip_initial_spaces(self, s):
- #lines = s.split('\n')
lines = s.split('\n')
spaces = re.match(' *', lines[0]).group(0)
- #def strip_spaces(l):
- # if l.startswith(spaces):
- # l = l[len(spaces):]
- # return l
- #return '\n'.join([ strip_spaces(l) for l in lines ])
def strip_spaces(l, spaces=spaces):
if l[:len(spaces)] == spaces:
l = l[len(spaces):]
diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py
index bd227bd5..05c0d75a 100644
--- a/src/engine/SCons/Script/Main.py
+++ b/src/engine/SCons/Script/Main.py
@@ -10,7 +10,7 @@ some other module. If it's specific to the "scons" script invocation,
it goes here.
"""
-unsupported_python_version = (2, 3, 0)
+unsupported_python_version = (2, 6, 0)
deprecated_python_version = (2, 7, 0)
# __COPYRIGHT__
@@ -43,15 +43,6 @@ import sys
import time
import traceback
-# Strip the script directory from sys.path() so on case-insensitive
-# (Windows) systems Python doesn't think that the "scons" script is the
-# "SCons" package. Replace it with our own version directory so, if
-# if they're there, we pick up the right version of the build engine
-# modules.
-#sys.path = [os.path.join(sys.prefix,
-# 'lib',
-# 'scons-%d' % SCons.__version__)] + sys.path[1:]
-
import SCons.CacheDir
import SCons.Debug
import SCons.Defaults
@@ -74,7 +65,7 @@ def fetch_win32_parallel_msg():
# so we don't have to pull it in on all platforms, and so that an
# in-line "import" statement in the _main() function below doesn't
# cause warnings about local names shadowing use of the 'SCons'
- # globl in nest scopes and UnboundLocalErrors and the like in some
+ # global in nest scopes and UnboundLocalErrors and the like in some
# versions (2.1) of Python.
import SCons.Platform.win32
return SCons.Platform.win32.parallel_msg
@@ -368,7 +359,7 @@ class CleanTask(SCons.Taskmaster.AlwaysTask):
# issue, an IOError would indicate something like
# the file not existing. In either case, print a
# message and keep going to try to remove as many
- # targets aa possible.
+ # targets as possible.
print "scons: Could not remove '%s':" % str(t), e.strerror
else:
if removed:
@@ -383,7 +374,7 @@ class CleanTask(SCons.Taskmaster.AlwaysTask):
# we don't want, like store .sconsign information.
executed = SCons.Taskmaster.Task.executed_without_callbacks
- # Have the taskmaster arrange to "execute" all of the targets, because
+ # Have the Taskmaster arrange to "execute" all of the targets, because
# we'll figure out ourselves (in remove() or show() above) whether
# anything really needs to be done.
make_ready = SCons.Taskmaster.Task.make_ready_all
@@ -487,7 +478,6 @@ def SetOption(name, value):
def PrintHelp(file=None):
OptionsParser.print_help(file=file)
-#
class Stats(object):
def __init__(self):
self.stats = []
@@ -711,7 +701,6 @@ def _load_site_scons_dir(topdir, site_dir_name=None):
site_tools_dir = os.path.join(site_dir, site_tools_dirname)
if os.path.exists(site_init_file):
import imp, re
- # TODO(2.4): turn this into try:-except:-finally:
try:
try:
fp, pathname, description = imp.find_module(site_init_modname,
@@ -1024,7 +1013,7 @@ def _main(parser):
# the SConscript file.
#
# We delay enabling the PythonVersionWarning class until here so that,
- # if they explicity disabled it in either in the command line or in
+ # if they explicitly disabled it in either in the command line or in
# $SCONSFLAGS, or in the SConscript file, then the search through
# the list of deprecated warning classes will find that disabling
# first and not issue the warning.
@@ -1232,13 +1221,8 @@ def _build_targets(fs, options, targets, target_top):
def order(dependencies):
"""Randomize the dependencies."""
import random
- # This is cribbed from the implementation of
- # random.shuffle() in Python 2.X.
- d = dependencies
- for i in range(len(d)-1, 0, -1):
- j = int(random.random() * (i+1))
- d[i], d[j] = d[j], d[i]
- return d
+ random.shuffle(dependencies)
+ return dependencies
else:
def order(dependencies):
"""Leave the order of dependencies alone."""
@@ -1316,18 +1300,6 @@ def _exec_main(parser, values):
# compat layer imports "cProfile" for us if it's available.
from profile import Profile
- # Some versions of Python 2.4 shipped a profiler that had the
- # wrong 'c_exception' entry in its dispatch table. Make sure
- # we have the right one. (This may put an unnecessary entry
- # in the table in earlier versions of Python, but its presence
- # shouldn't hurt anything).
- try:
- dispatch = Profile.dispatch
- except AttributeError:
- pass
- else:
- dispatch['c_exception'] = Profile.trace_dispatch_return
-
prof = Profile()
try:
prof.runcall(_main, parser)
diff --git a/src/engine/SCons/Script/SConsOptions.py b/src/engine/SCons/Script/SConsOptions.py
index 68c60ccd..f56504aa 100644
--- a/src/engine/SCons/Script/SConsOptions.py
+++ b/src/engine/SCons/Script/SConsOptions.py
@@ -426,7 +426,7 @@ class SConsOptionParser(optparse.OptionParser):
result = group.add_option(*args, **kw)
if result:
- # The option was added succesfully. We now have to add the
+ # The option was added successfully. We now have to add the
# default value to our object that holds the default values
# (so that an attempt to fetch the option's attribute will
# yield the default value when not overridden) and then
@@ -449,11 +449,6 @@ class SConsIndentedHelpFormatter(optparse.IndentedHelpFormatter):
"SCons Options." Unfortunately, we have to do this here,
because those titles are hard-coded in the optparse calls.
"""
- if heading == 'options':
- # The versions of optparse.py shipped with Pythons 2.3 and
- # 2.4 pass this in uncapitalized; override that so we get
- # consistent output on all versions.
- heading = "Options"
if heading == 'Options':
heading = "SCons Options"
return optparse.IndentedHelpFormatter.format_heading(self, heading)
@@ -488,13 +483,7 @@ class SConsIndentedHelpFormatter(optparse.IndentedHelpFormatter):
# read data from FILENAME
result = []
- try:
- opts = self.option_strings[option]
- except AttributeError:
- # The Python 2.3 version of optparse attaches this to
- # to the option argument, not to this object.
- opts = option.option_strings
-
+ opts = self.option_strings[option]
opt_width = self.help_position - self.current_indent - 2
if len(opts) > opt_width:
wrapper = textwrap.TextWrapper(width=self.width,
@@ -509,14 +498,7 @@ class SConsIndentedHelpFormatter(optparse.IndentedHelpFormatter):
result.append(opts)
if option.help:
- try:
- expand_default = self.expand_default
- except AttributeError:
- # The HelpFormatter base class in the Python 2.3 version
- # of optparse has no expand_default() method.
- help_text = option.help
- else:
- help_text = expand_default(option)
+ help_text = self.expand_default(option)
# SCons: indent every line of the help text but the first.
wrapper = textwrap.TextWrapper(width=self.help_width,
@@ -530,34 +512,6 @@ class SConsIndentedHelpFormatter(optparse.IndentedHelpFormatter):
result.append("\n")
return "".join(result)
- # For consistent help output across Python versions, we provide a
- # subclass copy of format_option_strings() and these two variables.
- # This is necessary (?) for Python2.3, which otherwise concatenates
- # a short option with its metavar.
- _short_opt_fmt = "%s %s"
- _long_opt_fmt = "%s=%s"
-
- def format_option_strings(self, option):
- """Return a comma-separated list of option strings & metavariables."""
- if option.takes_value():
- metavar = option.metavar or option.dest.upper()
- short_opts = []
- for sopt in option._short_opts:
- short_opts.append(self._short_opt_fmt % (sopt, metavar))
- long_opts = []
- for lopt in option._long_opts:
- long_opts.append(self._long_opt_fmt % (lopt, metavar))
- else:
- short_opts = option._short_opts
- long_opts = option._long_opts
-
- if self.short_first:
- opts = short_opts + long_opts
- else:
- opts = long_opts + short_opts
-
- return ", ".join(opts)
-
def Parser(version):
"""
Returns an options parser object initialized with the standard
diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py
index b832ff78..e696cfae 100644
--- a/src/engine/SCons/Script/SConscript.py
+++ b/src/engine/SCons/Script/SConscript.py
@@ -52,16 +52,6 @@ import re
import sys
import traceback
-# The following variables used to live in this module. Some
-# SConscript files out there may have referred to them directly as
-# SCons.Script.SConscript.*. This is now supported by some special
-# handling towards the bottom of the SConscript.__init__.py module.
-#Arguments = {}
-#ArgList = []
-#BuildTargets = TargetList()
-#CommandLineTargets = []
-#DefaultTargets = []
-
class SConscriptReturn(Exception):
pass
@@ -446,7 +436,7 @@ class SConsEnvironment(SCons.Environment.Base):
#
# Public methods of an SConsEnvironment. These get
- # entry points in the global name space so they can be called
+ # entry points in the global namespace so they can be called
# as global functions.
#
diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py
index 6bfc36f1..a0c61c5c 100644
--- a/src/engine/SCons/Script/__init__.py
+++ b/src/engine/SCons/Script/__init__.py
@@ -270,12 +270,6 @@ def HelpFunction(text, append=False):
s.close()
else:
help_text = ""
-#
-# Was in original patch but this text is arbitrary and breaks tests
-# so I removed it (Deegan)
-# help_text = help_text + "\nLocal Build Variables:\n" + text
-# else:
-# help_text = help_text + text
help_text= help_text + text
diff --git a/src/engine/SCons/Subst.py b/src/engine/SCons/Subst.py
index 318d7d97..236b08e4 100644
--- a/src/engine/SCons/Subst.py
+++ b/src/engine/SCons/Subst.py
@@ -344,7 +344,6 @@ _remove = re.compile(r'\$\([^\$]*(\$[^\)][^\$]*)*\$\)')
_regex_remove = [ _rm, None, _remove ]
def _rm_list(list):
- #return [ l for l in list if not l in ('$(', '$)') ]
return [l for l in list if not l in ('$(', '$)')]
def _remove_list(list):
@@ -580,8 +579,6 @@ def scons_subst(strSubst, env, mode=SUBST_RAW, target=None, source=None, gvars={
return result
-#Subst_List_Strings = {}
-
def scons_subst_list(strSubst, env, mode=SUBST_RAW, target=None, source=None, gvars={}, lvars={}, conv=None):
"""Substitute construction variables in a string (or list or other
object) and separate the arguments into a command list.
@@ -590,12 +587,6 @@ def scons_subst_list(strSubst, env, mode=SUBST_RAW, target=None, source=None, gv
substitutions within strings, so see that function instead
if that's what you're looking for.
"""
-# try:
-# Subst_List_Strings[strSubst] = Subst_List_Strings[strSubst] + 1
-# except KeyError:
-# Subst_List_Strings[strSubst] = 1
-# import SCons.Debug
-# SCons.Debug.caller_trace(1)
class ListSubber(collections.UserList):
"""A class to construct the results of a scons_subst_list() call.
diff --git a/src/engine/SCons/SubstTests.py b/src/engine/SCons/SubstTests.py
index 6f2eb3fe..e625cc71 100644
--- a/src/engine/SCons/SubstTests.py
+++ b/src/engine/SCons/SubstTests.py
@@ -604,17 +604,6 @@ class scons_subst_TestCase(SubstTestCase):
node = scons_subst("$NODE", env, mode=SUBST_SIG, conv=s, gvars=gvars)
assert node is n1, node
- #def test_subst_function_return(self):
- # """Test scons_subst(): returning a function"""
- # env = DummyEnv({'FUNCTION' : foo})
- # gvars = env.Dictionary()
- # func = scons_subst("$FUNCTION", env, mode=SUBST_RAW, call=None, gvars=gvars)
- # assert func is function_foo, func
- # func = scons_subst("$FUNCTION", env, mode=SUBST_CMD, call=None, gvars=gvars)
- # assert func is function_foo, func
- # func = scons_subst("$FUNCTION", env, mode=SUBST_SIG, call=None, gvars=gvars)
- # assert func is function_foo, func
-
def test_subst_overriding_gvars(self):
"""Test scons_subst(): supplying an overriding gvars dictionary"""
env = DummyEnv({'XXX' : 'xxx'})
diff --git a/src/engine/SCons/Taskmaster.py b/src/engine/SCons/Taskmaster.py
index 345534ec..069ac907 100644
--- a/src/engine/SCons/Taskmaster.py
+++ b/src/engine/SCons/Taskmaster.py
@@ -122,7 +122,7 @@ class Task(object):
aspects of controlling a build, so any given application
*should* be able to do what it wants by sub-classing this
class and overriding methods as appropriate. If an application
- needs to customze something by sub-classing Taskmaster (or
+ needs to customize something by sub-classing Taskmaster (or
some other build engine class), we should first try to migrate
that functionality into this class.
@@ -147,7 +147,7 @@ class Task(object):
This hook gets called as part of preparing a task for execution
(that is, a Node to be built). As part of figuring out what Node
- should be built next, the actually target list may be altered,
+ should be built next, the actual target list may be altered,
along with a message describing the alteration. The calling
interface can subclass Task and provide a concrete implementation
of this method to see those messages.
@@ -664,9 +664,9 @@ class Taskmaster(object):
its parent node.
A pending child can occur when the Taskmaster completes a loop
- through a cycle. For example, lets imagine a graph made of
- three node (A, B and C) making a cycle. The evaluation starts
- at node A. The taskmaster first consider whether node A's
+ through a cycle. For example, let's imagine a graph made of
+ three nodes (A, B and C) making a cycle. The evaluation starts
+ at node A. The Taskmaster first considers whether node A's
child B is up-to-date. Then, recursively, node B needs to
check whether node C is up-to-date. This leaves us with a
dependency graph looking like:
@@ -951,7 +951,7 @@ class Taskmaster(object):
task.make_ready()
except:
# We had a problem just trying to get this task ready (like
- # a child couldn't be linked in to a VariantDir when deciding
+ # a child couldn't be linked to a VariantDir when deciding
# whether this node is current). Arrange to raise the
# exception when the Task is "executed."
self.ready_exc = sys.exc_info()
diff --git a/src/engine/SCons/Tool/BitKeeper.py b/src/engine/SCons/Tool/BitKeeper.py
index 191879f2..44632d78 100644
--- a/src/engine/SCons/Tool/BitKeeper.py
+++ b/src/engine/SCons/Tool/BitKeeper.py
@@ -49,7 +49,6 @@ def generate(env):
act = SCons.Action.Action("$BITKEEPERCOM", "$BITKEEPERCOMSTR")
return SCons.Builder.Builder(action = act, env = env)
- #setattr(env, 'BitKeeper', BitKeeperFactory)
env.BitKeeper = BitKeeperFactory
env['BITKEEPER'] = 'bk'
diff --git a/src/engine/SCons/Tool/CVS.py b/src/engine/SCons/Tool/CVS.py
index a5062310..08cf04ca 100644
--- a/src/engine/SCons/Tool/CVS.py
+++ b/src/engine/SCons/Tool/CVS.py
@@ -55,7 +55,6 @@ def generate(env):
CVSREPOSITORY = repos,
CVSMODULE = module)
- #setattr(env, 'CVS', CVSFactory)
env.CVS = CVSFactory
env['CVS'] = 'cvs'
diff --git a/src/engine/SCons/Tool/GettextCommon.py b/src/engine/SCons/Tool/GettextCommon.py
index bdd52c0d..f01371aa 100644
--- a/src/engine/SCons/Tool/GettextCommon.py
+++ b/src/engine/SCons/Tool/GettextCommon.py
@@ -251,7 +251,7 @@ class RPaths(object):
recently re-created. For such reason, we need a function, which always
returns relative paths. This is the purpose of `RPaths` callable object.
- The `__call__` method returns paths relative to current woking directory, but
+ The `__call__` method returns paths relative to current working directory, but
we assume, that *xgettext(1)* is run from the directory, where target file is
going to be created.
@@ -330,7 +330,7 @@ def _init_po_files(target, source, env):
autoinit = False
# Well, if everything outside works well, this loop should do single
# iteration. Otherwise we are rebuilding all the targets even, if just
- # one has changed (but is this out fault?).
+ # one has changed (but is this our fault?).
for tgt in target:
if not tgt.exists():
if autoinit:
diff --git a/src/engine/SCons/Tool/MSCommon/common.py b/src/engine/SCons/Tool/MSCommon/common.py
index 9549a669..be890e2c 100644
--- a/src/engine/SCons/Tool/MSCommon/common.py
+++ b/src/engine/SCons/Tool/MSCommon/common.py
@@ -93,7 +93,7 @@ def has_reg(value):
try:
SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, value)
ret = True
- except WindowsError:
+ except SCons.Util.WinError:
ret = False
return ret
@@ -180,7 +180,7 @@ def get_output(vcbat, args = None, env = None):
stdout = popen.stdout.read()
stderr = popen.stderr.read()
- # Extra debug logic, uncomment if necessar
+ # Extra debug logic, uncomment if necessary
# debug('get_output():stdout:%s'%stdout)
# debug('get_output():stderr:%s'%stderr)
@@ -226,33 +226,6 @@ def parse_output(output, keep = ("INCLUDE", "LIB", "LIBPATH", "PATH")):
return dkeep
-# TODO(sgk): unused
-def output_to_dict(output):
- """Given an output string, parse it to find env variables.
-
- Return a dict where keys are variables names, and values their content"""
- envlinem = re.compile(r'^([a-zA-z0-9]+)=([\S\s]*)$')
- parsedenv = {}
- for line in output.splitlines():
- m = envlinem.match(line)
- if m:
- parsedenv[m.group(1)] = m.group(2)
- return parsedenv
-
-# TODO(sgk): unused
-def get_new(l1, l2):
- """Given two list l1 and l2, return the items in l2 which are not in l1.
- Order is maintained."""
-
- # We don't try to be smart: lists are small, and this is not the bottleneck
- # is any case
- new = []
- for i in l2:
- if i not in l1:
- new.append(i)
-
- return new
-
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
diff --git a/src/engine/SCons/Tool/MSCommon/netframework.py b/src/engine/SCons/Tool/MSCommon/netframework.py
index 6124e5b4..8fa3c436 100644
--- a/src/engine/SCons/Tool/MSCommon/netframework.py
+++ b/src/engine/SCons/Tool/MSCommon/netframework.py
@@ -27,6 +27,7 @@ __doc__ = """
import os
import re
+import SCons.Util
from common import read_reg, debug
@@ -40,7 +41,7 @@ def find_framework_root():
try:
froot = read_reg(_FRAMEWORKDIR_HKEY_ROOT)
debug("Found framework install root in registry: %s" % froot)
- except WindowsError, e:
+ except SCons.Util.WinError, e:
debug("Could not read reg key %s" % _FRAMEWORKDIR_HKEY_ROOT)
return None
diff --git a/src/engine/SCons/Tool/MSCommon/sdk.py b/src/engine/SCons/Tool/MSCommon/sdk.py
index afb37fe4..b8b71a64 100644
--- a/src/engine/SCons/Tool/MSCommon/sdk.py
+++ b/src/engine/SCons/Tool/MSCommon/sdk.py
@@ -80,7 +80,7 @@ class SDKDefinition(object):
try:
sdk_dir = common.read_reg(hkey)
- except WindowsError, e:
+ except SCons.Util.WinError, e:
debug('find_sdk_dir(): no SDK registry key %s' % repr(hkey))
return None
@@ -168,7 +168,7 @@ SDK70VCSetupScripts = { 'x86' : r'bin\vcvars32.bat',
#
# The first SDK found in the list is the one used by default if there
# are multiple SDKs installed. Barring good reasons to the contrary,
-# this means we should list SDKs with from most recent to oldest.
+# this means we should list SDKs from most recent to oldest.
#
# If you update this list, update the documentation in Tool/mssdk.xml.
SupportedSDKList = [
@@ -306,29 +306,6 @@ def set_sdk_by_directory(env, sdk_dir):
for variable, directory in env_tuple_list:
env.PrependENVPath(variable, directory)
-
-# TODO(sgk): currently unused; remove?
-def get_cur_sdk_dir_from_reg():
- """Try to find the platform sdk directory from the registry.
-
- Return None if failed or the directory does not exist"""
- if not SCons.Util.can_read_reg:
- debug('SCons cannot read registry')
- return None
-
- try:
- val = common.read_reg(_CURINSTALLED_SDK_HKEY_ROOT)
- debug("Found current sdk dir in registry: %s" % val)
- except WindowsError, e:
- debug("Did not find current sdk in registry")
- return None
-
- if not os.path.exists(val):
- debug("Current sdk dir %s not on fs" % val)
- return None
-
- return val
-
def get_sdk_by_version(mssdk):
if mssdk not in SupportedSDKMap:
msg = "SDK version %s is not supported" % repr(mssdk)
@@ -343,9 +320,6 @@ def get_default_sdk():
return None
return InstalledSDKList[0]
-
-
-
def mssdk_setup_env(env):
debug('sdk.py:mssdk_setup_env()')
if 'MSSDK_DIR' in env:
diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py
index 4fb0d5a1..97e2ffcc 100644
--- a/src/engine/SCons/Tool/MSCommon/vc.py
+++ b/src/engine/SCons/Tool/MSCommon/vc.py
@@ -244,13 +244,13 @@ def find_vc_pdir(msvc_version):
try:
# ordinally at win64, try Wow6432Node first.
comps = common.read_reg(root + 'Wow6432Node\\' + key, hkroot)
- except WindowsError, e:
+ except SCons.Util.WinError, e:
# at Microsoft Visual Studio for Python 2.7, value is not in Wow6432Node
pass
if not comps:
# not Win64, or Microsoft Visual Studio for Python 2.7
comps = common.read_reg(root + key, hkroot)
- except WindowsError, e:
+ except SCons.Util.WinError, e:
debug('find_vc_dir(): no VC registry key %s' % repr(key))
else:
debug('find_vc_dir(): found VC in registry: %s' % comps)
diff --git a/src/engine/SCons/Tool/MSCommon/vs.py b/src/engine/SCons/Tool/MSCommon/vs.py
index d9eb1e32..0bdbf0c8 100644
--- a/src/engine/SCons/Tool/MSCommon/vs.py
+++ b/src/engine/SCons/Tool/MSCommon/vs.py
@@ -52,8 +52,6 @@ class VisualStudio(object):
self.__dict__.update(kw)
self._cache = {}
- #
-
def find_batch_file(self):
vs_dir = self.get_vs_dir()
if not vs_dir:
@@ -85,7 +83,7 @@ class VisualStudio(object):
key = root + key
try:
comps = read_reg(key)
- except WindowsError, e:
+ except SCons.Util.WinError, e:
debug('find_vs_dir_by_reg(): no VS registry key %s' % repr(key))
else:
debug('find_vs_dir_by_reg(): found VS in registry: %s' % comps)
@@ -116,8 +114,6 @@ class VisualStudio(object):
return None
return executable
- #
-
def get_batch_file(self):
try:
return self._cache['batch_file']
@@ -471,7 +467,7 @@ def get_default_version(env):
"""Returns the default version string to use for MSVS.
If no version was requested by the user through the MSVS environment
- variable, query all the available the visual studios through
+ variable, query all the available visual studios through
get_installed_visual_studios, and take the highest one.
Return
diff --git a/src/engine/SCons/Tool/Perforce.py b/src/engine/SCons/Tool/Perforce.py
index 15dd83f3..c8cf931f 100644
--- a/src/engine/SCons/Tool/Perforce.py
+++ b/src/engine/SCons/Tool/Perforce.py
@@ -38,9 +38,6 @@ import SCons.Builder
import SCons.Node.FS
import SCons.Util
-# This function should maybe be moved to SCons.Util?
-from SCons.Tool.PharLapCommon import addPathIfNotExists
-
# Variables that we want to import from the base OS environment.
_import_env = [ 'P4PORT', 'P4CLIENT', 'P4USER', 'USER', 'USERNAME', 'P4PASSWD',
@@ -58,7 +55,6 @@ def generate(env):
W.warn(W.DeprecatedSourceCodeWarning, """The Perforce() factory is deprecated and there is no replacement.""")
return SCons.Builder.Builder(action = PerforceAction, env = env)
- #setattr(env, 'Perforce', PerforceFactory)
env.Perforce = PerforceFactory
env['P4'] = 'p4'
@@ -87,7 +83,7 @@ def generate(env):
k=SCons.Util.RegOpenKeyEx(SCons.Util.hkey_mod.HKEY_LOCAL_MACHINE,
'Software\\Perforce\\environment')
val, tok = SCons.Util.RegQueryValueEx(k, 'P4INSTROOT')
- addPathIfNotExists(environ, 'PATH', val)
+ SCons.Util.AddPathIfNotExists(environ, 'PATH', val)
except SCons.Util.RegError:
# Can't detect where Perforce is, hope the user has it set in the
# PATH.
diff --git a/src/engine/SCons/Tool/PharLapCommon.py b/src/engine/SCons/Tool/PharLapCommon.py
index 9f925b9c..864a1852 100644
--- a/src/engine/SCons/Tool/PharLapCommon.py
+++ b/src/engine/SCons/Tool/PharLapCommon.py
@@ -85,28 +85,6 @@ def getPharLapVersion():
# Default return for Phar Lap 9.1
return 910
-def addPathIfNotExists(env_dict, key, path, sep=os.pathsep):
- """This function will take 'key' out of the dictionary
- 'env_dict', then add the path 'path' to that key if it is not
- already there. This treats the value of env_dict[key] as if it
- has a similar format to the PATH variable...a list of paths
- separated by tokens. The 'path' will get added to the list if it
- is not already there."""
- try:
- is_list = 1
- paths = env_dict[key]
- if not SCons.Util.is_List(env_dict[key]):
- paths = paths.split(sep)
- is_list = 0
- if os.path.normcase(path) not in list(map(os.path.normcase, paths)):
- paths = [ path ] + paths
- if is_list:
- env_dict[key] = paths
- else:
- env_dict[key] = sep.join(paths)
- except KeyError:
- env_dict[key] = path
-
def addPharLapPaths(env):
"""This function adds the path to the Phar Lap binaries, includes,
and libraries, if they are not already there."""
@@ -117,14 +95,14 @@ def addPharLapPaths(env):
except KeyError:
env_dict = {}
env['ENV'] = env_dict
- addPathIfNotExists(env_dict, 'PATH',
- os.path.join(ph_path, 'bin'))
- addPathIfNotExists(env_dict, 'INCLUDE',
- os.path.join(ph_path, 'include'))
- addPathIfNotExists(env_dict, 'LIB',
- os.path.join(ph_path, 'lib'))
- addPathIfNotExists(env_dict, 'LIB',
- os.path.join(ph_path, os.path.normpath('lib/vclib')))
+ SCons.Util.AddPathIfNotExists(env_dict, 'PATH',
+ os.path.join(ph_path, 'bin'))
+ SCons.Util.AddPathIfNotExists(env_dict, 'INCLUDE',
+ os.path.join(ph_path, 'include'))
+ SCons.Util.AddPathIfNotExists(env_dict, 'LIB',
+ os.path.join(ph_path, 'lib'))
+ SCons.Util.AddPathIfNotExists(env_dict, 'LIB',
+ os.path.join(ph_path, os.path.normpath('lib/vclib')))
env['PHARLAP_PATH'] = getPharLapPath()
env['PHARLAP_VERSION'] = str(getPharLapVersion())
diff --git a/src/engine/SCons/Tool/PharLapCommonTests.py b/src/engine/SCons/Tool/PharLapCommonTests.py
deleted file mode 100644
index e67d4268..00000000
--- a/src/engine/SCons/Tool/PharLapCommonTests.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#
-# __COPYRIGHT__
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-import unittest
-import os.path
-import os
-import sys
-
-import TestUnit
-
-import SCons.Errors
-from SCons.Tool.PharLapCommon import *
-
-class PharLapCommonTestCase(unittest.TestCase):
- def test_addPathIfNotExists(self):
- """Test the addPathIfNotExists() function"""
- env_dict = { 'FOO' : os.path.normpath('/foo/bar') + os.pathsep + \
- os.path.normpath('/baz/blat'),
- 'BAR' : os.path.normpath('/foo/bar') + os.pathsep + \
- os.path.normpath('/baz/blat'),
- 'BLAT' : [ os.path.normpath('/foo/bar'),
- os.path.normpath('/baz/blat') ] }
- addPathIfNotExists(env_dict, 'FOO', os.path.normpath('/foo/bar'))
- addPathIfNotExists(env_dict, 'BAR', os.path.normpath('/bar/foo'))
- addPathIfNotExists(env_dict, 'BAZ', os.path.normpath('/foo/baz'))
- addPathIfNotExists(env_dict, 'BLAT', os.path.normpath('/baz/blat'))
- addPathIfNotExists(env_dict, 'BLAT', os.path.normpath('/baz/foo'))
-
- assert env_dict['FOO'] == os.path.normpath('/foo/bar') + os.pathsep + \
- os.path.normpath('/baz/blat'), env_dict['FOO']
- assert env_dict['BAR'] == os.path.normpath('/bar/foo') + os.pathsep + \
- os.path.normpath('/foo/bar') + os.pathsep + \
- os.path.normpath('/baz/blat'), env_dict['BAR']
- assert env_dict['BAZ'] == os.path.normpath('/foo/baz'), env_dict['BAZ']
- assert env_dict['BLAT'] == [ os.path.normpath('/baz/foo'),
- os.path.normpath('/foo/bar'),
- os.path.normpath('/baz/blat') ], env_dict['BLAT' ]
-
-if __name__ == "__main__":
- suite = unittest.makeSuite(PharLapCommonTestCase, 'test_')
- TestUnit.run(suite)
-
-# Local Variables:
-# tab-width:4
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/src/engine/SCons/Tool/RCS.py b/src/engine/SCons/Tool/RCS.py
index 6ac1a33c..e24b89a3 100644
--- a/src/engine/SCons/Tool/RCS.py
+++ b/src/engine/SCons/Tool/RCS.py
@@ -46,7 +46,6 @@ def generate(env):
act = SCons.Action.Action('$RCS_COCOM', '$RCS_COCOMSTR')
return SCons.Builder.Builder(action = act, env = env)
- #setattr(env, 'RCS', RCSFactory)
env.RCS = RCSFactory
env['RCS'] = 'rcs'
diff --git a/src/engine/SCons/Tool/SCCS.py b/src/engine/SCons/Tool/SCCS.py
index 76534685..92ded51d 100644
--- a/src/engine/SCons/Tool/SCCS.py
+++ b/src/engine/SCons/Tool/SCCS.py
@@ -46,7 +46,6 @@ def generate(env):
act = SCons.Action.Action('$SCCSCOM', '$SCCSCOMSTR')
return SCons.Builder.Builder(action = act, env = env)
- #setattr(env, 'SCCS', SCCSFactory)
env.SCCS = SCCSFactory
env['SCCS'] = 'sccs'
diff --git a/src/engine/SCons/Tool/Subversion.py b/src/engine/SCons/Tool/Subversion.py
index ee709254..f1b3708f 100644
--- a/src/engine/SCons/Tool/Subversion.py
+++ b/src/engine/SCons/Tool/Subversion.py
@@ -54,7 +54,6 @@ def generate(env):
SVNREPOSITORY = repos,
SVNMODULE = module)
- #setattr(env, 'Subversion', SubversionFactory)
env.Subversion = SubversionFactory
env['SVN'] = 'svn'
diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py
index 05947983..f16e9e23 100644
--- a/src/engine/SCons/Tool/__init__.py
+++ b/src/engine/SCons/Tool/__init__.py
@@ -108,7 +108,7 @@ class Tool(object):
self.options = module.options
def _tool_module(self):
- # TODO: Interchange zipimport with normal initilization for better error reporting
+ # TODO: Interchange zipimport with normal initialization for better error reporting
oldpythonpath = sys.path
sys.path = self.toolpath + sys.path
diff --git a/src/engine/SCons/Tool/aixf77.py b/src/engine/SCons/Tool/aixf77.py
index a667e843..cf07a0bb 100644
--- a/src/engine/SCons/Tool/aixf77.py
+++ b/src/engine/SCons/Tool/aixf77.py
@@ -41,7 +41,7 @@ import f77
# It would be good to look for the AIX F77 package the same way we're now
# looking for the C and C++ packages. This should be as easy as supplying
# the correct package names in the following list and uncommenting the
-# SCons.Platform.aix_get_xlc() call the in the function below.
+# SCons.Platform.aix_get_xlc() call in the function below.
packages = []
def get_xlf77(env):
diff --git a/src/engine/SCons/Tool/cyglink.py b/src/engine/SCons/Tool/cyglink.py
index 5230910a..921f0ebf 100644
--- a/src/engine/SCons/Tool/cyglink.py
+++ b/src/engine/SCons/Tool/cyglink.py
@@ -143,7 +143,7 @@ def _versioned_implib_name(env, libnode, version, prefix, suffix, **kw):
implib_libtype=kw['libtype'])
def _versioned_implib_symlinks(env, libnode, version, prefix, suffix, **kw):
- """Generate link names that should be created for a versioned shared lirbrary.
+ """Generate link names that should be created for a versioned shared library.
Returns a list in the form [ (link, linktarget), ... ]
"""
Verbose = False
diff --git a/src/engine/SCons/Tool/docbook/__init__.py b/src/engine/SCons/Tool/docbook/__init__.py
index aead43c6..71e93a7c 100644
--- a/src/engine/SCons/Tool/docbook/__init__.py
+++ b/src/engine/SCons/Tool/docbook/__init__.py
@@ -10,7 +10,7 @@ selection method.
"""
#
-# Copyright (c) 2001-7,2010 The SCons Foundation
+# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -852,30 +852,16 @@ def generate(env):
)
_detect(env)
- try:
- env.AddMethod(DocbookEpub, "DocbookEpub")
- env.AddMethod(DocbookHtml, "DocbookHtml")
- env.AddMethod(DocbookHtmlChunked, "DocbookHtmlChunked")
- env.AddMethod(DocbookHtmlhelp, "DocbookHtmlhelp")
- env.AddMethod(DocbookPdf, "DocbookPdf")
- env.AddMethod(DocbookMan, "DocbookMan")
- env.AddMethod(DocbookSlidesPdf, "DocbookSlidesPdf")
- env.AddMethod(DocbookSlidesHtml, "DocbookSlidesHtml")
- env.AddMethod(DocbookXInclude, "DocbookXInclude")
- env.AddMethod(DocbookXslt, "DocbookXslt")
- except AttributeError:
- # Looks like we use a pre-0.98 version of SCons...
- from SCons.Script.SConscript import SConsEnvironment
- SConsEnvironment.DocbookEpub = DocbookEpub
- SConsEnvironment.DocbookHtml = DocbookHtml
- SConsEnvironment.DocbookHtmlChunked = DocbookHtmlChunked
- SConsEnvironment.DocbookHtmlhelp = DocbookHtmlhelp
- SConsEnvironment.DocbookPdf = DocbookPdf
- SConsEnvironment.DocbookMan = DocbookMan
- SConsEnvironment.DocbookSlidesPdf = DocbookSlidesPdf
- SConsEnvironment.DocbookSlidesHtml = DocbookSlidesHtml
- SConsEnvironment.DocbookXInclude = DocbookXInclude
- SConsEnvironment.DocbookXslt = DocbookXslt
+ env.AddMethod(DocbookEpub, "DocbookEpub")
+ env.AddMethod(DocbookHtml, "DocbookHtml")
+ env.AddMethod(DocbookHtmlChunked, "DocbookHtmlChunked")
+ env.AddMethod(DocbookHtmlhelp, "DocbookHtmlhelp")
+ env.AddMethod(DocbookPdf, "DocbookPdf")
+ env.AddMethod(DocbookMan, "DocbookMan")
+ env.AddMethod(DocbookSlidesPdf, "DocbookSlidesPdf")
+ env.AddMethod(DocbookSlidesHtml, "DocbookSlidesHtml")
+ env.AddMethod(DocbookXInclude, "DocbookXInclude")
+ env.AddMethod(DocbookXslt, "DocbookXslt")
def exists(env):
diff --git a/src/engine/SCons/Tool/gnulink.py b/src/engine/SCons/Tool/gnulink.py
index 6b0d5b33..2f1aa036 100644
--- a/src/engine/SCons/Tool/gnulink.py
+++ b/src/engine/SCons/Tool/gnulink.py
@@ -60,7 +60,7 @@ def generate(env):
link._setup_versioned_lib_variables(env, tool = 'gnulink', use_soname = use_soname)
env['LINKCALLBACKS'] = link._versioned_lib_callbacks()
- # For backward-compatiblity with older SCons versions
+ # For backward-compatibility with older SCons versions
env['SHLIBVERSIONFLAGS'] = SCons.Util.CLVar('-Wl,-Bsymbolic')
def exists(env):
diff --git a/src/engine/SCons/Tool/icl.py b/src/engine/SCons/Tool/icl.py
index caa22814..a0bad31b 100644
--- a/src/engine/SCons/Tool/icl.py
+++ b/src/engine/SCons/Tool/icl.py
@@ -35,7 +35,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import SCons.Tool.intelc
-# This has been completely superceded by intelc.py, which can
+# This has been completely superseded by intelc.py, which can
# handle both Windows and Linux versions.
def generate(*args, **kw):
diff --git a/src/engine/SCons/Tool/install.py b/src/engine/SCons/Tool/install.py
index 4226d567..e84ec7a3 100644
--- a/src/engine/SCons/Tool/install.py
+++ b/src/engine/SCons/Tool/install.py
@@ -39,7 +39,7 @@ import stat
import SCons.Action
import SCons.Tool
-from SCons.Util import make_path_relative
+import SCons.Util
#
# We keep track of *all* installed files.
@@ -91,7 +91,7 @@ def scons_copytree(src, dst, symlinks=False):
errors.extend(err.args[0])
try:
shutil.copystat(src, dst)
- except WindowsError:
+ except SCons.Util.WinError:
# can't copy file access times on Windows
pass
except OSError, why:
@@ -225,7 +225,7 @@ def stringFunc(target, source, env):
# Emitter functions
#
def add_targets_to_INSTALLED_FILES(target, source, env):
- """ an emitter that adds all target files to the list stored in the
+ """ An emitter that adds all target files to the list stored in the
_INSTALLED_FILES global variable. This way all installed files of one
scons call will be collected.
"""
@@ -236,7 +236,7 @@ def add_targets_to_INSTALLED_FILES(target, source, env):
return (target, source)
def add_versioned_targets_to_INSTALLED_FILES(target, source, env):
- """ an emitter that adds all target files to the list stored in the
+ """ An emitter that adds all target files to the list stored in the
_INSTALLED_FILES global variable. This way all installed files of one
scons call will be collected.
"""
@@ -254,7 +254,7 @@ def add_versioned_targets_to_INSTALLED_FILES(target, source, env):
return (target, source)
class DESTDIR_factory(object):
- """ a node factory, where all files will be relative to the dir supplied
+ """ A node factory, where all files will be relative to the dir supplied
in the constructor.
"""
def __init__(self, env, dir):
@@ -262,11 +262,11 @@ class DESTDIR_factory(object):
self.dir = env.arg2nodes( dir, env.fs.Dir )[0]
def Entry(self, name):
- name = make_path_relative(name)
+ name = SCons.Util.make_path_relative(name)
return self.dir.Entry(name)
def Dir(self, name):
- name = make_path_relative(name)
+ name = SCons.Util.make_path_relative(name)
return self.dir.Dir(name)
#
@@ -304,14 +304,12 @@ def InstallBuilderWrapper(env, target=None, source=None, dir=None, **kw):
# '#' on the file name portion as meaning the Node should
# be relative to the top-level SConstruct directory.
target = env.fs.Entry('.'+os.sep+src.name, dnode)
- #tgt.extend(BaseInstallBuilder(env, target, src, **kw))
tgt.extend(BaseInstallBuilder(env, target, src, **kw))
return tgt
def InstallAsBuilderWrapper(env, target=None, source=None, **kw):
result = []
for src, tgt in map(lambda x, y: (x, y), source, target):
- #result.extend(BaseInstallBuilder(env, tgt, src, **kw))
result.extend(BaseInstallBuilder(env, tgt, src, **kw))
return result
diff --git a/src/engine/SCons/Tool/intelc.py b/src/engine/SCons/Tool/intelc.py
index 57258f34..b1cb5e3c 100644
--- a/src/engine/SCons/Tool/intelc.py
+++ b/src/engine/SCons/Tool/intelc.py
@@ -62,15 +62,6 @@ class MissingDirError(IntelCError): # dir not found
class NoRegistryModuleError(IntelCError): # can't read registry at all
pass
-def uniquify(s):
- """Return a sequence containing only one copy of each unique element from input sequence s.
- Does not preserve order.
- Input sequence must be hashable (i.e. must be usable as a dictionary key)."""
- u = {}
- for x in s:
- u[x] = 1
- return list(u.keys())
-
def linux_ver_normalize(vstr):
"""Normalize a Linux compiler version number.
Intel changed from "80" to "9.0" in 2005, so we assume if the number
@@ -191,7 +182,7 @@ def get_intel_registry_value(valuename, version=None, abi=None):
except SCons.Util.RegError:
raise MissingRegistryError("%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi))
- except WindowsError:
+ except SCons.Util.WinError:
raise MissingRegistryError("%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi))
# Get the value:
@@ -215,7 +206,7 @@ def get_all_compiler_versions():
try:
k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE,
keyname)
- except WindowsError:
+ except SCons.Util.WinError:
# For version 13 or later, check for default instance UUID
if is_win64:
keyname = 'Software\\WoW6432Node\\Intel\\Suites'
@@ -224,7 +215,7 @@ def get_all_compiler_versions():
try:
k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE,
keyname)
- except WindowsError:
+ except SCons.Util.WinError:
return []
i = 0
versions = []
@@ -302,7 +293,7 @@ def get_all_compiler_versions():
"""Given a dot-separated version string, return a tuple of ints representing it."""
return [int(x) for x in str.split('.')]
# split into ints, sort, then remove dups
- return sorted(uniquify(versions), key=keyfunc, reverse=True)
+ return sorted(SCons.Util.unique(versions), key=keyfunc, reverse=True)
def get_intel_compiler_top(version, abi):
"""
diff --git a/src/engine/SCons/Tool/mslink.py b/src/engine/SCons/Tool/mslink.py
index 1390c206..74c20d0e 100644
--- a/src/engine/SCons/Tool/mslink.py
+++ b/src/engine/SCons/Tool/mslink.py
@@ -305,7 +305,7 @@ def generate(env):
# if the manifest actually exists before trying to run mt with it.
env['MTEXECOM'] = '-$MT $MTFLAGS -manifest ${TARGET}.manifest $_MANIFEST_SOURCES -outputresource:$TARGET;1'
env['MTSHLIBCOM'] = '-$MT $MTFLAGS -manifest ${TARGET}.manifest $_MANIFEST_SOURCES -outputresource:$TARGET;2'
- # Future work garyo 27-Feb-11
+ # TODO Future work garyo 27-Feb-11
env['_MANIFEST_SOURCES'] = None # _windowsManifestSources
# Set-up ms tools paths
diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py
index 355eeed7..113f8598 100644
--- a/src/engine/SCons/Tool/msvs.py
+++ b/src/engine/SCons/Tool/msvs.py
@@ -100,42 +100,6 @@ def msvs_parse_version(s):
num, suite = version_re.match(s).groups()
return float(num), suite
-# os.path.relpath has been introduced in Python 2.6
-# We define it locally for earlier versions of Python
-def relpath(path, start=os.path.curdir):
- """Return a relative version of a path"""
- import sys
- if not path:
- raise ValueError("no path specified")
- start_list = os.path.abspath(start).split(os.sep)
- path_list = os.path.abspath(path).split(os.sep)
- if 'posix' in sys.builtin_module_names:
- # Work out how much of the filepath is shared by start and path.
- i = len(os.path.commonprefix([start_list, path_list]))
- else:
- if start_list[0].lower() != path_list[0].lower():
- unc_path, rest = os.path.splitunc(path)
- unc_start, rest = os.path.splitunc(start)
- if bool(unc_path) ^ bool(unc_start):
- raise ValueError("Cannot mix UNC and non-UNC paths (%s and %s)"
- % (path, start))
- else:
- raise ValueError("path is on drive %s, start on drive %s"
- % (path_list[0], start_list[0]))
- # Work out how much of the filepath is shared by start and path.
- for i in range(min(len(start_list), len(path_list))):
- if start_list[i].lower() != path_list[i].lower():
- break
- else:
- i += 1
- rel_list = [os.pardir] * (len(start_list)-i) + path_list[i:]
- if not rel_list:
- return os.path.curdir
- return os.path.join(*rel_list)
-
-if not "relpath" in os.path.__all__:
- os.path.relpath = relpath
-
# This is how we re-invoke SCons from inside MSVS Project files.
# The problem is that we might have been invoked as either scons.bat
# or scons.py. If we were invoked directly as scons.py, then we could
@@ -204,7 +168,7 @@ class _UserGenerator(object):
Base class for .dsp.user file generator
'''
# Default instance values.
- # Ok ... a bit defensive, but it does not seems reasonable to crash the
+ # Ok ... a bit defensive, but it does not seem reasonable to crash the
# build for a workspace user file. :-)
usrhead = None
usrdebg = None
@@ -212,7 +176,7 @@ class _UserGenerator(object):
createfile = False
def __init__(self, dspfile, source, env):
# DebugSettings should be a list of debug dictionary sorted in the same order
- # than the target list and variants
+ # as the target list and variants
if 'variant' not in env:
raise SCons.Errors.InternalError("You must specify a 'variant' argument (i.e. 'Debug' or " +\
"'Release') to create an MSVSProject.")
@@ -543,9 +507,7 @@ class _DSPGenerator(object):
self.sources[t[0]].append(self.env[t[1]])
for n in sourcenames:
- #TODO 2.4: compat layer supports sorted(key=) but not sort(key=)
- #TODO 2.4: self.sources[n].sort(key=lambda a: a.lower())
- self.sources[n] = sorted(self.sources[n], key=lambda a: a.lower())
+ self.sources[n].sort(key=lambda a: a.lower())
def AddConfig(self, variant, buildtarget, outdir, runfile, cmdargs, dspfile=dspfile):
config = Config()
diff --git a/src/engine/SCons/Tool/packaging/__init__.py b/src/engine/SCons/Tool/packaging/__init__.py
index 1a979abd..0f9a93d8 100644
--- a/src/engine/SCons/Tool/packaging/__init__.py
+++ b/src/engine/SCons/Tool/packaging/__init__.py
@@ -77,7 +77,6 @@ def Tag(env, target, source, *more_tags, **kw_tags):
# differentiate between "normal" object attributes and the
# packaging attributes. As the user should not be bothered with
# that, the prefix will be added here if missing.
- #if not k.startswith('PACKAGING_'):
if k[:10] != 'PACKAGING_':
k='PACKAGING_'+k
t.Tag(k, v)
@@ -175,7 +174,7 @@ def Package(env, target=None, source=None, **kw):
args=[x for x in args if x not in kw]
if len(args)==0:
- raise # must be a different error, so reraise
+ raise # must be a different error, so re-raise
elif len(args)==1:
raise SCons.Errors.UserError( "Missing Packagetag '%s' for %s packager"\
% (args[0],packager.__name__) )
@@ -232,8 +231,6 @@ def options(opts):
def copy_attr(f1, f2):
""" copies the special packaging file attributes from f1 to f2.
"""
- #pattrs = [x for x in dir(f1) if not hasattr(f2, x) and\
- # x.startswith('PACKAGING_')]
copyit = lambda x: not hasattr(f2, x) and x[:10] == 'PACKAGING_'
if f1._tags:
pattrs = list(filter(copyit, f1._tags))
@@ -278,7 +275,7 @@ def putintopackageroot(target, source, env, pkgroot, honor_install_location=1):
return (target, new_source)
def stripinstallbuilder(target, source, env):
- """ strips the install builder action from the source list and stores
+ """ Strips the install builder action from the source list and stores
the final installation location as the "PACKAGING_INSTALL_LOCATION" of
the source of the source file. This effectively removes the final installed
files from the source list while remembering the installation location.
diff --git a/src/engine/SCons/Tool/packaging/ipk.py b/src/engine/SCons/Tool/packaging/ipk.py
index 84f4e207..c6660331 100644
--- a/src/engine/SCons/Tool/packaging/ipk.py
+++ b/src/engine/SCons/Tool/packaging/ipk.py
@@ -35,7 +35,7 @@ from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot
def package(env, target, source, PACKAGEROOT, NAME, VERSION, DESCRIPTION,
SUMMARY, X_IPK_PRIORITY, X_IPK_SECTION, SOURCE_URL,
X_IPK_MAINTAINER, X_IPK_DEPENDS, **kw):
- """ this function prepares the packageroot directory for packaging with the
+ """ This function prepares the packageroot directory for packaging with the
ipkg builder.
"""
SCons.Tool.Tool('ipkg').generate(env)
@@ -45,7 +45,7 @@ def package(env, target, source, PACKAGEROOT, NAME, VERSION, DESCRIPTION,
target, source = stripinstallbuilder(target, source, env)
target, source = putintopackageroot(target, source, env, PACKAGEROOT)
- # This should be overridable from the construction environment,
+ # This should be overrideable from the construction environment,
# which it is by using ARCHITECTURE=.
# Guessing based on what os.uname() returns at least allows it
# to work for both i386 and x86_64 Linux systems.
@@ -61,7 +61,7 @@ def package(env, target, source, PACKAGEROOT, NAME, VERSION, DESCRIPTION,
if 'ARCHITECTURE' in kw:
buildarchitecture = kw['ARCHITECTURE']
- # setup the kw to contain the mandatory arguments to this fucntion.
+ # setup the kw to contain the mandatory arguments to this function.
# do this before calling any builder or setup function
loc=locals()
del loc['kw']
@@ -104,7 +104,7 @@ def gen_ipk_dir(proot, source, env, kw):
return proot
def build_specfiles(source, target, env):
- """ filter the targets for the needed files and use the variables in env
+ """ Filter the targets for the needed files and use the variables in env
to create the specfile.
"""
#
diff --git a/src/engine/SCons/Tool/packaging/msi.py b/src/engine/SCons/Tool/packaging/msi.py
index 172038f5..41b7ab7c 100644
--- a/src/engine/SCons/Tool/packaging/msi.py
+++ b/src/engine/SCons/Tool/packaging/msi.py
@@ -70,7 +70,7 @@ def convert_to_id(s, id_set):
try:
return id_set[id][s]
except KeyError:
- # no we did not so initialize with the id
+ # no we did not, so initialize with the id
if id not in id_set: id_set[id] = { s : id }
# there is a collision, generate an id which is unique by appending
# the collision number
@@ -79,7 +79,7 @@ def convert_to_id(s, id_set):
return id_set[id][s]
def is_dos_short_file_name(file):
- """ examine if the given file is in the 8.3 form.
+ """ Examine if the given file is in the 8.3 form.
"""
fname, ext = os.path.splitext(file)
proper_ext = len(ext) == 0 or (2 <= len(ext) <= 4) # the ext contains the dot
@@ -88,7 +88,7 @@ def is_dos_short_file_name(file):
return proper_ext and proper_fname
def gen_dos_short_file_name(file, filename_set):
- """ see http://support.microsoft.com/default.aspx?scid=kb;en-us;Q142982
+ """ See http://support.microsoft.com/default.aspx?scid=kb;en-us;Q142982
These are no complete 8.3 dos short names. The ~ char is missing and
replaced with one character from the filename. WiX warns about such
@@ -186,7 +186,7 @@ def string_wxsfile(target, source, env):
return "building WiX file %s"%( target[0].path )
def build_wxsfile(target, source, env):
- """ compiles a .wxs file from the keywords given in env['msi_spec'] and
+ """ Compiles a .wxs file from the keywords given in env['msi_spec'] and
by analyzing the tree of source nodes and their tags.
"""
file = open(target[0].get_abspath(), 'w')
@@ -268,7 +268,7 @@ def create_default_directory_layout(root, NAME, VERSION, VENDOR, filename_set):
# mandatory and optional file tags
#
def build_wxsfile_file_section(root, files, NAME, VERSION, VENDOR, filename_set, id_set):
- """ builds the Component sections of the wxs file with their included files.
+ """ Builds the Component sections of the wxs file with their included files.
Files need to be specified in 8.3 format and in the long name format, long
filenames will be converted automatically.
@@ -280,7 +280,7 @@ def build_wxsfile_file_section(root, files, NAME, VERSION, VENDOR, filename_set,
factory = Document()
def get_directory( node, dir ):
- """ returns the node under the given node representing the directory.
+ """ Returns the node under the given node representing the directory.
Returns the component node if dir is None or empty.
"""
@@ -415,7 +415,7 @@ def build_wxsfile_features_section(root, files, NAME, VERSION, SUMMARY, id_set):
root.getElementsByTagName('Product')[0].childNodes.append(Feature)
def build_wxsfile_default_gui(root):
- """ this function adds a default GUI to the wxs file
+ """ This function adds a default GUI to the wxs file
"""
factory = Document()
Product = root.getElementsByTagName('Product')[0]
@@ -429,7 +429,7 @@ def build_wxsfile_default_gui(root):
Product.childNodes.append(UIRef)
def build_license_file(directory, spec):
- """ creates a License.rtf file with the content of "X_MSI_LICENSE_TEXT"
+ """ Creates a License.rtf file with the content of "X_MSI_LICENSE_TEXT"
in the given directory
"""
name, text = '', ''
diff --git a/src/engine/SCons/Tool/packaging/rpm.py b/src/engine/SCons/Tool/packaging/rpm.py
index 92977d05..07501134 100644
--- a/src/engine/SCons/Tool/packaging/rpm.py
+++ b/src/engine/SCons/Tool/packaging/rpm.py
@@ -72,7 +72,6 @@ def package(env, target, source, PACKAGEROOT, NAME, VERSION,
# if no "SOURCE_URL" tag is given add a default one.
if 'SOURCE_URL' not in kw:
- #kw['SOURCE_URL']=(str(target[0])+".tar.gz").replace('.rpm', '')
kw['SOURCE_URL']=(str(target[0])+".tar.gz").replace('.rpm', '')
# mangle the source and target list for the rpmbuild
@@ -86,26 +85,21 @@ def package(env, target, source, PACKAGEROOT, NAME, VERSION,
def collectintargz(target, source, env):
""" Puts all source files into a tar.gz file. """
- # the rpm tool depends on a source package, until this is chagned
+ # the rpm tool depends on a source package, until this is changed
# this hack needs to be here that tries to pack all sources in.
sources = env.FindSourceFiles()
# filter out the target we are building the source list for.
- #sources = [s for s in sources if not (s in target)]
sources = [s for s in sources if s not in target]
# find the .spec file for rpm and add it since it is not necessarily found
# by the FindSourceFiles function.
- #sources.extend( [s for s in source if str(s).rfind('.spec')!=-1] )
- spec_file = lambda s: str(s).rfind('.spec') != -1
- sources.extend( list(filter(spec_file, source)) )
+ sources.extend( [s for s in source if str(s).rfind('.spec')!=-1] )
# as the source contains the url of the source package this rpm package
# is built from, we extract the target name
- #tarball = (str(target[0])+".tar.gz").replace('.rpm', '')
tarball = (str(target[0])+".tar.gz").replace('.rpm', '')
try:
- #tarball = env['SOURCE_URL'].split('/')[-1]
tarball = env['SOURCE_URL'].split('/')[-1]
except KeyError, e:
raise SCons.Errors.UserError( "Missing PackageTag '%s' for RPM packager" % e.args[0] )
@@ -194,7 +188,7 @@ def build_specfile_sections(spec):
return str
def build_specfile_header(spec):
- """ Builds all section but the %file of a rpm specfile
+ """ Builds all sections but the %file of a rpm specfile
"""
str = ""
@@ -312,11 +306,10 @@ class SimpleTagCompiler(object):
self.mandatory = mandatory
def compile(self, values):
- """ compiles the tagset and returns a str containing the result
+ """ Compiles the tagset and returns a str containing the result
"""
def is_international(tag):
- #return tag.endswith('_')
- return tag[-1:] == '_'
+ return tag.endswith('_')
def get_country_code(tag):
return tag[-2:]
@@ -327,7 +320,6 @@ class SimpleTagCompiler(object):
replacements = list(self.tagset.items())
str = ""
- #domestic = [ (k,v) for k,v in replacements if not is_international(k) ]
domestic = [t for t in replacements if not is_international(t[0])]
for key, replacement in domestic:
try:
@@ -336,11 +328,9 @@ class SimpleTagCompiler(object):
if self.mandatory:
raise e
- #international = [ (k,v) for k,v in replacements if is_international(k) ]
international = [t for t in replacements if is_international(t[0])]
for key, replacement in international:
try:
- #int_values_for_key = [ (get_country_code(k),v) for k,v in values.items() if strip_country_code(k) == key ]
x = [t for t in values.items() if strip_country_code(t[0]) == key]
int_values_for_key = [(get_country_code(t[0]),t[1]) for t in x]
for v in int_values_for_key:
diff --git a/src/engine/SCons/Tool/sunar.py b/src/engine/SCons/Tool/sunar.py
index eb58457c..ec076c80 100644
--- a/src/engine/SCons/Tool/sunar.py
+++ b/src/engine/SCons/Tool/sunar.py
@@ -2,7 +2,7 @@
Tool-specific initialization for Solaris (Forte) ar (library archive). If CC
exists, static libraries should be built with it, so that template
-instantians can be resolved.
+instantiations can be resolved.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py
index 053d85d4..3d429c96 100644
--- a/src/engine/SCons/Tool/tex.py
+++ b/src/engine/SCons/Tool/tex.py
@@ -700,12 +700,6 @@ def tex_emitter_core(target, source, env, graphics_extensions):
content = source[0].get_text_contents()
- # These variables are no longer used.
- #idx_exists = os.path.isfile(targetbase + '.idx')
- #nlo_exists = os.path.isfile(targetbase + '.nlo')
- #glo_exists = os.path.isfile(targetbase + '.glo')
- #acr_exists = os.path.isfile(targetbase + '.acn')
-
# set up list with the regular expressions
# we use to find features used
file_tests_search = [auxfile_re,
diff --git a/src/engine/SCons/Tool/textfile.py b/src/engine/SCons/Tool/textfile.py
index 8dc8f4b8..76efbd76 100644
--- a/src/engine/SCons/Tool/textfile.py
+++ b/src/engine/SCons/Tool/textfile.py
@@ -40,8 +40,8 @@ Textfile/Substfile builder for SCons.
expanded (its keys are not expanded). If a value of SUBST_DICT is
a python callable function, it is called and the result is expanded
as the value. Values are substituted in a "random" order; if any
- substitution could be further expanded by another subsitition, it
- is unpredictible whether the expansion will occur.
+ substitution could be further expanded by another substitution, it
+ is unpredictable whether the expansion will occur.
"""
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
diff --git a/src/engine/SCons/Tool/xgettext.py b/src/engine/SCons/Tool/xgettext.py
index 64436b8e..b8a88dcc 100644
--- a/src/engine/SCons/Tool/xgettext.py
+++ b/src/engine/SCons/Tool/xgettext.py
@@ -76,7 +76,7 @@ def _update_pot_file(target, source, env):
nop = lambda target, source, env : 0
# Save scons cwd and os cwd (NOTE: they may be different. After the job, we
- # revert ech one to its original state).
+ # revert each one to its original state).
save_cwd = env.fs.getcwd()
save_os_cwd = os.getcwd()
chdir = target[0].dir
@@ -134,7 +134,7 @@ def _update_pot_file(target, source, env):
explain = "new file"
if needs_update:
# Print message employing SCons.Action.Action for that.
- msg = "Writting " + repr(str(target[0])) + " (" + explain + ")"
+ msg = "Writing " + repr(str(target[0])) + " (" + explain + ")"
env.Execute(SCons.Action.Action(nop, msg))
f = open(str(target[0]),"w")
f.write(new_content)
@@ -142,7 +142,7 @@ def _update_pot_file(target, source, env):
return 0
else:
# Print message employing SCons.Action.Action for that.
- msg = "Not writting " + repr(str(target[0])) + " (" + explain + ")"
+ msg = "Not writing " + repr(str(target[0])) + " (" + explain + ")"
env.Execute(SCons.Action.Action(nop, msg))
return 0
#############################################################################
diff --git a/src/engine/SCons/Tool/yacc.py b/src/engine/SCons/Tool/yacc.py
index 5896cbea..648433bd 100644
--- a/src/engine/SCons/Tool/yacc.py
+++ b/src/engine/SCons/Tool/yacc.py
@@ -61,7 +61,7 @@ def _yaccEmitter(target, source, env, ysuf, hsuf):
base, ext = os.path.splitext(SCons.Util.to_String(source[0]))
target.append(base + env.subst("$YACCVCGFILESUFFIX"))
- # If -v is specirfied yacc will create the output debug file
+ # If -v is specified yacc will create the output debug file
# which is not really source for any process, but should
# be noted and also be cleaned
# Bug #2558
@@ -118,14 +118,6 @@ def generate(env):
env['YACCCOM'] = '$YACC $YACCFLAGS -o $TARGET $SOURCES'
env['YACCHFILESUFFIX'] = '.h'
- # Apparently, OS X now creates file.hpp like everybody else
- # I have no idea when it changed; it was fixed in 10.4
- #if env['PLATFORM'] == 'darwin':
- # # Bison on Mac OS X just appends ".h" to the generated target .cc
- # # or .cpp file name. Hooray for delayed expansion of variables.
- # env['YACCHXXFILESUFFIX'] = '${TARGET.suffix}.h'
- #else:
- # env['YACCHXXFILESUFFIX'] = '.hpp'
env['YACCHXXFILESUFFIX'] = '.hpp'
env['YACCVCGFILESUFFIX'] = '.vcg'
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py
index 4890ba2b..a834726a 100644
--- a/src/engine/SCons/Util.py
+++ b/src/engine/SCons/Util.py
@@ -92,7 +92,7 @@ def splitext(path):
def updrive(path):
"""
Make the drive letter (if any) upper case.
- This is useful because Windows is inconsitent on the case
+ This is useful because Windows is inconsistent on the case
of the drive letter, which can cause inconsistencies when
calculating command signatures.
"""
@@ -207,7 +207,7 @@ def render_tree(root, child_func, prune=0, margin=[0], visited={}):
IDX = lambda N: N and 1 or 0
-def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited={}):
+def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited=None):
"""
Print a tree of nodes. This is like render_tree, except it prints
lines directly instead of creating a string representation in memory,
@@ -224,6 +224,10 @@ def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited={}):
"""
rname = str(root)
+
+ # Initialize 'visited' dict, if required
+ if visited is None:
+ visited = {}
if showtags:
@@ -291,7 +295,7 @@ def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited={}):
# often too slow.
# We are using the following trick to speed up these
-# functions. Default arguments are used to take a snapshot of the
+# functions. Default arguments are used to take a snapshot of
# the global functions and constants used by these functions. This
# transforms accesses to global variable into local variables
# accesses (i.e. LOAD_FAST instead of LOAD_GLOBAL).
@@ -301,11 +305,11 @@ ListTypes = (list, UserList)
SequenceTypes = (list, tuple, UserList)
# Note that profiling data shows a speed-up when comparing
-# explicitely with str and unicode instead of simply comparing
+# explicitly with str and unicode instead of simply comparing
# with basestring. (at least on Python 2.5.1)
StringTypes = (str, unicode, UserString)
-# Empirically, it is faster to check explicitely for str and
+# Empirically, it is faster to check explicitly for str and
# unicode than for basestring.
BaseStringTypes = (str, unicode)
@@ -326,11 +330,11 @@ def is_String(obj, isinstance=isinstance, StringTypes=StringTypes):
def is_Scalar(obj, isinstance=isinstance, StringTypes=StringTypes, SequenceTypes=SequenceTypes):
# Profiling shows that there is an impressive speed-up of 2x
- # when explicitely checking for strings instead of just not
+ # when explicitly checking for strings instead of just not
# sequence when the argument (i.e. obj) is already a string.
# But, if obj is a not string then it is twice as fast to
# check only for 'not sequence'. The following code therefore
- # assumes that the obj argument is a string must of the time.
+ # assumes that the obj argument is a string most of the time.
return isinstance(obj, StringTypes) or not isinstance(obj, SequenceTypes)
def do_flatten(sequence, result, isinstance=isinstance,
@@ -431,7 +435,7 @@ def to_String_for_signature(obj, to_String_for_subst=to_String_for_subst,
#
# A special case is any object that has a __semi_deepcopy__() method,
# which we invoke to create the copy. Currently only used by
-# BuilderDict to actually prevent the copy operation (as invalid on that object)
+# BuilderDict to actually prevent the copy operation (as invalid on that object).
#
# The dispatch table approach used here is a direct rip-off from the
# normal Python copy module.
@@ -571,6 +575,15 @@ except ImportError:
pass
RegError = _NoError
+WinError = None
+# Make sure we have a definition of WindowsError so we can
+# run platform-independent tests of Windows functionality on
+# platforms other than Windows. (WindowsError is, in fact, an
+# OSError subclass on Windows.)
+class PlainWindowsError(OSError):
+ pass
+
+
if can_read_reg:
HKEY_CLASSES_ROOT = hkey_mod.HKEY_CLASSES_ROOT
HKEY_LOCAL_MACHINE = hkey_mod.HKEY_LOCAL_MACHINE
@@ -605,18 +618,9 @@ if can_read_reg:
return RegQueryValueEx(k,val)
else:
try:
- e = WindowsError
+ WinError = WindowsError
except NameError:
- # Make sure we have a definition of WindowsError so we can
- # run platform-independent tests of Windows functionality on
- # platforms other than Windows. (WindowsError is, in fact, an
- # OSError subclass on Windows.)
- class WindowsError(OSError):
- pass
- import builtins
- builtins.WindowsError = WindowsError
- else:
- del e
+ WinError = PlainWindowsError
HKEY_CLASSES_ROOT = None
HKEY_LOCAL_MACHINE = None
@@ -624,10 +628,10 @@ else:
HKEY_USERS = None
def RegGetValue(root, key):
- raise WindowsError
+ raise WinError
def RegOpenKeyEx(root, key):
- raise WindowsError
+ raise WinError
if sys.platform == 'win32':
@@ -889,6 +893,28 @@ def AppendPath(oldpath, newpath, sep = os.pathsep,
else:
return sep.join(paths)
+def AddPathIfNotExists(env_dict, key, path, sep=os.pathsep):
+ """This function will take 'key' out of the dictionary
+ 'env_dict', then add the path 'path' to that key if it is not
+ already there. This treats the value of env_dict[key] as if it
+ has a similar format to the PATH variable...a list of paths
+ separated by tokens. The 'path' will get added to the list if it
+ is not already there."""
+ try:
+ is_list = 1
+ paths = env_dict[key]
+ if not is_List(env_dict[key]):
+ paths = paths.split(sep)
+ is_list = 0
+ if os.path.normcase(path) not in list(map(os.path.normcase, paths)):
+ paths = [ path ] + paths
+ if is_list:
+ env_dict[key] = paths
+ else:
+ env_dict[key] = sep.join(paths)
+ except KeyError:
+ env_dict[key] = path
+
if sys.platform == 'cygwin':
def get_native_path(path):
"""Transforms an absolute path into a native path for the system. In
@@ -1156,38 +1182,40 @@ def uniquer_hashables(seq):
return result
+# Recipe 19.11 "Reading Lines with Continuation Characters",
+# by Alex Martelli, straight from the Python CookBook (2nd edition).
+def logical_lines(physical_lines, joiner=''.join):
+ logical_line = []
+ for line in physical_lines:
+ stripped = line.rstrip()
+ if stripped.endswith('\\'):
+ # a line which continues w/the next physical line
+ logical_line.append(stripped[:-1])
+ else:
+ # a line which does not continue, end of logical line
+ logical_line.append(line)
+ yield joiner(logical_line)
+ logical_line = []
+ if logical_line:
+ # end of sequence implies end of last logical line
+ yield joiner(logical_line)
-# Much of the logic here was originally based on recipe 4.9 from the
-# Python CookBook, but we had to dumb it way down for Python 1.5.2.
-class LogicalLines(object):
+class LogicalLines(object):
+ """ Wrapper class for the logical_lines method.
+
+ Allows us to read all "logical" lines at once from a
+ given file object.
+ """
+
def __init__(self, fileobj):
self.fileobj = fileobj
- def readline(self):
- result = []
- while True:
- line = self.fileobj.readline()
- if not line:
- break
- if line[-2:] == '\\\n':
- result.append(line[:-2])
- else:
- result.append(line)
- break
- return ''.join(result)
-
def readlines(self):
- result = []
- while True:
- line = self.readline()
- if not line:
- break
- result.append(line)
+ result = [l for l in logical_lines(self.fileobj)]
return result
-
class UniqueList(UserList):
def __init__(self, seq = []):
UserList.__init__(self, seq)
diff --git a/src/engine/SCons/UtilTests.py b/src/engine/SCons/UtilTests.py
index 795bc46d..d59d40c3 100644
--- a/src/engine/SCons/UtilTests.py
+++ b/src/engine/SCons/UtilTests.py
@@ -190,16 +190,7 @@ class UtilTestCase(unittest.TestCase):
assert expect == actual, (expect, actual)
sys.stdout = io.StringIO()
- # The following call should work here:
- # print_tree(node, get_children, 1, showtags=1)
- # For some reason I don't understand, though, *this*
- # time that we call print_tree, the visited dictionary
- # is still populated with the values from the last call!
- # I can't see why this would be, short of a bug in Python,
- # and rather than continue banging my head against the
- # brick wall for a *test*, we're going to going with
- # the cheap, easy workaround:
- print_tree(node, get_children, 1, showtags=1, visited={})
+ print_tree(node, get_children, 1, showtags=1)
actual = sys.stdout.getvalue()
assert withtags == actual, (withtags, actual)
finally:
@@ -487,6 +478,30 @@ class UtilTestCase(unittest.TestCase):
p1 = AppendPath(p1,r'C:\dir\num\three',sep = ';')
assert(p1 == r'C:\dir\num\one;C:\dir\num\two;C:\dir\num\three')
+ def test_addPathIfNotExists(self):
+ """Test the AddPathIfNotExists() function"""
+ env_dict = { 'FOO' : os.path.normpath('/foo/bar') + os.pathsep + \
+ os.path.normpath('/baz/blat'),
+ 'BAR' : os.path.normpath('/foo/bar') + os.pathsep + \
+ os.path.normpath('/baz/blat'),
+ 'BLAT' : [ os.path.normpath('/foo/bar'),
+ os.path.normpath('/baz/blat') ] }
+ AddPathIfNotExists(env_dict, 'FOO', os.path.normpath('/foo/bar'))
+ AddPathIfNotExists(env_dict, 'BAR', os.path.normpath('/bar/foo'))
+ AddPathIfNotExists(env_dict, 'BAZ', os.path.normpath('/foo/baz'))
+ AddPathIfNotExists(env_dict, 'BLAT', os.path.normpath('/baz/blat'))
+ AddPathIfNotExists(env_dict, 'BLAT', os.path.normpath('/baz/foo'))
+
+ assert env_dict['FOO'] == os.path.normpath('/foo/bar') + os.pathsep + \
+ os.path.normpath('/baz/blat'), env_dict['FOO']
+ assert env_dict['BAR'] == os.path.normpath('/bar/foo') + os.pathsep + \
+ os.path.normpath('/foo/bar') + os.pathsep + \
+ os.path.normpath('/baz/blat'), env_dict['BAR']
+ assert env_dict['BAZ'] == os.path.normpath('/foo/baz'), env_dict['BAZ']
+ assert env_dict['BLAT'] == [ os.path.normpath('/baz/foo'),
+ os.path.normpath('/foo/bar'),
+ os.path.normpath('/baz/blat') ], env_dict['BLAT' ]
+
def test_CLVar(self):
"""Test the command-line construction variable class"""
f = SCons.Util.CLVar('a b')
@@ -679,11 +694,8 @@ bling \
bling \ bling
bling
"""
- try:
- fobj = io.StringIO(content)
- except TypeError:
- # Python 2.7 and beyond require unicode strings.
- fobj = io.StringIO(unicode(content))
+ # Python 2.7 and beyond require unicode strings.
+ fobj = io.StringIO(unicode(content))
lines = LogicalLines(fobj).readlines()
assert lines == [
@@ -780,6 +792,7 @@ class flattenTestCase(unittest.TestCase):
result = flatten('xyz')
assert result == ['xyz'], result
+
if __name__ == "__main__":
suite = unittest.TestSuite()
tclasses = [ dictifyTestCase,
diff --git a/src/engine/SCons/Variables/BoolVariable.py b/src/engine/SCons/Variables/BoolVariable.py
index 6bc66bb1..c005a62d 100644
--- a/src/engine/SCons/Variables/BoolVariable.py
+++ b/src/engine/SCons/Variables/BoolVariable.py
@@ -51,7 +51,7 @@ def _text2bool(val):
will be returned.
See '__true_strings' and '__false_strings' for values considered
- 'true' or 'false respectivly.
+ 'true' or 'false respectively.
This is usable as 'converter' for SCons' Variables.
"""
@@ -74,7 +74,7 @@ def _validator(key, val, env):
def BoolVariable(key, help, default):
"""
- The input parameters describe a boolen option, thus they are
+ The input parameters describe a boolean option, thus they are
returned with the correct converter and validator appended. The
'help' text will by appended by '(yes|no) to show the valid
valued. The result is usable for input to opts.Add().
diff --git a/src/engine/SCons/Variables/EnumVariable.py b/src/engine/SCons/Variables/EnumVariable.py
index 582be277..9448ba9a 100644
--- a/src/engine/SCons/Variables/EnumVariable.py
+++ b/src/engine/SCons/Variables/EnumVariable.py
@@ -52,7 +52,7 @@ def _validator(key, val, env, vals):
def EnumVariable(key, help, default, allowed_values, map={}, ignorecase=0):
"""
- The input parameters describe a option with only certain values
+ The input parameters describe an option with only certain values
allowed. They are returned with an appropriate converter and
validator appended. The result is usable for input to
Variables.Add().
@@ -65,7 +65,7 @@ def EnumVariable(key, help, default, allowed_values, map={}, ignorecase=0):
for this option.
The 'map'-dictionary may be used for converting the input value
- into canonical values (eg. for aliases).
+ into canonical values (e.g. for aliases).
'ignorecase' defines the behaviour of the validator:
diff --git a/src/engine/SCons/Variables/ListVariable.py b/src/engine/SCons/Variables/ListVariable.py
index 413aacb3..f2fdc18f 100644
--- a/src/engine/SCons/Variables/ListVariable.py
+++ b/src/engine/SCons/Variables/ListVariable.py
@@ -4,7 +4,7 @@ This file defines the option type for SCons implementing 'lists'.
A 'list' option may either be 'all', 'none' or a list of names
separated by comma. After the option has been processed, the option
-value holds either the named list elements, all list elemens or no
+value holds either the named list elements, all list elements or no
list elements at all.
Usage example:
@@ -48,7 +48,7 @@ Usage example:
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-# Know Bug: This should behave like a Set-Type, but does not really,
+# Known Bug: This should behave like a Set-Type, but does not really,
# since elements can occur twice.
__all__ = ['ListVariable',]
@@ -106,14 +106,14 @@ def _converter(val, allowedElems, mapdict):
## def _validator(key, val, env):
## """
## """
-## # todo: write validater for pgk list
+## # todo: write validator for pgk list
## return 1
def ListVariable(key, help, default, names, map={}):
"""
The input parameters describe a 'package list' option, thus they
- are returned with the correct converter and validater appended. The
+ are returned with the correct converter and validator appended. The
result is usable for input to opts.Add() .
A 'package list' option may either be 'all', 'none' or a list of
diff --git a/src/engine/SCons/Variables/PackageVariable.py b/src/engine/SCons/Variables/PackageVariable.py
index 440d0f65..4ab08567 100644
--- a/src/engine/SCons/Variables/PackageVariable.py
+++ b/src/engine/SCons/Variables/PackageVariable.py
@@ -11,7 +11,7 @@ Usage example:
Examples:
x11=no (disables X11 support)
x11=yes (will search for the package installation dir)
- x11=/usr/local/X11 (will check this path for existance)
+ x11=/usr/local/X11 (will check this path for existence)
To replace autoconf's --with-xxx=yyy
@@ -70,10 +70,10 @@ def _converter(val):
def _validator(key, val, env, searchfunc):
- # NB: searchfunc is currenty undocumented and unsupported
+ # NB: searchfunc is currently undocumented and unsupported
"""
"""
- # todo: write validator, check for path
+ # TODO write validator, check for path
import os
if env[key] is True:
if searchfunc:
@@ -84,14 +84,14 @@ def _validator(key, val, env, searchfunc):
def PackageVariable(key, help, default, searchfunc=None):
- # NB: searchfunc is currenty undocumented and unsupported
+ # NB: searchfunc is currently undocumented and unsupported
"""
The input parameters describe a 'package list' option, thus they
are returned with the correct converter and validator appended. The
result is usable for input to opts.Add() .
A 'package list' option may either be 'all', 'none' or a list of
- package names (seperated by space).
+ package names (separated by space).
"""
help = '\n '.join(
(help, '( yes | no | /path/to/%s )' % key))
diff --git a/src/engine/SCons/Variables/PathVariable.py b/src/engine/SCons/Variables/PathVariable.py
index 951fc753..e615a531 100644
--- a/src/engine/SCons/Variables/PathVariable.py
+++ b/src/engine/SCons/Variables/PathVariable.py
@@ -2,7 +2,7 @@
This file defines an option type for SCons implementing path settings.
-To be used whenever a a user-specified path override should be allowed.
+To be used whenever a user-specified path override should be allowed.
Arguments to PathVariable are:
option-name = name of this option on the command line (e.g. "prefix")
@@ -22,7 +22,7 @@ Arguments to PathVariable are:
is valid. The arguments to the validator function
are: (key, val, env). The key is the name of the
option, the val is the path specified for the option,
- and the env is the env to which the Otions have been
+ and the env is the env to which the Options have been
added.
Usage example:
@@ -102,7 +102,7 @@ class _PathVariableClass(object):
os.makedirs(val)
def PathIsFile(self, key, val, env):
- """validator to check if Path is a file"""
+ """Validator to check if Path is a file"""
if not os.path.isfile(val):
if os.path.isdir(val):
m = 'File path for option %s is a directory: %s'
@@ -111,13 +111,12 @@ class _PathVariableClass(object):
raise SCons.Errors.UserError(m % (key, val))
def PathExists(self, key, val, env):
- """validator to check if Path exists"""
+ """Validator to check if Path exists"""
if not os.path.exists(val):
m = 'Path for option %s does not exist: %s'
raise SCons.Errors.UserError(m % (key, val))
def __call__(self, key, help, default, validator=None):
- # NB: searchfunc is currenty undocumented and unsupported
"""
The input parameters describe a 'path list' option, thus they
are returned with the correct converter and validator appended. The
diff --git a/src/engine/SCons/Variables/__init__.py b/src/engine/SCons/Variables/__init__.py
index ede74803..10f9cb27 100644
--- a/src/engine/SCons/Variables/__init__.py
+++ b/src/engine/SCons/Variables/__init__.py
@@ -50,12 +50,17 @@ class Variables(object):
Holds all the options, updates the environment with the variables,
and renders the help text.
"""
- def __init__(self, files=[], args={}, is_global=1):
+ def __init__(self, files=None, args=None, is_global=1):
"""
files - [optional] List of option configuration files to load
(backward compatibility) If a single string is passed it is
automatically placed in a file list
"""
+ # initialize arguments
+ if files is None:
+ files = []
+ if args is None:
+ args = {}
self.options = []
self.args = args
if not SCons.Util.is_List(files):
diff --git a/src/engine/SCons/compat/__init__.py b/src/engine/SCons/compat/__init__.py
index 3d5c835e..5f94df22 100644
--- a/src/engine/SCons/compat/__init__.py
+++ b/src/engine/SCons/compat/__init__.py
@@ -35,9 +35,6 @@ the builtins namespace or the global module list so that the rest
of our code can use the objects and names imported here regardless of
Python version.
-Simply enough, things that go in the builtins name space come from
-our _scons_builtins module.
-
The rest of the things here will be in individual compatibility modules
that are either: 1) suitably modified copies of the future modules that
we want to use; or 2) backwards compatible re-implementations of the
@@ -85,34 +82,8 @@ def rename_module(new, old):
except ImportError:
return False
-
-rename_module('builtins', '__builtin__')
-import _scons_builtins
-
-
-try:
- import hashlib
-except ImportError:
- # Pre-2.5 Python has no hashlib module.
- try:
- import_as('_scons_hashlib', 'hashlib')
- except ImportError:
- # If we failed importing our compatibility module, it probably
- # means this version of Python has no md5 module. Don't do
- # anything and let the higher layer discover this fact, so it
- # can fall back to using timestamp.
- pass
-
-
-
-# When we're using the '-3' option during regression tests, importing
-# cPickle gives a warning no matter how it's done, so always use the
-# real profile module, whether it's fast or not.
-if os.environ.get('SCONS_HORRIBLE_REGRESSION_TEST_HACK') is None:
- # Not a regression test with '-3', so try to use faster version.
- # In 3.x, 'pickle' automatically loads the fast version if available.
- rename_module('pickle', 'cPickle')
-
+# In 3.x, 'pickle' automatically loads the fast version if available.
+rename_module('pickle', 'cPickle')
# In 3.x, 'profile' automatically loads the fast version if available.
rename_module('profile', 'cProfile')
@@ -134,9 +105,7 @@ try:
except AttributeError:
# We must be using python 2.7.x so monkey patch
# intern into the sys package
- import builtins
- sys.intern = builtins.intern
-
+ sys.intern = intern
# Preparing for 3.x. UserDict, UserList, UserString are in
@@ -163,25 +132,6 @@ except AttributeError:
collections.UserString = _UserString
del _UserString
-
-
-if os.environ.get('SCONS_HORRIBLE_REGRESSION_TEST_HACK') is not None:
- # We can't apply the 'callable' fixer until the floor is 2.6, but the
- # '-3' option to Python 2.6 and 2.7 generates almost ten thousand
- # warnings. This hack allows us to run regression tests with the '-3'
- # option by replacing the callable() built-in function with a hack
- # that performs the same function but doesn't generate the warning.
- # Note that this hack is ONLY intended to be used for regression
- # testing, and should NEVER be used for real runs.
- from types import ClassType
- def callable(obj):
- if hasattr(obj, '__call__'): return True
- if isinstance(obj, (ClassType, type)): return True
- return False
- import builtins
- builtins.callable = callable
- del callable
-
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/compat/_scons_builtins.py b/src/engine/SCons/compat/_scons_builtins.py
deleted file mode 100644
index 6218cd15..00000000
--- a/src/engine/SCons/compat/_scons_builtins.py
+++ /dev/null
@@ -1,107 +0,0 @@
-#
-# __COPYRIGHT__
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-# Portions of the following are derived from the compat.py file in
-# Twisted, under the following copyright:
-#
-# Copyright (c) 2001-2004 Twisted Matrix Laboratories
-
-__doc__ = """
-Compatibility idioms for builtins names
-
-This module adds names to the builtins module for things that we want
-to use in SCons but which don't show up until later Python versions than
-the earliest ones we support.
-
-This module checks for the following builtins names:
-
- all()
- any()
- memoryview()
-
-Implementations of functions are *NOT* guaranteed to be fully compliant
-with these functions in later versions of Python. We are only concerned
-with adding functionality that we actually use in SCons, so be wary
-if you lift this code for other uses. (That said, making these more
-nearly the same as later, official versions is still a desirable goal,
-we just don't need to be obsessive about it.)
-
-If you're looking at this with pydoc and various names don't show up in
-the FUNCTIONS or DATA output, that means those names are already built in
-to this version of Python and we don't need to add them from this module.
-"""
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-import builtins
-
-try:
- all
-except NameError:
- # Pre-2.5 Python has no all() function.
- def all(iterable):
- """
- Returns True if all elements of the iterable are true.
- """
- for element in iterable:
- if not element:
- return False
- return True
- builtins.all = all
- all = all
-
-try:
- any
-except NameError:
- # Pre-2.5 Python has no any() function.
- def any(iterable):
- """
- Returns True if any element of the iterable is true.
- """
- for element in iterable:
- if element:
- return True
- return False
- builtins.any = any
- any = any
-
-try:
- memoryview
-except NameError:
- # Pre-2.7 doesn't have the memoryview() built-in.
- class memoryview(object):
- def __init__(self, obj):
- # wrapping buffer in () keeps the fixer from changing it
- self.obj = (buffer)(obj)
- def __getitem__(self, indx):
- if isinstance(indx, slice):
- return self.obj[indx.start:indx.stop]
- else:
- return self.obj[indx]
- builtins.memoryview = memoryview
-
-# Local Variables:
-# tab-width:4
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/src/engine/SCons/compat/_scons_hashlib.py b/src/engine/SCons/compat/_scons_hashlib.py
deleted file mode 100644
index 04d31fa6..00000000
--- a/src/engine/SCons/compat/_scons_hashlib.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#
-# __COPYRIGHT__
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__doc__ = """
-hashlib backwards-compatibility module for older (pre-2.5) Python versions
-
-This does not not NOT (repeat, *NOT*) provide complete hashlib
-functionality. It only wraps the portions of MD5 functionality used
-by SCons, in an interface that looks like hashlib (or enough for our
-purposes, anyway). In fact, this module will raise an ImportError if
-the underlying md5 module isn't available.
-"""
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-import md5
-from string import hexdigits
-
-class md5obj(object):
-
- md5_module = md5
-
- def __init__(self, name, string=''):
- if not name in ('MD5', 'md5'):
- raise ValueError("unsupported hash type")
- self.name = 'md5'
- self.m = self.md5_module.md5()
-
- def __repr__(self):
- return '<%s HASH object @ %#x>' % (self.name, id(self))
-
- def copy(self):
- import copy
- result = copy.copy(self)
- result.m = self.m.copy()
- return result
-
- def digest(self):
- return self.m.digest()
-
- def update(self, arg):
- return self.m.update(arg)
-
- def hexdigest(self):
- return self.m.hexdigest()
-
-new = md5obj
-
-def md5(string=''):
- return md5obj('md5', string)
-
-# Local Variables:
-# tab-width:4
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/src/engine/SCons/cppTests.py b/src/engine/SCons/cppTests.py
index 37b4aae3..9f4b875d 100644
--- a/src/engine/SCons/cppTests.py
+++ b/src/engine/SCons/cppTests.py
@@ -668,15 +668,12 @@ class fileTestCase(unittest.TestCase):
_Cleanup.remove(self.tempdir)
def strip_initial_spaces(self, s):
- #lines = s.split('\n')
lines = s.split('\n')
spaces = re.match(' *', lines[0]).group(0)
def strip_spaces(l, spaces=spaces):
- #if l.startswith(spaces):
if l[:len(spaces)] == spaces:
l = l[len(spaces):]
return l
- #return '\n'.join([ strip_spaces(l) for l in lines ])
return '\n'.join(map(strip_spaces, lines))
def write(self, file, contents):
diff --git a/src/engine/SCons/dblite.py b/src/engine/SCons/dblite.py
index f4ba90a1..707a4f88 100644
--- a/src/engine/SCons/dblite.py
+++ b/src/engine/SCons/dblite.py
@@ -3,7 +3,6 @@
import SCons.compat
-import builtins
import os
# compat layer imports "cPickle" for us if it's available.
import pickle
@@ -44,7 +43,7 @@ class dblite(object):
# See the discussion at:
# http://mail.python.org/pipermail/python-bugs-list/2003-March/016877.html
- _open = builtins.open
+ _open = open
_pickle_dump = staticmethod(pickle.dump)
_os_chmod = os.chmod
try:
@@ -99,7 +98,10 @@ class dblite(object):
if (len(p) > 0):
try:
self._dict = pickle.loads(p)
- except (pickle.UnpicklingError, EOFError):
+ except (pickle.UnpicklingError, EOFError, KeyError):
+ # Note how we catch KeyErrors too here, which might happen
+ # when we don't have cPickle available (default pickle
+ # throws it).
if (ignore_corrupt_dbfiles == 0): raise
if (ignore_corrupt_dbfiles == 1):
corruption_warning(self._file_name)
diff --git a/src/script/scons-time.py b/src/script/scons-time.py
index 3b215f98..02168d87 100644
--- a/src/script/scons-time.py
+++ b/src/script/scons-time.py
@@ -43,53 +43,10 @@ import sys
import tempfile
import time
-try:
- sorted
-except NameError:
- # Pre-2.4 Python has no sorted() function.
- #
- # The pre-2.4 Python list.sort() method does not support
- # list.sort(key=) nor list.sort(reverse=) keyword arguments, so
- # we must implement the functionality of those keyword arguments
- # by hand instead of passing them to list.sort().
- def sorted(iterable, cmp=None, key=None, reverse=False):
- if key is not None:
- result = [(key(x), x) for x in iterable]
- else:
- result = iterable[:]
- if cmp is None:
- # Pre-2.3 Python does not support list.sort(None).
- result.sort()
- else:
- result.sort(cmp)
- if key is not None:
- result = [t1 for t0,t1 in result]
- if reverse:
- result.reverse()
- return result
-
-if os.environ.get('SCONS_HORRIBLE_REGRESSION_TEST_HACK') is not None:
- # We can't apply the 'callable' fixer until the floor is 2.6, but the
- # '-3' option to Python 2.6 and 2.7 generates almost ten thousand
- # warnings. This hack allows us to run regression tests with the '-3'
- # option by replacing the callable() built-in function with a hack
- # that performs the same function but doesn't generate the warning.
- # Note that this hack is ONLY intended to be used for regression
- # testing, and should NEVER be used for real runs.
- from types import ClassType
- def callable(obj):
- if hasattr(obj, '__call__'): return True
- if isinstance(obj, (ClassType, type)): return True
- return False
-
def make_temp_file(**kw):
try:
result = tempfile.mktemp(**kw)
- try:
- result = os.path.realpath(result)
- except AttributeError:
- # Python 2.1 has no os.path.realpath() method.
- pass
+ result = os.path.realpath(result)
except TypeError:
try:
save_template = tempfile.template
diff --git a/src/script/sconsign.py b/src/script/sconsign.py
index ef32a939..c95bf74d 100644
--- a/src/script/sconsign.py
+++ b/src/script/sconsign.py
@@ -54,6 +54,14 @@ import sys
# followed by generic) so we pick up the right version of the build
# engine modules if they're in either directory.
+
+if sys.version_info >= (3,0,0):
+ msg = "sconsign: *** Version %s does not run under Python version %s.\n\
+Python 3 is not yet supported.\n"
+ sys.stderr.write(msg % (__version__, sys.version.split()[0]))
+ sys.exit(1)
+
+
script_dir = sys.path[0]
if script_dir in sys.path:
@@ -64,6 +72,11 @@ libs = []
if "SCONS_LIB_DIR" in os.environ:
libs.append(os.environ["SCONS_LIB_DIR"])
+# - running from source takes priority (since 2.3.2), excluding SCONS_LIB_DIR settings
+script_path = os.path.abspath(os.path.dirname(__file__))
+source_path = os.path.join(script_path, '..', 'engine')
+libs.append(source_path)
+
local_version = 'scons-local-' + __version__
local = 'scons-local'
if script_dir:
@@ -463,12 +476,22 @@ for o, a in opts:
elif o in ('-e', '--entry'):
Print_Entries.append(a)
elif o in ('-f', '--format'):
+ # Try to map the given DB format to a known module
+ # name, that we can then try to import...
Module_Map = {'dblite' : 'SCons.dblite',
'sconsign' : None}
dbm_name = Module_Map.get(a, a)
if dbm_name:
try:
- dbm = my_import(dbm_name)
+ if dbm_name != "SCons.dblite":
+ dbm = my_import(dbm_name)
+ else:
+ import SCons.dblite
+ dbm = SCons.dblite
+ # Ensure that we don't ignore corrupt DB files,
+ # this was handled by calling my_import('SCons.dblite')
+ # again in earlier versions...
+ SCons.dblite.ignore_corrupt_dbfiles = 0
except:
sys.stderr.write("sconsign: illegal file format `%s'\n" % a)
print helpstr
@@ -500,7 +523,15 @@ else:
dbm_name = whichdb.whichdb(a)
if dbm_name:
Map_Module = {'SCons.dblite' : 'dblite'}
- dbm = my_import(dbm_name)
+ if dbm_name != "SCons.dblite":
+ dbm = my_import(dbm_name)
+ else:
+ import SCons.dblite
+ dbm = SCons.dblite
+ # Ensure that we don't ignore corrupt DB files,
+ # this was handled by calling my_import('SCons.dblite')
+ # again in earlier versions...
+ SCons.dblite.ignore_corrupt_dbfiles = 0
Do_SConsignDB(Map_Module.get(dbm_name, dbm_name), dbm)(a)
else:
Do_SConsignDir(a)
diff --git a/test/TEX/bibliography.py b/test/TEX/bibliography.py
index 5e26f6ef..c26b010c 100644
--- a/test/TEX/bibliography.py
+++ b/test/TEX/bibliography.py
@@ -118,9 +118,6 @@ test.must_not_exist(test.workpath('simple.blg'))
test.pass_test()
-
-# FUTURE:
-
test.write('SConstruct', """\
env = Environment(tools = ['tex', 'latex', 'dvips'])
env.PostScript('d00', 'd00.tex')
diff --git a/test/compat/all.py b/test/compat/all.py
deleted file mode 100644
index ac7a6ea2..00000000
--- a/test/compat/all.py
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/env python
-#
-# __COPYRIGHT__
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-"""
-Verify that we can use the any() function (in any supported Python
-version we happen to be testing).
-
-This test can be retired at some point in the distant future when Python
-2.5 becomes the minimum version supported by SCons.
-"""
-
-import TestSCons
-
-test = TestSCons.TestSCons()
-
-test.write('SConstruct', """\
-print all([True, 1]) and "YES" or "NO"
-print all([0]) and "YES" or "NO"
-SConscript('SConscript')
-""")
-
-test.write('SConscript', """\
-print all([1, False]) and "YES" or "NO"
-print all([True, None]) and "YES" or "NO"
-""")
-
-expect = """\
-YES
-NO
-NO
-NO
-"""
-
-test.run(arguments = '-Q -q', stdout = expect)
-
-test.pass_test()
-
-# Local Variables:
-# tab-width:4
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/compat/any.py b/test/compat/any.py
deleted file mode 100644
index 3c038073..00000000
--- a/test/compat/any.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env python
-#
-# __COPYRIGHT__
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-"""
-Verify that we can use the any() function (in any supported Python
-version we happen to be testing).
-
-This test can be retired at some point in the distant future when Python
-2.5 becomes the minimum version supported by SCons.
-"""
-
-import TestSCons
-
-test = TestSCons.TestSCons()
-
-test.write('SConstruct', """\
-print any([True, False]) and "YES" or "NO"
-print any([1]) and "YES" or "NO"
-SConscript('SConscript')
-""")
-
-test.write('SConscript', """\
-print any([0, False]) and "YES" or "NO"
-""")
-
-expect = """\
-YES
-YES
-NO
-"""
-
-test.run(arguments = '-Q -q', stdout = expect)
-
-test.pass_test()
-
-# Local Variables:
-# tab-width:4
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/option/profile.py b/test/option/profile.py
index d53c6900..4d6caae6 100644
--- a/test/option/profile.py
+++ b/test/option/profile.py
@@ -24,19 +24,14 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
-try:
- import io
- _StringIO = io.StringIO
-except (ImportError, AttributeError):
- # Pre-2.6 Python has no "io" module.
- exec('from cStringIO import StringIO')
-else:
- # TODO(2.6): In 2.6 and beyond, the io.StringIO.write() method
- # requires unicode strings. This subclass can probably be removed
- # when we drop support for Python 2.6.
- class StringIO(_StringIO):
- def write(self, s):
- _StringIO.write(self, unicode(s))
+import io
+_StringIO = io.StringIO
+# TODO(2.6): In 2.6 and beyond, the io.StringIO.write() method
+# requires unicode strings. This subclass can probably be removed
+# when we drop support for Python 2.6.
+class StringIO(_StringIO):
+ def write(self, s):
+ _StringIO.write(self, unicode(s))
import TestSCons
diff --git a/test/sconsign/script/bad.py b/test/sconsign/script/bad.py
index fc21577f..a3847486 100644
--- a/test/sconsign/script/bad.py
+++ b/test/sconsign/script/bad.py
@@ -47,16 +47,16 @@ test.run_sconsign(arguments = "-f dblite bad1.dblite",
stderr = "sconsign: \[Errno 2\] No such file or directory: 'bad1.dblite'\n")
test.run_sconsign(arguments = "-f dblite bad2",
- stderr = "sconsign: ignoring invalid `dblite' file `bad2'\n")
+ stderr = "sconsign: ignoring invalid `dblite' file `bad2'.*\n")
test.run_sconsign(arguments = "-f dblite bad2.dblite",
- stderr = "sconsign: ignoring invalid `dblite' file `bad2.dblite'\n")
+ stderr = "sconsign: ignoring invalid `dblite' file `bad2.dblite'.*\n")
test.run_sconsign(arguments = "-f sconsign no_sconsign",
stderr = "sconsign: \[Errno 2\] No such file or directory: 'no_sconsign'\n")
test.run_sconsign(arguments = "-f sconsign bad3",
- stderr = "sconsign: ignoring invalid .sconsign file `bad3'\n")
+ stderr = "sconsign: ignoring invalid .sconsign file `bad3'.*\n")
test.pass_test()
diff --git a/test/update-release-info/update-release-info.py b/test/update-release-info/update-release-info.py
index e44aa990..970bcce7 100644
--- a/test/update-release-info/update-release-info.py
+++ b/test/update-release-info/update-release-info.py
@@ -60,10 +60,10 @@ combo_strings = [
"""version_tuple = (2, 0, 0, 'bad', 0)
""",
# Index 1: Python version tuple
-"""unsupported_python_version = (2, 3)
+"""unsupported_python_version = (2, 6)
""",
# Index 2: Python version tuple
-"""deprecated_python_version = (2, 4)
+"""deprecated_python_version = (2, 7)
""",
# Index 3: alpha version tuple
"""version_tuple = (2, 0, 0, 'alpha', 0)
@@ -223,14 +223,14 @@ These files are a part of 33.22.11:
test.must_match(TestSCons, """
copyright_years = '%s'
default_version = '2.0.0.alpha.yyyymmdd'
-python_version_unsupported = (2, 3)
-python_version_deprecated = (2, 4)
+python_version_unsupported = (2, 6)
+python_version_deprecated = (2, 7)
"""%years, mode = 'r')
# should get Python floors from TestSCons module.
test.must_match(Main, """
-unsupported_python_version = (2, 3)
-deprecated_python_version = (2, 4)
+unsupported_python_version = (2, 6)
+deprecated_python_version = (2, 7)
""", mode = 'r')
#TODO: Release option