Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64305 - in trunk/tools/build/v2: build test
From: ghost_at_[hidden]
Date: 2010-07-23 11:08:15


Author: vladimir_prus
Date: 2010-07-23 11:08:14 EDT (Fri, 23 Jul 2010)
New Revision: 64305
URL: http://svn.boost.org/trac/boost/changeset/64305

Log:
Unbreak conditional requirements work.

Text files modified:
   trunk/tools/build/v2/build/feature.py | 2
   trunk/tools/build/v2/build/property.py | 48 ++++++++++++++++++++--------------------
   trunk/tools/build/v2/build/targets.py | 33 ++++++++++++++++----------
   trunk/tools/build/v2/test/BoostBuild.py | 2 +
   4 files changed, 47 insertions(+), 38 deletions(-)

Modified: trunk/tools/build/v2/build/feature.py
==============================================================================
--- trunk/tools/build/v2/build/feature.py (original)
+++ trunk/tools/build/v2/build/feature.py 2010-07-23 11:08:14 EDT (Fri, 23 Jul 2010)
@@ -357,7 +357,7 @@
     
     return result
 
-def expand_subfeatures (properties, dont_validate = False):
+def expand_subfeatures(properties, dont_validate = False):
     """
     Make all elements of properties corresponding to implicit features
     explicit, and express all subfeature values as separate properties

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 11:08:14 EDT (Fri, 23 Jul 2010)
@@ -44,8 +44,10 @@
         return self._condition
 
     def to_raw(self):
- # FIXME: include condition!
- return "<" + self._feature.name() + ">" + self._value
+ result = "<" + self._feature.name() + ">" + self._value
+ if self._condition:
+ result = ",".join(str(p) for p in self._condition) + ':' + result
+ return result
 
     def __str__(self):
         return self.to_raw()
@@ -253,17 +255,20 @@
 
         if not p.condition():
             result.append(p)
+ else:
+ expanded = []
+ for c in p.condition():
 
- for c in p.condition():
+ if c.feature().name().startswith("toolset") or c.feature().name() == "os":
+ # It common that condition includes a toolset which
+ # was never defined, or mentiones subfeatures which
+ # were never defined. In that case, validation will
+ # only produce an spirious error, so don't validate.
+ expanded.extend(feature.expand_subfeatures ([c], True))
+ else:
+ expanded.extend(feature.expand_subfeatures([c]))
 
- if c.feature().name().startswith("toolset") or c.feature().name() == "os":
- # It common that condition includes a toolset which
- # was never defined, or mentiones subfeatures which
- # were never defined. In that case, validation will
- # only produce an spirious error, so don't validate.
- result.extend(feature.expand_subfeatures ([c], True))
- else:
- result.extend(feature.expand_subfeatures([c]))
+ result.append(Property(p.feature(), p.value(), expanded))
 
     return result
 
@@ -311,26 +316,21 @@
         in conditions are looked up in 'context'
     """
     base = []
- conditionals = []
+ conditional = []
 
     for p in properties:
- if __re_has_condition.search (p):
- conditionals.append (p)
+ if p.condition():
+ conditional.append (p)
         else:
             base.append (p)
 
     result = base
- for p in conditionals:
-
- # Separate condition and property
- s = __re_separate_condition_and_property.match (p)
-
- # Split condition into individual properties
- conditions = s.group (1).split (',')
+ for p in conditional:
 
- # Evaluate condition
- if b2.util.set.contains (conditions, context):
- result.append (s.group (2))
+ # Evaluate condition
+ # FIXME: probably inefficient
+ if all(x in context for x in p.condition()):
+ result.append(Property(p.feature(), p.value()))
 
     return result
 

Modified: trunk/tools/build/v2/build/targets.py
==============================================================================
--- trunk/tools/build/v2/build/targets.py (original)
+++ trunk/tools/build/v2/build/targets.py 2010-07-23 11:08:14 EDT (Fri, 23 Jul 2010)
@@ -96,7 +96,7 @@
         # Current indent for debugging messages
         self.indent_ = ""
 
- self.debug_building_ = "--debug-building" in bjam.variable("ARGV")
+ self.debug_building_ = "--debug-building" in bjam.variable("ARV")
 
     def main_target_alternative (self, target):
         """ Registers the specified target as a main target alternatives.
@@ -869,17 +869,24 @@
             common to dependency build request and target build
             properties.
         """
- # For optimization, we add free requirements directly,
+ # For optimization, we add free unconditional requirements directly,
         # without using complex algorithsm.
- # This gives the complex algorithm better chance of caching results.
- free = requirements.free ()
- non_free = property_set.create(requirements.base() + requirements.incidental())
-
- key = (build_request, non_free)
+ # This gives the complex algorithm better chance of caching results.
+ # The exact effect of this "optimization" is no longer clear
+ free_unconditional = []
+ other = []
+ for p in requirements.all():
+ if p.feature().free() and not p.condition():
+ free_unconditional.append(p)
+ else:
+ other.append(p)
+ other = property_set.create(other)
+
+ key = (build_request, other)
         if not self.request_cache.has_key(key):
- self.request_cache[key] = self.__common_properties2 (build_request, non_free)
+ self.request_cache[key] = self.__common_properties2 (build_request, other)
 
- return self.request_cache[key].add_raw(free)
+ return self.request_cache[key].add_raw(free_unconditional)
 
     # Given 'context' -- a set of already present properties, and 'requirements',
     # decide which extra properties should be applied to 'context'.
@@ -906,7 +913,7 @@
         # <threading>single
         #
         # might come from project's requirements.
-
+
         unconditional = feature.expand(requirements.non_conditional())
     
         raw = context.all()
@@ -974,14 +981,14 @@
         # TODO: There is possibility that we've added <foo>bar, which is composite
         # and expands to <foo2>bar2, but default value of <foo2> is not bar2,
         # in which case it's not clear what to do.
- #
+ #
         build_request = build_request.add_defaults()
         # Featured added by 'add-default' can be composite and expand
         # to features without default values -- so they are not added yet.
         # It could be clearer/faster to expand only newly added properties
         # but that's not critical.
         build_request = build_request.expand()
-
+
         return self.evaluate_requirements(requirements, build_request,
                                           "refined")
     
@@ -1077,7 +1084,7 @@
                 result = GenerateResult ()
 
                 properties = rproperties.non_dependency ()
-
+
                 (p, u) = self.generate_dependencies (rproperties.dependency (), rproperties)
                 properties += p
                 usage_requirements = u

Modified: trunk/tools/build/v2/test/BoostBuild.py
==============================================================================
--- trunk/tools/build/v2/test/BoostBuild.py (original)
+++ trunk/tools/build/v2/test/BoostBuild.py 2010-07-23 11:08:14 EDT (Fri, 23 Jul 2010)
@@ -438,6 +438,8 @@
                         % os.path.join(self.original_workdir, "test-config.jam"))
                 if ignore_toolset_requirements:
                     kw['program'].append("--ignore-toolset-requirements")
+ if "--python" in sys.argv:
+ kw['program'].append("--python")
                 kw['chdir'] = subdir
                 apply(TestCmd.TestCmd.run, [self], kw)
             except:


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