Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64290 - in trunk/tools/build/v2: build tools
From: ghost_at_[hidden]
Date: 2010-07-23 06:52:38


Author: vladimir_prus
Date: 2010-07-23 06:52:36 EDT (Fri, 23 Jul 2010)
New Revision: 64290
URL: http://svn.boost.org/trac/boost/changeset/64290

Log:
More fixups
Text files modified:
   trunk/tools/build/v2/build/project.py | 2
   trunk/tools/build/v2/build/property.py | 60 +++++++++++++--------------------------
   trunk/tools/build/v2/build/property_set.py | 15 ++++++----
   trunk/tools/build/v2/build/toolset.py | 17 ++++-------
   trunk/tools/build/v2/tools/builtin.py | 5 +++
   5 files changed, 41 insertions(+), 58 deletions(-)

Modified: trunk/tools/build/v2/build/project.py
==============================================================================
--- trunk/tools/build/v2/build/project.py (original)
+++ trunk/tools/build/v2/build/project.py 2010-07-23 06:52:36 EDT (Fri, 23 Jul 2010)
@@ -727,7 +727,7 @@
                 # FIXME:
                 #errors.error "usage-requirements" $(specification) "have non-free properties" $(non-free) ;
 
- t = property.translate_paths(specification, self.location)
+ t = property.translate_paths(property.create_from_strings(specification), self.location)
 
             existing = self.__dict__.get("usage-requirements")
             if existing:

Modified: trunk/tools/build/v2/build/property.py
==============================================================================
--- trunk/tools/build/v2/build/property.py (original)
+++ trunk/tools/build/v2/build/property.py 2010-07-23 06:52:36 EDT (Fri, 23 Jul 2010)
@@ -94,6 +94,10 @@
                    
     return Property(f, value, condition)
 
+def create_from_strings(string_list, validate=False):
+
+ return [create_from_string(s, validate) for s in string_list]
+
 def reset ():
     """ Clear the module state. This is mainly for testing purposes.
     """
@@ -180,45 +184,39 @@
     result = []
 
     for p in properties:
- split = split_conditional (p)
-
- condition = ''
 
- if split:
- condition = split [0]
- p = split [1]
-
- if get_grist (p) and 'path' in feature.attributes (get_grist (p)):
- values = __re_two_ampersands.split (forward_slashes (replace_grist (p, "")))
+ if p.feature().path():
+ values = __re_two_ampersands.split(p.value())
+
+ new_value = "&&".join(os.path.join(path, v) for v in values)
 
- t = [os.path.join(path, v) for v in values]
- t = '&&'.join (t)
- tp = replace_grist (t, get_grist (p)).replace("\\", "/")
- result.append (condition + tp)
+ if new_value != p.value():
+ result.append(Property(p.feature(), new_value, p.condition()))
+ else:
+ result.append(p)
             
         else:
- result.append (condition + ":" + p)
+ result.append (p)
 
     return result
 
-def translate_indirect(specification, context_module):
+def translate_indirect(properties, context_module):
     """Assumes that all feature values that start with '@' are
     names of rules, used in 'context-module'. Such rules can be
     either local to the module or global. Qualified local rules
     with the name of the module."""
     result = []
- for px in specification:
- p = get_value(px)
- if p[0] == '@':
+ for p in properties:
+ if p.value()[0] == '@':
             v = None
- m = p[1:]
+ m = p.value()[1:]
             if __re_indirect_rule.match(m):
                 # Rule is already in indirect format
                 # FIXME: it's not clear if this is necessary.
                 v = m
             else:
 
- if not '.' in p:
+ if not '.' in m:
                     # This is unqualified rule name. The user might want
                     # to set flags on this rule name, and toolset.flag
                     # auto-qualifies the rule name. Need to do the same
@@ -232,9 +230,9 @@
                 #v = indirect.make(m, context_module)
                 get_manager().engine().register_bjam_action(v)
             
- result.append(get_grist(px) + "@" + m)
+ result.append(Property(p.feature(), "@" + m, p.condition()))
         else:
- result.append(px)
+ result.append(p)
 
     return result
 
@@ -270,24 +268,6 @@
 
     return result
 
