Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64426 - in trunk/tools/build/v2: build engine/src test tools
From: ghost_at_[hidden]
Date: 2010-07-29 01:35:34


Author: vladimir_prus
Date: 2010-07-29 01:35:32 EDT (Thu, 29 Jul 2010)
New Revision: 64426
URL: http://svn.boost.org/trac/boost/changeset/64426

Log:
Various fixes
Text files modified:
   trunk/tools/build/v2/build/generators.py | 6 +++---
   trunk/tools/build/v2/build/project.py | 4 ++--
   trunk/tools/build/v2/build/targets.py | 6 +++---
   trunk/tools/build/v2/build/toolset.py | 14 ++++++++++++++
   trunk/tools/build/v2/engine/src/builtins.c | 7 +++++++
   trunk/tools/build/v2/engine/src/jam.c | 3 +++
   trunk/tools/build/v2/test/dll_path.py | 40 ++++++++++++++++++++++++++++++++++++++++
   trunk/tools/build/v2/tools/make.py | 6 +++++-
   8 files changed, 77 insertions(+), 9 deletions(-)

Modified: trunk/tools/build/v2/build/generators.py
==============================================================================
--- trunk/tools/build/v2/build/generators.py (original)
+++ trunk/tools/build/v2/build/generators.py 2010-07-29 01:35:32 EDT (Thu, 29 Jul 2010)
@@ -138,7 +138,7 @@
             
             NOTE: all subclasses must have a similar signature for clone to work!
     """
- def __init__ (self, id, composing, source_types, target_types_and_names, requirements):
+ def __init__ (self, id, composing, source_types, target_types_and_names, requirements = []):
         assert(not isinstance(source_types, str))
         assert(not isinstance(target_types_and_names, str))
         self.id_ = id
@@ -215,7 +215,7 @@
                               self.requirements_)
                               
 
- def id (self):
+ def id(self):
         return self.id_
 
     def source_types (self):
@@ -547,7 +547,7 @@
 def register (g):
     """ Registers new generator instance 'g'.
     """
- id = g.id ()
+ id = g.id()
 
     __generators [id] = g
 

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-29 01:35:32 EDT (Thu, 29 Jul 2010)
@@ -811,14 +811,14 @@
         
 
     def add_rule_for_type(self, type):
- rule_name = type.lower();
+ rule_name = type.lower().replace("_", "-")
 
         def xpto (name, sources, requirements = [], default_build = None, usage_requirements = []):
             return self.manager_.targets().create_typed_target(
                 type, self.registry.current(), name[0], sources,
                 requirements, default_build, usage_requirements)
 
- self.add_rule(type.lower(), xpto)
+ self.add_rule(rule_name, xpto)
     
     def add_rule(self, name, callable):
         self.rules[name] = callable

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-29 01:35:32 EDT (Thu, 29 Jul 2010)
@@ -855,13 +855,13 @@
         sproperties = []
         
         if split.group (3):
- sproperties = property.make (feature.split (split.group (3)))
- sproperties = self.manager.features ().expand_composites (sproperties)
+ sproperties = property.create_from_strings(feature.split(split.group(3)))
+ sproperties = feature.expand_composites(sproperties)
     
         # Find the target
         target = project.find (id)
         
- return (target, property_set.create (sproperties))
+ return (target, property_set.create(sproperties))
 
     def common_properties (self, build_request, requirements):
         """ Given build request and requirements, return properties

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-29 01:35:32 EDT (Thu, 29 Jul 2010)
@@ -15,6 +15,7 @@
 from b2.util import cached
 from b2.util.utility import *
 from b2.util import bjam_signature
+from b2.manager import get_manager
 
 __re_split_last_segment = re.compile (r'^(.+)\.([^\.])*')
 __re_two_ampersands = re.compile ('(&&)')
