From 759f448b06aed508d8fa2a78142232644bb08742 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Sat, 31 Jul 2010 11:40:34 +0000 Subject: [PATCH] Don't bark on conditionals in usage requirements. [SVN r64496] --- src/build/project.py | 11 ++++++----- src/build/property.py | 6 +++--- src/build/property_set.py | 18 ++++-------------- src/build/targets.py | 2 +- 4 files changed, 14 insertions(+), 23 deletions(-) diff --git a/src/build/project.py b/src/build/project.py index 20c11c506..0cadc397c 100644 --- a/src/build/project.py +++ b/src/build/project.py @@ -758,15 +758,16 @@ class ProjectAttributes: non_free = property.remove("free", unconditional) if non_free: - pass - # FIXME: - #errors.error "usage-requirements" $(specification) "have non-free properties" $(non-free) ; + get_manager().errors()("usage-requirements %s have non-free properties %s" \ + % (specification, non_free)) - t = property.translate_paths(property.create_from_strings(specification), self.location) + t = property.translate_paths( + property.create_from_strings(specification, allow_condition=True), + self.location) existing = self.__dict__.get("usage-requirements") if existing: - new = property_set.create(existing.raw() + t) + new = property_set.create(existing.all() + t) else: new = property_set.create(t) self.__dict__["usage-requirements"] = new diff --git a/src/build/property.py b/src/build/property.py index d98eb8a41..633301d60 100644 --- a/src/build/property.py +++ b/src/build/property.py @@ -60,7 +60,7 @@ class Property(object): (other._feature, other._value, other._condition)) -def create_from_string(s, allow_condition = False): +def create_from_string(s, allow_condition=False): condition = [] import types @@ -98,9 +98,9 @@ def create_from_string(s, allow_condition = False): return Property(f, value, condition) -def create_from_strings(string_list, validate=False): +def create_from_strings(string_list, allow_condition=False): - return [create_from_string(s, validate) for s in string_list] + return [create_from_string(s, allow_condition) for s in string_list] def reset (): """ Clear the module state. This is mainly for testing purposes. diff --git a/src/build/property_set.py b/src/build/property_set.py index fe91a211d..589382423 100644 --- a/src/build/property_set.py +++ b/src/build/property_set.py @@ -154,7 +154,6 @@ class PropertySet: self.incidental_ = [] self.free_ = [] self.base_ = [] - self.base_raw_ = [] self.dependency_ = [] self.non_dependency_ = [] self.conditional_ = [] @@ -199,18 +198,7 @@ class PropertySet: raise BaseException ("Invalid property: '%s'" % p) att = feature.attributes (get_grist (p)) - - # A feature can be both incidental and free, - # in which case we add it to incidental. - if 'incidental' in att: - pass -# self.incidental_.append (p) - elif 'free' in att: - # self.free_.append (p) - pass - else: - self.base_raw_.append (p) - + if 'propagated' in att: self.propagated_.append (p) @@ -219,6 +207,8 @@ class PropertySet: for p in properties: + # A feature can be both incidental and free, + # in which case we add it to incidental. if p.feature().incidental(): self.incidental_.append(p) elif p.feature().free(): @@ -251,7 +241,7 @@ class PropertySet: def base (self): """ Returns properties that are neither incidental nor free. """ - return self.base_raw_ + return self.base_ def free (self): """ Returns free properties which are not dependency properties. diff --git a/src/build/targets.py b/src/build/targets.py index ce7781885..6be8ffec3 100644 --- a/src/build/targets.py +++ b/src/build/targets.py @@ -1019,7 +1019,7 @@ class BasicTarget (AbstractTarget): if debug: print " next alternative: required properties:", str(condition) - if b2.util.set.contains (condition, property_set.raw ()): + if b2.util.set.contains (condition, property_set.all()): if debug: print " matched"