|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r64638 - in trunk/tools/build/v2: build test
From: ghost_at_[hidden]
Date: 2010-08-06 09:02:27
Author: vladimir_prus
Date: 2010-08-06 09:02:27 EDT (Fri, 06 Aug 2010)
New Revision: 64638
URL: http://svn.boost.org/trac/boost/changeset/64638
Log:
Preserve current project across 'using' statements.
Text files modified:
trunk/tools/build/v2/build/project.py | 9 ++++++---
trunk/tools/build/v2/test/wrong_project.py | 9 +++++++++
2 files changed, 15 insertions(+), 3 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-08-06 09:02:27 EDT (Fri, 06 Aug 2010)
@@ -1053,9 +1053,8 @@
# will expect the module to be found even though
# the directory is not in BOOST_BUILD_PATH.
# So temporary change the search path.
- jamfile_module = self.registry.current().project_module()
- attributes = self.registry.attributes(jamfile_module)
- location = attributes.get("location")
+ current = self.registry.current()
+ location = current.get('location')
m = self.registry.load_module(toolset[0], [location])
if not m.__dict__.has_key("init"):
@@ -1063,6 +1062,10 @@
"Tool module '%s' does not define the 'init' method" % toolset[0])
m.init(*args)
+ # The above might have clobbered .current-project. Restore the correct
+ # value.
+ self.registry.set_current(current)
+
def import_(self, name, names_to_import=None, local_names=None):
name = name[0]
Modified: trunk/tools/build/v2/test/wrong_project.py
==============================================================================
--- trunk/tools/build/v2/test/wrong_project.py (original)
+++ trunk/tools/build/v2/test/wrong_project.py 2010-08-06 09:02:27 EDT (Fri, 06 Aug 2010)
@@ -26,6 +26,15 @@
rule init ( ) { }
""")
+t.write("some_tool.py", """
+from b2.manager import get_manager
+
+get_manager().projects().initialize(__name__)
+
+def init():
+ pass
+""")
+
t.run_build_system()
t.expect_addition("bin/$toolset/debug/a.exe")
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