diff options
| author | Steven Knight <knight@baldmt.com> | 2003-02-10 07:33:07 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2003-02-10 07:33:07 (GMT) |
| commit | 6cc65ff3e32487eaa455776111d26a5bf07fb862 (patch) | |
| tree | 9f038e6874fc1823ac8a97b21f39820e700d9d10 /src | |
| parent | 54856ad6003f3e8aa5c3bf59ed1d92ab1598137a (diff) | |
| download | SCons-6cc65ff3e32487eaa455776111d26a5bf07fb862.zip SCons-6cc65ff3e32487eaa455776111d26a5bf07fb862.tar.gz SCons-6cc65ff3e32487eaa455776111d26a5bf07fb862.tar.bz2 | |
Support more intuitive build directory specifications as arguments to SConscript().
Diffstat (limited to 'src')
| -rw-r--r-- | src/CHANGES.txt | 3 | ||||
| -rw-r--r-- | src/engine/SCons/Script/SConscript.py | 22 |
2 files changed, 21 insertions, 4 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 14ec5e2..068dc3d 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -80,6 +80,9 @@ RELEASE 0.11 - XXX - Add support for allowing an embedding interface to annotate a node when it's created. + - Extend the SConscript() function to accept build_dir and duplicate + keyword arguments that function like a BuildDir() call. + From Steve Leblanc: - Fix the output of -c -n when directories are involved, so it diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py index a8aa732..c94ff2c 100644 --- a/src/engine/SCons/Script/SConscript.py +++ b/src/engine/SCons/Script/SConscript.py @@ -112,9 +112,9 @@ def Return(*vars): stack[-1].retval = tuple(retval) # This function is responsible for converting the parameters passed to -# SConscript() calls into a list of files and export variables. If -# the parameters are invalid, throws SCons.Errors.UserError. Returns a -# tuple (l, e) where l is a list of filenames and e is a list of +# SConscript() calls into a list of files and export variables. If the +# parameters are invalid, throws SCons.Errors.UserError. Returns a tuple +# (l, e) where l is a list of SConscript filenames and e is a list of # exports. def GetSConscriptFilenames(ls, kw): @@ -147,12 +147,26 @@ def GetSConscriptFilenames(ls, kw): exports = SCons.Util.argmunge(ls[1]) if kw.get('exports'): - exports.extend(SCons.Util.argmunge(kw.get('exports'))) + exports.extend(SCons.Util.argmunge(kw['exports'])) else: raise SCons.Errors.UserError, \ "Invalid SConscript() usage - too many arguments" + build_dir = kw.get('build_dir') + if build_dir: + if len(files) != 1: + raise SCons.Errors.UserError, \ + "Invalid SConscript() usage - can only specify one SConscript with a build_dir" + duplicate = kw.get('duplicate', 1) + src_dir = kw.get('src_dir') + if not src_dir: + src_dir, fname = os.path.split(str(files[0])) + else: + fname = os.path.split(files[0])[1] + BuildDir(build_dir, src_dir, duplicate) + files = [os.path.join(str(build_dir), fname)] + return (files, exports) def SConscript(*ls, **kw): |
