diff options
author | Manuel Francisco Naranjo <naranjo.manuel@gmail.com> | 2013-06-03 15:53:17 (GMT) |
---|---|---|
committer | Manuel Francisco Naranjo <naranjo.manuel@gmail.com> | 2013-06-03 15:53:17 (GMT) |
commit | 2209d1b9a664b2c33d788311add3f5bf7d6caf8c (patch) | |
tree | 53850d2b16cd80a8e48a7b9cc8885befd5af67df | |
parent | 320244104f2de73a758b0644d12185981c111582 (diff) | |
download | SCons-2209d1b9a664b2c33d788311add3f5bf7d6caf8c.zip SCons-2209d1b9a664b2c33d788311add3f5bf7d6caf8c.tar.gz SCons-2209d1b9a664b2c33d788311add3f5bf7d6caf8c.tar.bz2 |
Allow Literal objects to be compared among each others.
This small change allows Literal objects to be compared, so that calls like for
example AppendUnique only append one instance when string compares to True
instead of duplicated values.
-rw-r--r-- | src/engine/SCons/Subst.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/engine/SCons/Subst.py b/src/engine/SCons/Subst.py index 98097dc..318d7d9 100644 --- a/src/engine/SCons/Subst.py +++ b/src/engine/SCons/Subst.py @@ -78,6 +78,14 @@ class Literal(object): def is_literal(self): return 1 + def __eq__(self, other): + if not isinstance(other, Literal): + return False + return self.lstr == other.lstr + + def __neq__(self, other): + return not self.__eq__(other) + class SpecialAttrWrapper(object): """This is a wrapper for what we call a 'Node special attribute.' This is any of the attributes of a Node that we can reference from @@ -172,7 +180,7 @@ class NLWrapper(object): In practice, this might be a wash performance-wise, but it's a little cleaner conceptually... """ - + def __init__(self, list, func): self.list = list self.func = func @@ -190,7 +198,7 @@ class NLWrapper(object): self._create_nodelist = self._return_nodelist return self.nodelist _create_nodelist = _gen_nodelist - + class Targets_or_Sources(collections.UserList): """A class that implements $TARGETS or $SOURCES expansions by in turn @@ -451,7 +459,7 @@ def scons_subst(strSubst, env, mode=SUBST_RAW, target=None, source=None, gvars={ raise_exception(NameError(key), lvars['TARGETS'], s) else: return '' - + # Before re-expanding the result, handle # recursive expansion by copying the local # variable dictionary and overwriting a null |