diff options
author | Steven Knight <knight@baldmt.com> | 2005-03-08 18:05:41 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-03-08 18:05:41 (GMT) |
commit | 2411ada8e1161f5073eb35dbdf418450efc5fb0f (patch) | |
tree | 3782c07db4a9e72944a536f0b69a1fa6c976ee45 /src | |
parent | 0793d1606ebcc056d6f945af189c2c7f7b88ef5f (diff) | |
download | SCons-2411ada8e1161f5073eb35dbdf418450efc5fb0f.zip SCons-2411ada8e1161f5073eb35dbdf418450efc5fb0f.tar.gz SCons-2411ada8e1161f5073eb35dbdf418450efc5fb0f.tar.bz2 |
Speed up string expansion. Cache find_file() results in the Memoizer.
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/SCons/Node/FS.py | 1 | ||||
-rw-r--r-- | src/engine/SCons/Util.py | 16 |
2 files changed, 7 insertions, 10 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 9dfd355..336ba1f 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -1892,6 +1892,7 @@ def find_file(filename, paths, verbose=None): Only the first file found is returned, and none is returned if no file is found. + __cacheable__ """ if verbose: if not SCons.Util.is_String(verbose): diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 2ca487f..e76087d 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -582,15 +582,6 @@ def scons_subst(strSubst, env, mode=SUBST_RAW, target=None, source=None, gvars={ self.conv = conv self.gvars = gvars - def expand_var_once(self, var, lvars): - try: - return lvars[var] - except KeyError: - try: - return self.gvars[var] - except KeyError: - return '' - def expand(self, s, lvars): """Expand a single "token" as necessary, returning an appropriate string containing the expansion. @@ -629,7 +620,12 @@ def scons_subst(strSubst, env, mode=SUBST_RAW, target=None, source=None, gvars={ else: raise SCons.Errors.UserError, "Syntax error `%s' trying to evaluate `%s'" % (e,s) else: - s = self.expand_var_once(key, lvars) + if lvars.has_key(key): + s = lvars[key] + elif self.gvars.has_key(key): + s = self.gvars[key] + else: + return '' # Before re-expanding the result, handle # recursive expansion by copying the local |