@@ -114,6 +115,19 @@
                           is specified, then the value of 'feature'
                           will be added.
     """
+ caller = bjam.caller()
+ if not '.' in rule_or_module and caller.startswith("Jamfile"):
+ # Unqualified rule name, used inside Jamfile. Most likely used with
+ # 'make' or 'notfile' rules. This prevents setting flags on the entire
+ # Jamfile module (this will be considered as rule), but who cares?
+ # Probably, 'flags' rule should be split into 'flags' and
+ # 'flags-on-module'.
+ rule_or_module = caller + rule_or_module
+ else:
+ # FIXME: revive checking that we don't set flags for a different
+ # module unintentionally
+ pass
+
     if condition and not replace_grist (condition, ''):
         # We have condition in the form '<feature>', that is, without
         # value. That's a previous syntax:

Modified: trunk/tools/build/v2/engine/src/builtins.c
==============================================================================
--- trunk/tools/build/v2/engine/src/builtins.c (original)
+++ trunk/tools/build/v2/engine/src/builtins.c 2010-07-29 01:35:32 EDT (Thu, 29 Jul 2010)
@@ -2078,6 +2078,13 @@
     return result;
 }
 
+PyObject * bjam_caller( PyObject * self, PyObject * args )
+{
+ PyObject *result = PyString_FromString(
+ frame_before_python_call->prev->module->name);
+ return result;
+}
+
 #endif /* #ifdef HAVE_PYTHON */
 
 

Modified: trunk/tools/build/v2/engine/src/jam.c
==============================================================================
--- trunk/tools/build/v2/engine/src/jam.c (original)
+++ trunk/tools/build/v2/engine/src/jam.c 2010-07-29 01:35:32 EDT (Thu, 29 Jul 2010)
@@ -208,6 +208,7 @@
     extern PyObject * bjam_define_action( PyObject * self, PyObject * args );
     extern PyObject * bjam_variable ( PyObject * self, PyObject * args );
     extern PyObject * bjam_backtrace ( PyObject * self, PyObject * args );
+ extern PyObject * bjam_caller ( PyObject * self, PyObject * args );
 #endif
 
 char *saved_argv0;
@@ -349,6 +350,8 @@
                      "Obtains a variable from bjam's global module."},
                     {"backtrace", bjam_backtrace, METH_VARARGS,
                      "Returns bjam backtrace from the last call into Python."},
+ {"caller", bjam_caller, METH_VARARGS,
+ "Returns the module from which the last call into Python is made."},
                     {NULL, NULL, 0, NULL}
                 };
 

Modified: trunk/tools/build/v2/test/dll_path.py
==============================================================================
--- trunk/tools/build/v2/test/dll_path.py (original)
+++ trunk/tools/build/v2/test/dll_path.py 2010-07-29 01:35:32 EDT (Thu, 29 Jul 2010)
@@ -81,6 +81,46 @@
 }
 """)
 
+t.write("dll_paths.py", """
+import bjam
+
+import b2.build.type as type
+import b2.build.generators as generators
+
+from b2.manager import get_manager
+
+def init():
+ type.register("PATH_LIST", ["pathlist"])
+
+ class DllPathsListGenerator(generators.Generator):
+
+ def __init__(self):
+ generators.Generator.__init__(self, "dll_paths.list", False, ["EXE"], ["PATH_LIST"])
+
+ def generated_targets(self, sources, ps, project, name):
+
+ dll_paths = []
+ for s in sources:
+ a = s.action()
+ if a:
+ p = a.properties()
+ dll_paths += p.get('dll-path')
+ dll_paths.sort()
+ return generators.Generator.generated_targets(self,
+ sources, ps.add_raw(["<dll-path>" + p for p in dll_paths]),
+ project, name)
+
+ generators.register(DllPathsListGenerator())
+
+command = \"\"\"
+echo $(PATHS) > $(<[1])
+\"\"\"
+def function(target, sources, ps):
+ bjam.call('set-target-variable', target, "PATHS", ps.get('dll-path'))
+
+get_manager().engine().register_action("dll_paths.list", command, function=function)
+""")
+
 t.write("a/a.cpp", """
 void
 #if defined(_WIN32)

Modified: trunk/tools/build/v2/tools/make.py
==============================================================================
--- trunk/tools/build/v2/tools/make.py (original)
+++ trunk/tools/build/v2/tools/make.py 2010-07-29 01:35:32 EDT (Thu, 29 Jul 2010)
@@ -25,7 +25,7 @@
     def construct(self, name, source_targets, property_set):
 
         action_name = property_set.get("<action>")[0]
- assert action_name[0] == '@'
+
         (jamfile, rule) = _extract_jamfile_and_rule.match(action_name).groups()
         # This is very bad. We need to call rule inside the proper module,
         # not at global scope, where it might not be available at all.
@@ -42,11 +42,15 @@
 
     target_name = target_name[0]
     generating_rule = generating_rule[0]
+ if generating_rule[0] != '@':
+ generating_rule = '@' + generating_rule
 
     if not requirements:
         requirements = []
 
+
     requirements.append("<action>%s" % generating_rule)
+
     m = get_manager()
     targets = m.targets()
     project = m.projects().current()


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