diff options
author | Steven Knight <knight@baldmt.com> | 2005-08-17 03:40:34 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-08-17 03:40:34 (GMT) |
commit | c5eb97dd2c58dc4b93bbe6682631d57febdd96bc (patch) | |
tree | b3d4066c6b17cde2ae0c5a45d9f45f2c5eca2d67 /src/engine | |
parent | 2c8bdd2a8cfa630e66e5b66fce0d24a3fe796c14 (diff) | |
download | SCons-c5eb97dd2c58dc4b93bbe6682631d57febdd96bc.zip SCons-c5eb97dd2c58dc4b93bbe6682631d57febdd96bc.tar.gz SCons-c5eb97dd2c58dc4b93bbe6682631d57febdd96bc.tar.bz2 |
Fix the -U behavior (broken when we made BUILD_TARGETS modifiable).
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/SCons/Script/Main.py | 9 | ||||
-rw-r--r-- | src/engine/SCons/Script/__init__.py | 17 |
2 files changed, 22 insertions, 4 deletions
diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index 8156208..e5a8cb2 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -1080,10 +1080,11 @@ def _main(args, parser): fs.set_max_drift(ssoptions.get('max_drift')) lookup_top = None - if SCons.Script.BUILD_TARGETS: - # They specified targets on the command line, so if they - # used -u, -U or -D, we have to look up targets relative - # to the top, but we build whatever they specified. + if targets or SCons.Script.BUILD_TARGETS != SCons.Script._build_plus_default: + # They specified targets on the command line or modified + # BUILD_TARGETS in the SConscript file(s), so if they used -u, + # -U or -D, we have to look up targets relative to the top, + # but we build whatever they specified. if target_top: lookup_top = fs.Dir(target_top) target_top = None diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index 734ce3f..f8f46f7 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -175,6 +175,17 @@ BUILD_TARGETS = TargetList() COMMAND_LINE_TARGETS = [] DEFAULT_TARGETS = [] +# BUILD_TARGETS can be modified in the SConscript files. If so, we +# want to treat the modified BUILD_TARGETS list as if they specified +# targets on the command line. To do that, though, we need to know if +# BUILD_TARGETS was modified through "official" APIs or by hand. We do +# this by updating two lists in parallel, the documented BUILD_TARGETS +# list, above, and this internal _build_plus_default targets list which +# should only have "official" API changes. Then Script/Main.py can +# compare these two afterwards to figure out if the user added their +# own targets to BUILD_TARGETS. +_build_plus_default = TargetList() + def _Add_Arguments(alist): for arg in alist: a, b = string.split(arg, '=', 1) @@ -187,6 +198,9 @@ def _Add_Targets(tlist): BUILD_TARGETS.extend(tlist) BUILD_TARGETS._add_Default = BUILD_TARGETS._do_nothing BUILD_TARGETS._clear = BUILD_TARGETS._do_nothing + _build_plus_default.extend(tlist) + _build_plus_default._add_Default = _build_plus_default._do_nothing + _build_plus_default._clear = _build_plus_default._do_nothing def _Set_Default_Targets_Has_Been_Called(d, fs): return DEFAULT_TARGETS @@ -209,13 +223,16 @@ def _Set_Default_Targets(env, tlist): # variables will still point to the same object we point to. del DEFAULT_TARGETS[:] BUILD_TARGETS._clear() + _build_plus_default._clear() elif isinstance(t, SCons.Node.Node): DEFAULT_TARGETS.append(t) BUILD_TARGETS._add_Default([t]) + _build_plus_default._add_Default([t]) else: nodes = env.arg2nodes(t, env.fs.Entry) DEFAULT_TARGETS.extend(nodes) BUILD_TARGETS._add_Default(nodes) + _build_plus_default._add_Default(nodes) # help_text = None |