-def make (specification):
- """ Converts implicit values into full properties.
- """
- result = []
- for e in specification:
- if get_grist (e):
- result.append (e)
-
- elif feature.is_implicit_value (e):
- f = feature.implied_feature (e)
- result.append (f + e)
-
- else:
- raise InvalidProperty ("'%s' is not a valid for property specification" % e)
-
- return result
-
-
 # FIXME: this should go
 def split_conditional (property):
     """ If 'property' is conditional property, returns

Modified: trunk/tools/build/v2/build/property_set.py
==============================================================================
--- trunk/tools/build/v2/build/property_set.py (original)
+++ trunk/tools/build/v2/build/property_set.py 2010-07-23 06:52:36 EDT (Fri, 23 Jul 2010)
@@ -8,6 +8,7 @@
 
 from b2.util.utility import *
 import property, feature, string
+import b2.build.feature
 from b2.exceptions import *
 from b2.util.sequence import unique
 from b2.util.set import difference
@@ -64,10 +65,9 @@
     """Creates a property-set from the input given by the user, in the
     context of 'jamfile-module' at 'location'"""
 
- specification = property.translate_paths(raw_properties, location)
- specification = property.translate_indirect(specification, jamfile_module)
- specification = property.make(specification)
- properties = [property.create_from_string(s, True) for s in specification]
+ properties = property.create_from_strings(raw_properties, True)
+ properties = property.translate_paths(properties, location)
+ properties = property.translate_indirect(properties, jamfile_module)
     properties = property.expand_subfeatures_in_conditions(properties)
     return create(properties)
 
@@ -414,15 +414,18 @@
 
     
     def get (self, feature):
- """ Returns all properties for 'feature'.
+ """ Returns all values of 'feature'.
         """
+ if not isinstance(feature, b2.build.feature.Feature):
+ feature = b2.build.feature.get(feature)
+
         if not self.feature_map_:
             self.feature_map_ = {}
 
             for v in self.all_:
                 if not self.feature_map_.has_key(v.feature()):
                     self.feature_map_[v.feature()] = []
- self.feature_map_[v.feature()].append(v)
+ self.feature_map_[v.feature()].append(v.value())
         
         return self.feature_map_.get(feature, [])
     

Modified: trunk/tools/build/v2/build/toolset.py
==============================================================================
--- trunk/tools/build/v2/build/toolset.py (original)
+++ trunk/tools/build/v2/build/toolset.py 2010-07-23 06:52:36 EDT (Fri, 23 Jul 2010)
@@ -163,7 +163,7 @@
 
             found = False
             if i.value():
- found = i in ps.get(i.feature())
+ found = i.value() in ps.get(i.feature())
             else:
                 # Handle value-less properties like '<architecture>' (compare with
                 # '<architecture>x86').
@@ -310,32 +310,27 @@
     
     if get_grist (value):
         f = feature.get(value)
- properties = ps.get(f)
+ values = ps.get(f)
         
- for p in properties:
-
- value = p.value()
+ for value in values:
 
             if f.dependency():
                 # the value of a dependency feature is a target
                 # and must be actualized
                 # FIXME: verify that 'find' actually works, ick!
- result.append (manager.targets ().find (p.value()).actualize ())
+ result.append (manager.targets ().find(value).actualize ())
 
             elif f.path() or f.free():
- values = []
                 
                 # Treat features with && in the value
                 # specially -- each &&-separated element is considered
                 # separate value. This is needed to handle searched
                 # libraries, which must be in specific order.
                 if not __re_two_ampersands.search(value):
- values.append(value)
+ result.append(value)
 
                 else:
- values.extend(value.split ('&&'))
-
- result.extend(values)
+ result.extend(value.split ('&&'))
             else:
                 result.append (ungristed)
     else:

Modified: trunk/tools/build/v2/tools/builtin.py
==============================================================================
--- trunk/tools/build/v2/tools/builtin.py (original)
+++ trunk/tools/build/v2/tools/builtin.py 2010-07-23 06:52:36 EDT (Fri, 23 Jul 2010)
@@ -290,6 +290,11 @@
         'armv5t', 'armv5te', 'armv6', 'armv6j', 'iwmmxt', 'ep9312'],
 
         ['propagated', 'optional'])
+
+ feature.feature('conditional', [], ['incidental', 'free'])
+
+ # The value of 'no' prevents building of a target.
+ feature.feature('build', ['yes', 'no'], ['optional'])
     
     # Windows-specific features
     feature.feature ('user-interface', ['console', 'gui', 'wince', 'native', 'auto'], [])


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk