|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r64357 - in trunk/tools/build/v2: . build test util
From: ghost_at_[hidden]
Date: 2010-07-26 07:40:01
Author: vladimir_prus
Date: 2010-07-26 07:40:00 EDT (Mon, 26 Jul 2010)
New Revision: 64357
URL: http://svn.boost.org/trac/boost/changeset/64357
Log:
Make build-dir project attribute and command-line option work.
Text files modified:
trunk/tools/build/v2/build/project.py | 22 +++++++++++-----------
trunk/tools/build/v2/build/targets.py | 3 +--
trunk/tools/build/v2/build_system.py | 1 -
trunk/tools/build/v2/test/build_dir.py | 2 +-
trunk/tools/build/v2/util/option.py | 5 +++--
5 files changed, 16 insertions(+), 17 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-26 07:40:00 EDT (Mon, 26 Jul 2010)
@@ -56,7 +56,7 @@
def __init__(self, manager, global_build_dir):
self.manager = manager
- self.global_build_dir = None
+ self.global_build_dir = global_build_dir
self.project_rules_ = ProjectRules(self)
# The target corresponding to the project being loaded now
@@ -339,7 +339,7 @@
actual value %s""" % (jamfile_module, saved_project, self.current_project))
if self.global_build_dir:
- id = self.attribute(jamfile_module, "id")
+ id = self.attributeDefault(jamfile_module, "id", None)
project_root = self.attribute(jamfile_module, "project-root")
location = self.attribute(jamfile_module, "location")
@@ -393,8 +393,6 @@
# source paths are correct.
if not location:
location = ""
- else:
- location = b2.util.path.relpath(os.getcwd(), location)
attributes = ProjectAttributes(self.manager, location, module_name)
self.module2attributes[module_name] = attributes
@@ -523,8 +521,7 @@
try:
return self.module2attributes[project].get(attribute)
except:
- print "Sucks", project, attribute
- raise "Sucks"
+ raise BaseException("No attribute '%s' for project" % (attribute, project))
def attributeDefault(self, project, attribute, default):
"""Returns the value of the specified attribute in the
@@ -708,7 +705,7 @@
self.attributes = {}
self.usage_requirements = None
- def set(self, attribute, specification, exact):
+ def set(self, attribute, specification, exact=False):
"""Set the named attribute from the specification given by the user.
The value actually set may be different."""
@@ -893,6 +890,8 @@
id = '/' + id
self.registry.register_id (id, jamfile_module)
+ attributes.set('id', id)
+
explicit_build_dir = None
for a in args:
if a:
@@ -912,16 +911,17 @@
# This is Jamroot.
if id:
if explicit_build_dir and os.path.isabs(explicit_build_dir):
- self.register.manager.errors()(
+ self.registry.manager.errors()(
"""Absolute directory specified via 'build-dir' project attribute
Don't know how to combine that with the --build-dir option.""")
rid = id
if rid[0] == '/':
rid = rid[1:]
-
- p = os.path.join(self.registry.global_build_dir,
- rid, explicit_build_dir)
+
+ p = os.path.join(self.registry.global_build_dir, rid)
+ if explicit_build_dir:
+ p = os.path.join(p, explicit_build_dir)
attributes.set("build-dir", p, exact=1)
elif explicit_build_dir:
self.registry.manager.errors()(
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-26 07:40:00 EDT (Mon, 26 Jul 2010)
@@ -380,8 +380,7 @@
if not self.build_dir_:
self.build_dir_ = self.get ('build-dir')
if not self.build_dir_:
- self.build_dir_ = os.path.join (os.path.dirname(
- self.project_.get ('location')), 'bin')
+ self.build_dir_ = os.path.join(self.project_.get ('location'), 'bin')
return self.build_dir_
Modified: trunk/tools/build/v2/build_system.py
==============================================================================
--- trunk/tools/build/v2/build_system.py (original)
+++ trunk/tools/build/v2/build_system.py 2010-07-26 07:40:00 EDT (Mon, 26 Jul 2010)
@@ -453,7 +453,6 @@
engine = Engine()
global_build_dir = option.get("build-dir")
-
manager = Manager(engine, global_build_dir)
if "--version" in sys.argv:
Modified: trunk/tools/build/v2/test/build_dir.py
==============================================================================
--- trunk/tools/build/v2/test/build_dir.py (original)
+++ trunk/tools/build/v2/test/build_dir.py 2010-07-26 07:40:00 EDT (Mon, 26 Jul 2010)
@@ -99,7 +99,7 @@
build-project sub ;
""" % string.replace(os.getcwd(), '\\', '\\\\'))
-t.run_build_system("--build-dir=build", status=1)
+t.run_build_system("--build-dir=build")
t.fail_test(string.find(t.stdout(),
"Absolute directory specified via 'build-dir' project attribute") == -1)
Modified: trunk/tools/build/v2/util/option.py
==============================================================================
--- trunk/tools/build/v2/util/option.py (original)
+++ trunk/tools/build/v2/util/option.py 2010-07-26 07:40:00 EDT (Mon, 26 Jul 2010)
@@ -5,6 +5,7 @@
# http://www.boost.org/LICENSE_1_0.txt)
import sys
+import re
import b2.util.regex
options = {}
@@ -21,11 +22,11 @@
global options
- matches = b2.util.regex.transform(sys.argv, "--$(name)=(.*)")
+ matches = b2.util.regex.transform(sys.argv, "--" + re.escape(name) + "=(.*)")
if matches:
return matches[-1]
else:
- m = b2.util.regex.transform(sys.argv, "--$(name)")
+ m = b2.util.regex.transform(sys.argv, "--" + re.escape(name))
if m and implied_value:
return implied_value
elif options.has_key(name):
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