summaryrefslogtreecommitdiff
path: root/engine/SCons/Script
diff options
context:
space:
mode:
authorLuca Falavigna <dktrkranz@debian.org>2013-03-11 22:26:43 +0100
committerLuca Falavigna <dktrkranz@debian.org>2013-03-11 22:26:43 +0100
commitcc58c8587a4e67f389b00e5d3278fae049ac7399 (patch)
treee7c4f72161659579c954d252a381488bc34637fb /engine/SCons/Script
parentde88ed62712f996f44628e2e83af1026181175d8 (diff)
Imported Upstream version 2.3.0upstream/2.3.0
Diffstat (limited to 'engine/SCons/Script')
-rw-r--r--engine/SCons/Script/Interactive.py4
-rw-r--r--engine/SCons/Script/Main.py37
-rw-r--r--engine/SCons/Script/SConsOptions.py43
-rw-r--r--engine/SCons/Script/SConscript.py13
-rw-r--r--engine/SCons/Script/__init__.py4
5 files changed, 52 insertions, 49 deletions
diff --git a/engine/SCons/Script/Interactive.py b/engine/SCons/Script/Interactive.py
index e0822a7..b9a2e1e 100644
--- a/engine/SCons/Script/Interactive.py
+++ b/engine/SCons/Script/Interactive.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
+# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,7 +20,7 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-__revision__ = "src/engine/SCons/Script/Interactive.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
+__revision__ = "src/engine/SCons/Script/Interactive.py 2013/03/03 09:48:35 garyo"
__doc__ = """
SCons interactive mode
diff --git a/engine/SCons/Script/Main.py b/engine/SCons/Script/Main.py
index 12d1bc2..3f1b407 100644
--- a/engine/SCons/Script/Main.py
+++ b/engine/SCons/Script/Main.py
@@ -11,9 +11,9 @@ it goes here.
"""
unsupported_python_version = (2, 3, 0)
-deprecated_python_version = (2, 4, 0)
+deprecated_python_version = (2, 7, 0)
-# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
+# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -34,7 +34,7 @@ deprecated_python_version = (2, 4, 0)
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-__revision__ = "src/engine/SCons/Script/Main.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
+__revision__ = "src/engine/SCons/Script/Main.py 2013/03/03 09:48:35 garyo"
import SCons.compat
@@ -187,7 +187,7 @@ class BuildTask(SCons.Taskmaster.OutOfDateTask):
finish_time = time.time()
last_command_end = finish_time
cumulative_command_time = cumulative_command_time+finish_time-start_time
- sys.stdout.write("Command execution time: %f seconds\n"%(finish_time-start_time))
+ sys.stdout.write("Command execution time: %s: %f seconds\n"%(str(self.node), finish_time-start_time))
def do_failed(self, status=2):
_BuildFailures.append(self.exception[1])
@@ -203,7 +203,7 @@ class BuildTask(SCons.Taskmaster.OutOfDateTask):
SCons.Taskmaster.OutOfDateTask.fail_stop(self)
exit_status = status
this_build_status = status
-
+
def executed(self):
t = self.targets[0]
if self.top and not t.has_builder() and not t.side_effect:
@@ -248,7 +248,7 @@ class BuildTask(SCons.Taskmaster.OutOfDateTask):
except ValueError:
t, e = exc_info
tb = None
-
+
# Deprecated string exceptions will have their string stored
# in the first entry of the tuple.
if e is None:
@@ -266,9 +266,9 @@ class BuildTask(SCons.Taskmaster.OutOfDateTask):
errfmt = "scons: *** [%s] %s\n"
sys.stderr.write(errfmt % (nodename, buildError))
- if (buildError.exc_info[2] and buildError.exc_info[1] and
+ if (buildError.exc_info[2] and buildError.exc_info[1] and
not isinstance(
- buildError.exc_info[1],
+ buildError.exc_info[1],
(EnvironmentError, SCons.Errors.StopError,
SCons.Errors.UserError))):
type, value, trace = buildError.exc_info
@@ -546,7 +546,7 @@ def find_deepest_user_frame(tb):
Input is a "pre-processed" stack trace in the form
returned by traceback.extract_tb() or traceback.extract_stack()
"""
-
+
tb.reverse()
# find the deepest traceback frame that is not part
@@ -559,7 +559,7 @@ def find_deepest_user_frame(tb):
def _scons_user_error(e):
"""Handle user errors. Print out a message and a description of the
- error, along with the line number and routine where it occured.
+ error, along with the line number and routine where it occured.
The file and line number will be the deepest stack frame that is
not part of SCons itself.
"""
@@ -677,7 +677,7 @@ def _load_site_scons_dir(topdir, site_dir_name=None):
else:
site_dir_name = "site_scons"
err_if_not_found = False
-
+
site_dir = os.path.join(topdir, site_dir_name)
if not os.path.exists(site_dir):
if err_if_not_found:
@@ -934,7 +934,7 @@ def _main(parser):
_load_site_scons_dir(d.path, options.site_dir)
elif not options.no_site_dir:
_load_all_site_scons_dirs(d.path)
-
+
if options.include_dir:
sys.path = options.include_dir + sys.path
@@ -1009,10 +1009,11 @@ def _main(parser):
# warning about deprecated Python versions--delayed until here
# in case they disabled the warning in the SConscript files.
if python_version_deprecated():
- msg = "Support for pre-2.4 Python (%s) is deprecated.\n" + \
+ msg = "Support for pre-%s Python version (%s) is deprecated.\n" + \
" If this will cause hardship, contact dev@scons.tigris.org."
+ deprecated_version_string = ".".join(map(str, deprecated_python_version))
SCons.Warnings.warn(SCons.Warnings.PythonVersionWarning,
- msg % python_version_string())
+ msg % (deprecated_version_string, python_version_string()))
if not options.help:
SCons.SConf.CreateConfigHBuilder(SCons.Defaults.DefaultEnvironment())
@@ -1133,7 +1134,7 @@ def _build_targets(fs, options, targets, target_top):
# x doesn't have a cwd, so it's either not a target,
# or not a file, so go ahead and keep it as a default
# target and let the engine sort it out:
- return 1
+ return 1
d = list(filter(check_dir, SCons.Script.DEFAULT_TARGETS))
SCons.Script.DEFAULT_TARGETS[:] = d
target_top = None
@@ -1327,10 +1328,10 @@ def main():
except (ImportError, AttributeError):
# On Windows there is no scons.py, so there is no
# __main__.__version__, hence there is no script version.
- pass
+ pass
parts.append(version_string("engine", SCons))
parts.append(path_string("engine", SCons))
- parts.append("Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation")
+ parts.append("Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation")
version = ''.join(parts)
import SConsOptions
@@ -1338,7 +1339,7 @@ def main():
values = SConsOptions.SConsValues(parser.get_default_values())
OptionsParser = parser
-
+
try:
_exec_main(parser, values)
except SystemExit, s:
diff --git a/engine/SCons/Script/SConsOptions.py b/engine/SCons/Script/SConsOptions.py
index 1d574f8..6a6bae3 100644
--- a/engine/SCons/Script/SConsOptions.py
+++ b/engine/SCons/Script/SConsOptions.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
+# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Script/SConsOptions.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
+__revision__ = "src/engine/SCons/Script/SConsOptions.py 2013/03/03 09:48:35 garyo"
import optparse
import re
@@ -268,8 +268,9 @@ class SConsOptionParser(optparse.OptionParser):
preserve_unknown_options = False
def error(self, msg):
+ # overriden OptionValueError exception handler
self.print_usage(sys.stderr)
- sys.stderr.write("SCons error: %s\n" % msg)
+ sys.stderr.write("SCons Error: %s\n" % msg)
sys.exit(2)
def _process_long_opt(self, rargs, values):
@@ -568,11 +569,15 @@ def Parser(version):
action="store_true",
help="Print build actions for files from CacheDir.")
+ def opt_invalid(group, value, options):
+ errmsg = "`%s' is not a valid %s option type, try:\n" % (value, group)
+ return errmsg + " %s" % ", ".join(options)
+
config_options = ["auto", "force" ,"cache"]
def opt_config(option, opt, value, parser, c_options=config_options):
if not value in c_options:
- raise OptionValueError("Warning: %s is not a valid config type" % value)
+ raise OptionValueError(opt_invalid('config', value, c_options))
setattr(parser.values, option.dest, value)
opt_config_help = "Controls Configure subsystem: %s." \
% ", ".join(config_options)
@@ -599,24 +604,25 @@ def Parser(version):
debug_options = ["count", "duplicate", "explain", "findlibs",
"includes", "memoizer", "memory", "objects",
"pdb", "prepare", "presub", "stacktrace",
- "time"] + list(deprecated_debug_options.keys())
+ "time"]
def opt_debug(option, opt, value, parser,
debug_options=debug_options,
deprecated_debug_options=deprecated_debug_options):
if value in debug_options:
parser.values.debug.append(value)
- if value in deprecated_debug_options.keys():
- try:
- parser.values.delayed_warnings
- except AttributeError:
- parser.values.delayed_warnings = []
- msg = deprecated_debug_options[value]
- w = "The --debug=%s option is deprecated%s." % (value, msg)
- t = (SCons.Warnings.DeprecatedDebugOptionsWarning, w)
- parser.values.delayed_warnings.append(t)
+ elif value in deprecated_debug_options.keys():
+ parser.values.debug.append(value)
+ try:
+ parser.values.delayed_warnings
+ except AttributeError:
+ parser.values.delayed_warnings = []
+ msg = deprecated_debug_options[value]
+ w = "The --debug=%s option is deprecated%s." % (value, msg)
+ t = (SCons.Warnings.DeprecatedDebugOptionsWarning, w)
+ parser.values.delayed_warnings.append(t)
else:
- raise OptionValueError("Warning: %s is not a valid debug type" % value)
+ raise OptionValueError(opt_invalid('debug', value, debug_options))
opt_debug_help = "Print various types of debugging information: %s." \
% ", ".join(debug_options)
op.add_option('--debug',
@@ -630,7 +636,7 @@ def Parser(version):
try:
diskcheck_value = diskcheck_convert(value)
except ValueError, e:
- raise OptionValueError("Warning: `%s' is not a valid diskcheck type" % e)
+ raise OptionValueError("`%s' is not a valid diskcheck type" % e)
setattr(parser.values, option.dest, diskcheck_value)
op.add_option('--diskcheck',
@@ -642,7 +648,8 @@ def Parser(version):
def opt_duplicate(option, opt, value, parser):
if not value in SCons.Node.FS.Valid_Duplicates:
- raise OptionValueError("`%s' is not a valid duplication style." % value)
+ raise OptionValueError(opt_invalid('duplication', value,
+ SCons.Node.FS.Valid_Duplicates))
setattr(parser.values, option.dest, value)
# Set the duplicate style right away so it can affect linking
# of SConscript files.
@@ -807,7 +814,7 @@ def Parser(version):
elif o == 'status':
tp.status = True
else:
- raise OptionValueError("Warning: %s is not a valid --tree option" % o)
+ raise OptionValueError(opt_invalid('--tree', o, tree_options))
parser.values.tree_printers.append(tp)
opt_tree_help = "Print a dependency tree in various formats: %s." \
diff --git a/engine/SCons/Script/SConscript.py b/engine/SCons/Script/SConscript.py
index 18a9e31..59039ea 100644
--- a/engine/SCons/Script/SConscript.py
+++ b/engine/SCons/Script/SConscript.py
@@ -6,7 +6,7 @@ files.
"""
#
-# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
+# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -28,7 +28,7 @@ files.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
from __future__ import division
-__revision__ = "src/engine/SCons/Script/SConscript.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
+__revision__ = "src/engine/SCons/Script/SConscript.py 2013/03/03 09:48:35 garyo"
import SCons
import SCons.Action
@@ -473,13 +473,8 @@ class SConsEnvironment(SCons.Environment.Base):
def EnsurePythonVersion(self, major, minor):
"""Exit abnormally if the Python version is not late enough."""
- try:
- v_major, v_minor, v_micro, release, serial = sys.version_info
- python_ver = (v_major, v_minor)
- except AttributeError:
- python_ver = self._get_major_minor_revision(sys.version)[:2]
- if python_ver < (major, minor):
- v = sys.version.split(" ", 1)[0]
+ if sys.version_info < (major, minor):
+ v = sys.version.split()[0]
print "Python %d.%d or greater required, but you have Python %s" %(major,minor,v)
sys.exit(2)
diff --git a/engine/SCons/Script/__init__.py b/engine/SCons/Script/__init__.py
index c0a031a..5b3eac8 100644
--- a/engine/SCons/Script/__init__.py
+++ b/engine/SCons/Script/__init__.py
@@ -12,7 +12,7 @@ it goes here.
"""
#
-# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
+# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -34,7 +34,7 @@ it goes here.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Script/__init__.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
+__revision__ = "src/engine/SCons/Script/__init__.py 2013/03/03 09:48:35 garyo"
import time
start_time = time.time()