summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Script
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-04-11 22:03:57 (GMT)
committerSteven Knight <knight@baldmt.com>2002-04-11 22:03:57 (GMT)
commit05029e336146444501a66b53e4699c09d6e08977 (patch)
tree327cb62ba1629cca1184fcec4f78cf416c9d7ad7 /src/engine/SCons/Script
parent651aa3558b6192f7eb3f77c8f2102c1e0e824707 (diff)
downloadSCons-05029e336146444501a66b53e4699c09d6e08977.zip
SCons-05029e336146444501a66b53e4699c09d6e08977.tar.gz
SCons-05029e336146444501a66b53e4699c09d6e08977.tar.bz2
Change the meaning of -U, and made -D work like -U used to. (Anthony Roach)
Diffstat (limited to 'src/engine/SCons/Script')
-rw-r--r--src/engine/SCons/Script/__init__.py27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py
index 813c363..09b85be 100644
--- a/src/engine/SCons/Script/__init__.py
+++ b/src/engine/SCons/Script/__init__.py
@@ -399,6 +399,14 @@ def options_init():
short = 'd',
help = "Print file dependency information.")
+ def opt_D(opt, arg):
+ global climb_up
+ climb_up = 2
+
+ Option(func = opt_D,
+ short = 'D',
+ help = "Search up directory tree for SConstruct.")
+
def opt_debug(opt, arg):
global print_tree
global print_dtree
@@ -596,11 +604,11 @@ def options_init():
def opt_U(opt, arg):
global climb_up
- climb_up = 2
+ climb_up = 3
Option(func = opt_U,
- short = 'U',
- help = "Search up directory tree for SConstruct.")
+ short = 'U',
+ help = "Search up directory tree for SConstruct.")
def option_v(opt, arg):
import SCons
@@ -722,7 +730,7 @@ def _main():
SCons.Script.SConscript._scons_add_args(xmit_args)
if climb_up:
- target_top = '' # directory to prepend to targets
+ target_top = '.' # directory to prepend to targets
script_dir = os.getcwd() # location of script
while script_dir and not _SConstruct_exists(script_dir):
script_dir, last_part = os.path.split(script_dir)
@@ -782,11 +790,18 @@ def _main():
sys.exit(0)
if target_top:
+ target_top = SCons.Node.FS.default_fs.Dir(target_top)
+
if climb_up == 2 and not targets:
+ # -D with default targets
+ target_top = None
+ elif climb_up == 3 and not targets:
# -U with default targets
+ default_targets = SCons.Script.SConscript.default_targets
+ default_targets = filter(lambda x: x.cwd.srcpath == str(target_top),
+ default_targets)
+ SCons.Script.SConscript.default_targets = default_targets
target_top = None
- else:
- target_top = SCons.Node.FS.default_fs.Dir(target_top)
if not targets:
targets = SCons.Script.SConscript.default_targets