Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64461 - in trunk/tools/build/v2: build util
From: ghost_at_[hidden]
Date: 2010-07-30 05:44:29


Author: vladimir_prus
Date: 2010-07-30 05:44:28 EDT (Fri, 30 Jul 2010)
New Revision: 64461
URL: http://svn.boost.org/trac/boost/changeset/64461

Log:
Fix indirect conditional requirements.

Text files modified:
   trunk/tools/build/v2/build/engine.py | 11 ++---------
   trunk/tools/build/v2/build/targets.py | 14 +++++++++++---
   trunk/tools/build/v2/util/__init__.py | 15 +++++++++++++++
   3 files changed, 28 insertions(+), 12 deletions(-)

Modified: trunk/tools/build/v2/build/engine.py
==============================================================================
--- trunk/tools/build/v2/build/engine.py (original)
+++ trunk/tools/build/v2/build/engine.py 2010-07-30 05:44:28 EDT (Fri, 30 Jul 2010)
@@ -10,9 +10,9 @@
 import re
 
 import b2.build.property_set as property_set
+import b2.util
 
 _indirect_rule = re.compile("^([^%]*)%([^%]+)$")
-_extract_jamfile_and_rule = re.compile("(Jamfile<.*>)%(.*)")
 
 class BjamAction:
     """Class representing bjam action defined from Python."""
@@ -42,14 +42,7 @@
         if property_set:
             p = property_set.raw()
 
- m = _extract_jamfile_and_rule.match(self.action_name)
- if m:
- bjam_interface.call("set-update-action-in-module",
- m.group(1), m.group(2),
- targets, sources, p)
- else:
- bjam_interface.call("set-update-action", self.action_name,
- targets, sources, p)
+ b2.util.call_jam_function(self.action_name, targets, sources, p)
         
 action_modifiers = {"updated": 0x01,
                     "together": 0x02,

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-30 05:44:28 EDT (Fri, 30 Jul 2010)
@@ -876,7 +876,7 @@
         free_unconditional = []
         other = []
         for p in requirements.all():
- if p.feature().free() and not p.condition():
+ if p.feature().free() and not p.condition() and p.feature().name() != 'conditional':
                 free_unconditional.append(p)
             else:
                 other.append(p)
@@ -913,7 +913,6 @@
         # <threading>single
         #
         # might come from project's requirements.
-
         unconditional = feature.expand(requirements.non_conditional())
     
         raw = context.all()
@@ -949,7 +948,16 @@
         
             # Evaluate indirect conditionals.
             for i in indirect:
- e.extend(bjam.call(i, current))
+ if callable(i):
+ # This is Python callable, yeah.
+ e.extend(bjam.call(i, current))
+ else:
+ # Name of bjam function. Because bjam is unable to handle
+ # list of Property, pass list of strings.
+ br = b2.util.call_jam_function(i, [str(p) for p in current])
+ if br:
+ e.extend(property.create_from_strings(br))
+
 
             if e == added_requirements:
                 # If we got the same result, we've found final properties.

Modified: trunk/tools/build/v2/util/__init__.py
==============================================================================
--- trunk/tools/build/v2/util/__init__.py (original)
+++ trunk/tools/build/v2/util/__init__.py 2010-07-30 05:44:28 EDT (Fri, 30 Jul 2010)
@@ -1,4 +1,7 @@
 
+import bjam
+import re
+
 # Decorator the specifies bjam-side prototype for a Python function
 def bjam_signature(s):
 
@@ -27,3 +30,15 @@
         return s[1:-1]
     else:
         return s
+
+_extract_jamfile_and_rule = re.compile("(Jamfile<.*>)%(.*)")
+
+def call_jam_function(name, *args):
+
+ m = _extract_jamfile_and_rule.match(name)
+ if m:
+ args = ("set-update-action-in-module", m.group(1), m.group(2)) + args
+ else:
+ args = ("set-update-action", name) + args
+
+ return bjam.call(*args)


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