Optimizations

This commit is contained in:
Thomas Nagy 2014-10-04 12:44:03 +02:00
parent 71e318e371
commit 5e4110443e
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
3 changed files with 17 additions and 16 deletions

View File

@ -211,9 +211,9 @@ class ConfigSet(object):
The value must be a list or a tuple
"""
current_value = self._get_list_value_for_modification(var)
if isinstance(val, str): # if there were string everywhere we could optimize this
val = [val]
current_value = self._get_list_value_for_modification(var)
current_value.extend(val)
def prepend_value(self, var, val):

View File

@ -409,19 +409,17 @@ def propagate_uselib_vars(self):
"""
_vars = self.get_uselib_vars()
env = self.env
app = env.append_value
for var in _vars:
y = var.lower()
val = getattr(self, y, [])
if val:
app(var, val)
for x in _vars:
y = x.lower()
env.append_value(x, self.to_list(getattr(self, y, [])))
for x in self.features:
for var in _vars:
compvar = '%s_%s' % (var, x)
env.append_value(var, env[compvar])
for x in self.to_list(getattr(self, 'uselib', [])):
for v in _vars:
env.append_value(v, env[v + '_' + x])
for x in self.features + self.uselib:
val = env['%s_%s' % (var, x)]
if val:
app(var, val)
# ============ the code above must not know anything about import libs ==========

View File

@ -213,6 +213,7 @@ def apply_uselib_local(self):
names = self.to_list(getattr(self, 'uselib_local', []))
get = self.bld.get_tgen_by_name
seen = set([])
seen_uselib = set([])
tmp = Utils.deque(names) # consume a copy of the list of names
if tmp:
if Logs.verbose:
@ -259,9 +260,11 @@ def apply_uselib_local(self):
# add ancestors uselib too - but only propagate those that have no staticlib defined
for v in self.to_list(getattr(y, 'uselib', [])):
if not env['STLIB_' + v]:
if not v in self.uselib:
self.uselib.insert(0, v)
if v not in seen_uselib:
seen_uselib.add(v)
if not env['STLIB_' + v]:
if not v in self.uselib:
self.uselib.insert(0, v)
# if the library task generator provides 'export_includes', add to the include path
# the export_includes must be a list of paths relative to the other library