diff options
author | Steven Knight <knight@baldmt.com> | 2005-03-18 22:40:53 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-03-18 22:40:53 (GMT) |
commit | 12158becc0aaee3b5b486a00bdd304f331ab4b24 (patch) | |
tree | d5aec630f03ce93b28cf05459b8b12fc887d3ef4 /src | |
parent | 83bbec701a00f41f42705d0348786dc3cbab477b (diff) | |
download | SCons-12158becc0aaee3b5b486a00bdd304f331ab4b24.zip SCons-12158becc0aaee3b5b486a00bdd304f331ab4b24.tar.gz SCons-12158becc0aaee3b5b486a00bdd304f331ab4b24.tar.bz2 |
Refactor Main.py's Alias lookup to allow customized Alias (sub-)classes. (Stanislav Baranov)
Diffstat (limited to 'src')
-rw-r--r-- | src/CHANGES.txt | 4 | ||||
-rw-r--r-- | src/engine/SCons/Node/Alias.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Script/Main.py | 14 |
3 files changed, 17 insertions, 3 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index a934bf4..d6edd56 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -25,6 +25,10 @@ RELEASE 0.97 - XXX - Allow Tools found on a toolpath to import Python modules from their local directory. + From Stanislav Baranov: + + - Make it possible to support with custom Alias (sub-)classes. + From Timothee Besset: - Add support for Objective C/C++ .m and .mm file suffixes (for diff --git a/src/engine/SCons/Node/Alias.py b/src/engine/SCons/Node/Alias.py index c361838..2730abf 100644 --- a/src/engine/SCons/Node/Alias.py +++ b/src/engine/SCons/Node/Alias.py @@ -49,7 +49,7 @@ class AliasNameSpace(UserDict.UserDict): self[name] = a return a - def lookup(self, name): + def lookup(self, name, **kw): try: return self[name] except KeyError: diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index f66f214..494fbc9 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -1014,7 +1014,17 @@ def _main(args, parser): if isinstance(x, SCons.Node.Node): node = x else: - node = SCons.Node.Alias.default_ans.lookup(x) + node = None + # Why would ltop be None? Unfortunately this happens. + if ltop == None: ltop = '' + # Curdir becomes important when SCons is called with -u, -C, + # or similar option that changes directory, and so the paths + # of targets given on the command line need to be adjusted. + curdir = os.path.join(os.getcwd(), str(ltop)) + for lookup in SCons.Node.arg2nodes_lookups: + node = lookup(x, curdir=curdir) + if node != None: + break if node is None: node = fs.Entry(x, directory=ltop, create=1) if ttop and not node.is_under(ttop): @@ -1024,7 +1034,7 @@ def _main(args, parser): node = None return node - nodes = filter(lambda x: x is not None, map(Entry, targets)) + nodes = filter(None, map(Entry, targets)) task_class = BuildTask # default action is to build targets opening_message = "Building targets ..." |