diff options
author | Tom Tanner <ttanner2@bloomberg.net> | 2013-10-30 12:28:54 (GMT) |
---|---|---|
committer | Tom Tanner <ttanner2@bloomberg.net> | 2013-10-30 12:28:54 (GMT) |
commit | 00fb8edde480ac0ca6c935ccb95bbc43ea9525e7 (patch) | |
tree | df017ece67b86c8a55a94959a39a818a6d7eb0fa /src | |
parent | ae5053ffaf485d77c9ee37873169e3dd6be7b579 (diff) | |
parent | e38f59cab5d40f09f15c5e65645aa2d8af165c66 (diff) | |
download | SCons-00fb8edde480ac0ca6c935ccb95bbc43ea9525e7.zip SCons-00fb8edde480ac0ca6c935ccb95bbc43ea9525e7.tar.gz SCons-00fb8edde480ac0ca6c935ccb95bbc43ea9525e7.tar.bz2 |
Merged scons/scons into default
Diffstat (limited to 'src')
-rw-r--r-- | src/CHANGES.txt | 3 | ||||
-rw-r--r-- | src/engine/SCons/Action.py | 14 | ||||
-rw-r--r-- | src/engine/SCons/Builder.py | 7 | ||||
-rw-r--r-- | src/engine/SCons/Debug.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Environment.py | 9 | ||||
-rw-r--r-- | src/engine/SCons/Executor.py | 5 | ||||
-rw-r--r-- | src/engine/SCons/Node/FS.py | 11 | ||||
-rw-r--r-- | src/engine/SCons/Node/__init__.py | 3 | ||||
-rw-r--r-- | src/engine/SCons/Script/Main.py | 5 | ||||
-rw-r--r-- | src/engine/SCons/Tool/__init__.py | 8 | ||||
-rw-r--r-- | src/engine/SCons/Tool/zip.xml | 2 |
11 files changed, 47 insertions, 24 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 50a27dc..5bfc0c5 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -30,6 +30,8 @@ RELEASE 2.3.1.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE From Dirk Baechle: - Update bootstrap.py so it can be used from any dir, to run SCons from a source (non-installed) dir. + - Count statistics of instances are now collected only when + the --debug=count command-line option is used (#2922). From Gary Oberbrunner: - Test harness: fail_test() can now print a message to help debugging. @@ -5710,5 +5712,6 @@ A brief overview of important functionality available in release 0.01: - Windows installer available. + __COPYRIGHT__ __FILE__ __REVISION__ __DATE__ __DEVELOPER__ diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index c1eef75..a6dbb7c 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -109,6 +109,7 @@ import re import sys import subprocess +import SCons.Debug from SCons.Debug import logInstanceCreation import SCons.Errors import SCons.Executor @@ -439,7 +440,8 @@ class ActionBase(object): vl = self.get_varlist(target, source, env) if is_String(vl): vl = (vl,) for v in vl: - result.append(env.subst('${'+v+'}')) + # do the subst this way to ignore $(...$) parts: + result.append(env.subst_target_source('${'+v+'}', SCons.Subst.SUBST_SIG, target, source)) return ''.join(result) def __add__(self, other): @@ -698,7 +700,7 @@ class CommandAction(_ActionAction): # factory above does). cmd will be passed to # Environment.subst_list() for substituting environment # variables. - if __debug__: logInstanceCreation(self, 'Action.CommandAction') + if SCons.Debug.track_instances: logInstanceCreation(self, 'Action.CommandAction') _ActionAction.__init__(self, **kw) if is_List(cmd): @@ -855,7 +857,7 @@ class CommandAction(_ActionAction): class CommandGeneratorAction(ActionBase): """Class for command-generator actions.""" def __init__(self, generator, kw): - if __debug__: logInstanceCreation(self, 'Action.CommandGeneratorAction') + if SCons.Debug.track_instances: logInstanceCreation(self, 'Action.CommandGeneratorAction') self.generator = generator self.gen_kw = kw self.varlist = kw.get('varlist', ()) @@ -944,7 +946,7 @@ class CommandGeneratorAction(ActionBase): class LazyAction(CommandGeneratorAction, CommandAction): def __init__(self, var, kw): - if __debug__: logInstanceCreation(self, 'Action.LazyAction') + 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) @@ -986,7 +988,7 @@ class FunctionAction(_ActionAction): """Class for Python function actions.""" def __init__(self, execfunction, kw): - if __debug__: logInstanceCreation(self, 'Action.FunctionAction') + if SCons.Debug.track_instances: logInstanceCreation(self, 'Action.FunctionAction') self.execfunction = execfunction try: @@ -1108,7 +1110,7 @@ class FunctionAction(_ActionAction): class ListAction(ActionBase): """Class for lists of other actions.""" def __init__(self, actionlist): - if __debug__: logInstanceCreation(self, 'Action.ListAction') + if SCons.Debug.track_instances: logInstanceCreation(self, 'Action.ListAction') def list_of_actions(x): if isinstance(x, ActionBase): return x diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py index 6dc9e17..ed7650a 100644 --- a/src/engine/SCons/Builder.py +++ b/src/engine/SCons/Builder.py @@ -102,6 +102,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import collections import SCons.Action +import SCons.Debug from SCons.Debug import logInstanceCreation from SCons.Errors import InternalError, UserError import SCons.Executor @@ -225,7 +226,7 @@ class OverrideWarner(collections.UserDict): """ def __init__(self, dict): collections.UserDict.__init__(self, dict) - if __debug__: logInstanceCreation(self, 'Builder.OverrideWarner') + if SCons.Debug.track_instances: logInstanceCreation(self, 'Builder.OverrideWarner') self.already_warned = None def warn(self): if self.already_warned: @@ -376,7 +377,7 @@ class BuilderBase(object): src_builder = None, ensure_suffix = False, **overrides): - if __debug__: logInstanceCreation(self, 'Builder.BuilderBase') + if SCons.Debug.track_instances: logInstanceCreation(self, 'Builder.BuilderBase') self._memo = {} self.action = action self.multi = multi @@ -847,7 +848,7 @@ class CompositeBuilder(SCons.Util.Proxy): """ def __init__(self, builder, cmdgen): - if __debug__: logInstanceCreation(self, 'Builder.CompositeBuilder') + if SCons.Debug.track_instances: logInstanceCreation(self, 'Builder.CompositeBuilder') SCons.Util.Proxy.__init__(self, builder) # cmdgen should always be an instance of DictCmdGenerator. diff --git a/src/engine/SCons/Debug.py b/src/engine/SCons/Debug.py index 1c0c638..9974039 100644 --- a/src/engine/SCons/Debug.py +++ b/src/engine/SCons/Debug.py @@ -35,6 +35,10 @@ import sys import time import weakref +# Global variable that gets set to 'True' by the Main script, +# when the creation of class instances should get tracked. +track_instances = False +# List of currently tracked classes tracked_classes = {} def logInstanceCreation(instance, name=None): diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 55a8206..ca5df58 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -43,6 +43,7 @@ from collections import UserDict import SCons.Action import SCons.Builder +import SCons.Debug from SCons.Debug import logInstanceCreation import SCons.Defaults import SCons.Errors @@ -370,7 +371,7 @@ class SubstitutionEnvironment(object): def __init__(self, **kw): """Initialization of an underlying SubstitutionEnvironment class. """ - if __debug__: logInstanceCreation(self, 'Environment.SubstitutionEnvironment') + if SCons.Debug.track_instances: logInstanceCreation(self, 'Environment.SubstitutionEnvironment') self.fs = SCons.Node.FS.get_default_fs() self.ans = SCons.Node.Alias.default_ans self.lookup_list = SCons.Node.arg2nodes_lookups @@ -931,7 +932,7 @@ class Base(SubstitutionEnvironment): initialize things in a very specific order that doesn't work with the much simpler base class initialization. """ - if __debug__: logInstanceCreation(self, 'Environment.Base') + if SCons.Debug.track_instances: logInstanceCreation(self, 'Environment.Base') self._memo = {} self.fs = SCons.Node.FS.get_default_fs() self.ans = SCons.Node.Alias.default_ans @@ -1414,7 +1415,7 @@ class Base(SubstitutionEnvironment): # Finally, apply any flags to be merged in if parse_flags: clone.MergeFlags(parse_flags) - if __debug__: logInstanceCreation(self, 'Environment.EnvironmentClone') + if SCons.Debug.track_instances: logInstanceCreation(self, 'Environment.EnvironmentClone') return clone def Copy(self, *args, **kw): @@ -2270,7 +2271,7 @@ class OverrideEnvironment(Base): """ def __init__(self, subject, overrides={}): - if __debug__: logInstanceCreation(self, 'Environment.OverrideEnvironment') + if SCons.Debug.track_instances: logInstanceCreation(self, 'Environment.OverrideEnvironment') self.__dict__['__subject'] = subject self.__dict__['overrides'] = overrides diff --git a/src/engine/SCons/Executor.py b/src/engine/SCons/Executor.py index 6f2489b..7875537 100644 --- a/src/engine/SCons/Executor.py +++ b/src/engine/SCons/Executor.py @@ -31,6 +31,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import collections +import SCons.Debug from SCons.Debug import logInstanceCreation import SCons.Errors import SCons.Memoize @@ -123,7 +124,7 @@ class Executor(object): def __init__(self, action, env=None, overridelist=[{}], targets=[], sources=[], builder_kw={}): - if __debug__: logInstanceCreation(self, 'Executor.Executor') + if SCons.Debug.track_instances: logInstanceCreation(self, 'Executor.Executor') self.set_action_list(action) self.pre_actions = [] self.post_actions = [] @@ -575,7 +576,7 @@ class Null(object): going to worry about unit tests for this--at least for now. """ def __init__(self, *args, **kw): - if __debug__: logInstanceCreation(self, 'Executor.Null') + if SCons.Debug.track_instances: logInstanceCreation(self, 'Executor.Null') self.batches = [Batch(kw['targets'][:], [])] def get_build_env(self): return get_NullEnvironment() diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 4381697..18400e8 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -44,6 +44,7 @@ import time import codecs import SCons.Action +import SCons.Debug from SCons.Debug import logInstanceCreation import SCons.Errors import SCons.Memoize @@ -581,7 +582,7 @@ class Base(SCons.Node.Node): our relative and absolute paths, identify our parent directory, and indicate that this node should use signatures.""" - if __debug__: logInstanceCreation(self, 'Node.FS.Base') + if SCons.Debug.track_instances: logInstanceCreation(self, 'Node.FS.Base') SCons.Node.Node.__init__(self) # Filenames and paths are probably reused and are intern'ed to @@ -1111,7 +1112,7 @@ class FS(LocalFS): The path argument must be a valid absolute path. """ - if __debug__: logInstanceCreation(self, 'Node.FS') + if SCons.Debug.track_instances: logInstanceCreation(self, 'Node.FS') self._memo = {} @@ -1445,7 +1446,7 @@ class Dir(Base): BuildInfo = DirBuildInfo def __init__(self, name, directory, fs): - if __debug__: logInstanceCreation(self, 'Node.FS.Dir') + if SCons.Debug.track_instances: logInstanceCreation(self, 'Node.FS.Dir') Base.__init__(self, name, directory, fs) self._morph() @@ -2113,7 +2114,7 @@ class RootDir(Dir): this directory. """ def __init__(self, drive, fs): - if __debug__: logInstanceCreation(self, 'Node.FS.RootDir') + if SCons.Debug.track_instances: logInstanceCreation(self, 'Node.FS.RootDir') # We're going to be our own parent directory (".." entry and .dir # attribute) so we have to set up some values so Base.__init__() # won't gag won't it calls some of our methods. @@ -2361,7 +2362,7 @@ class File(Base): "Directory %s found where file expected.") def __init__(self, name, directory, fs): - if __debug__: logInstanceCreation(self, 'Node.FS.File') + if SCons.Debug.track_instances: logInstanceCreation(self, 'Node.FS.File') Base.__init__(self, name, directory, fs) self._morph() diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py index 992284d..c114281 100644 --- a/src/engine/SCons/Node/__init__.py +++ b/src/engine/SCons/Node/__init__.py @@ -47,6 +47,7 @@ import collections import copy from itertools import chain +import SCons.Debug from SCons.Debug import logInstanceCreation import SCons.Executor import SCons.Memoize @@ -183,7 +184,7 @@ class Node(object): pass def __init__(self): - if __debug__: logInstanceCreation(self, 'Node.Node') + if SCons.Debug.track_instances: logInstanceCreation(self, 'Node.Node') # Note that we no longer explicitly initialize a self.builder # attribute to None here. That's because the self.builder # attribute may be created on-the-fly later by a subclass (the diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index 837c103..9083b8e 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -622,7 +622,7 @@ def _set_debug_values(options): debug_values = options.debug if "count" in debug_values: - # All of the object counts are within "if __debug__:" blocks, + # All of the object counts are within "if track_instances:" blocks, # which get stripped when running optimized (with python -O or # from compiled *.pyo files). Provide a warning if __debug__ is # stripped, so it doesn't just look like --debug=count is broken. @@ -630,6 +630,7 @@ def _set_debug_values(options): if __debug__: enable_count = True if enable_count: count_stats.enable(sys.stdout) + SCons.Debug.track_instances = True else: msg = "--debug=count is not supported when running SCons\n" + \ "\twith the python -O option or optimized (.pyo) modules." @@ -644,6 +645,8 @@ def _set_debug_values(options): if "memory" in debug_values: memory_stats.enable(sys.stdout) print_objects = ("objects" in debug_values) + if print_objects: + SCons.Debug.track_instances = True if "presub" in debug_values: SCons.Action.print_actions_presub = 1 if "stacktrace" in debug_values: diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py index 7477f75..c09f8e4 100644 --- a/src/engine/SCons/Tool/__init__.py +++ b/src/engine/SCons/Tool/__init__.py @@ -364,8 +364,12 @@ symlinks for the platform we are on""" print "VerShLib: made sym link of %s -> %s" % (linkname, lib_ver) return result -# Fix http://scons.tigris.org/issues/show_bug.cgi?id=2903 : -# varlist=['$SHLINKCOM']: ensure we still depend on SCons.Defaults.ShLinkAction command line which is $SHLINKCOM +# Fix http://scons.tigris.org/issues/show_bug.cgi?id=2903 : +# Ensure we still depend on SCons.Defaults.ShLinkAction command line which is $SHLINKCOM. +# This was tricky because we don't want changing LIBPATH to cause a rebuild, but +# changing other link args should. LIBPATH has $( ... $) around it but until this +# fix, when the varlist was added to the build sig those ignored parts weren't getting +# ignored. ShLibAction = SCons.Action.Action(VersionedSharedLibrary, None, varlist=['SHLINKCOM']) def createSharedLibBuilder(env): diff --git a/src/engine/SCons/Tool/zip.xml b/src/engine/SCons/Tool/zip.xml index af68533..f43aa31 100644 --- a/src/engine/SCons/Tool/zip.xml +++ b/src/engine/SCons/Tool/zip.xml @@ -145,11 +145,13 @@ The suffix used for zip file names. <cvar name="ZIPROOT"> <summary> +<para> An optional zip root directory (default empty). The filenames stored in the zip file will be relative to this directory, if given. Otherwise the filenames are relative to the current directory of the command. For instance: +</para> <example_commands> env = Environment() env.Zip('foo.zip', 'subdir1/subdir2/file1', ZIPROOT='subdir1') |