diff options
author | Steven Knight <knight@baldmt.com> | 2005-01-05 21:26:41 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-01-05 21:26:41 (GMT) |
commit | 1344c9c2297d5e0931bfcd15a853b13d8e5caf34 (patch) | |
tree | cb64e69f33383e176fded537d24649dda29c566c /src/engine/SCons/Environment.py | |
parent | afb25b009ee74ade18a9a5b65e62f2ad5b773739 (diff) | |
download | SCons-1344c9c2297d5e0931bfcd15a853b13d8e5caf34.zip SCons-1344c9c2297d5e0931bfcd15a853b13d8e5caf34.tar.gz SCons-1344c9c2297d5e0931bfcd15a853b13d8e5caf34.tar.bz2 |
Use AppendUnique() in ParseConfig(). Provide a unique=0 keyword argument in case someone has a reason to need to allow duplicates.
Diffstat (limited to 'src/engine/SCons/Environment.py')
-rw-r--r-- | src/engine/SCons/Environment.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 6f8e30c..c98c7aa 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -686,7 +686,7 @@ class Base(SubstitutionEnvironment): """ kw = copy_non_reserved_keywords(kw) for key, val in kw.items(): - if not self._dict.has_key(key): + if not self._dict.has_key(key) or not self._dict[key]: self._dict[key] = val elif SCons.Util.is_Dict(self._dict[key]) and \ SCons.Util.is_Dict(val): @@ -786,7 +786,7 @@ class Base(SubstitutionEnvironment): if name[:len(prefix)] == prefix and name[-len(suffix):] == suffix: return path - def ParseConfig(self, command, function=None): + def ParseConfig(self, command, function=None, unique=1): """ Use the specified function to parse the output of the command in order to modify the current environment. The 'command' can @@ -800,7 +800,7 @@ class Base(SubstitutionEnvironment): """ # the default parse function - def parse_conf(env, output, fs=self.fs): + def parse_conf(env, output, fs=self.fs, unique=unique): dict = { 'ASFLAGS' : [], 'CCFLAGS' : [], @@ -853,7 +853,11 @@ class Base(SubstitutionEnvironment): dict['LINKFLAGS'].append(arg) else: dict['CCFLAGS'].append(arg) - apply(env.Append, (), dict) + if unique: + appender = env.AppendUnique + else: + appender = env.Append + apply(appender, (), dict) if function is None: function = parse_conf @@ -979,7 +983,7 @@ class Base(SubstitutionEnvironment): """ kw = copy_non_reserved_keywords(kw) for key, val in kw.items(): - if not self._dict.has_key(key): + if not self._dict.has_key(key) or not self._dict[key]: self._dict[key] = val elif SCons.Util.is_Dict(self._dict[key]) and \ SCons.Util.is_Dict(val): |