|
Boost-Commit : |
From: ghost_at_[hidden]
Date: 2007-10-10 05:29:14
Author: vladimir_prus
Date: 2007-10-10 05:29:13 EDT (Wed, 10 Oct 2007)
New Revision: 39882
URL: http://svn.boost.org/trac/boost/changeset/39882
Log:
Use the errors module from project.py. Grab
global JAMROOT/JAMFILE.
Text files modified:
branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/build/project.py | 57 ++++++++++++++++++---------------------
branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/main.py | 24 +++++++++-------
branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/manager.py | 8 +++++
3 files changed, 48 insertions(+), 41 deletions(-)
Modified: branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/build/project.py
==============================================================================
--- branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/build/project.py (original)
+++ branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/build/project.py 2007-10-10 05:29:13 EDT (Wed, 10 Oct 2007)
@@ -42,10 +42,11 @@
import boost.build.build.targets
import bjam
-import re
+import re
import sys
import os
+import string
class ProjectRegistry:
@@ -82,10 +83,7 @@
self.saved_current_project = []
- # FIXME: need to have a way to grab this
- # from environment
- # JAMROOT ?= [ peek : JAMROOT ] ;
- self.JAMROOT = None
+ self.JAMROOT = self.manager.getenv("JAMROOT");
# Note the use of character groups, as opposed to listing
# 'Jamroot' and 'jamroot'. With the latter, we'd get duplicate
@@ -95,10 +93,7 @@
# Default patterns to search for the Jamfiles to use for build
# declarations.
- #
- # FIXME: need to grab from environment
- #JAMFILE = [ modules.peek : JAMFILE ] ;
- self.JAMFILE = None
+ self.JAMFILE = self.manager.getenv("JAMFILE")
if not self.JAMFILE:
self.JAMFILE = ["[Bb]uild.jam", "[Jj]amfile.v2", "[Jj]amfile",
@@ -169,9 +164,8 @@
error."""
if self.module_name(location) in self.jamfile_modules:
- # FIXME
- print "Jamfile was already loaded for '$(location)'" ;
- # errors.error "Jamfile was already loaded for '$(location)'" ;
+ self.manager.errors()(
+ "Jamfile was already loaded for '%s'" % location)
# Set up non-default mapping from location to module.
self.location2module[location] = module
@@ -231,7 +225,7 @@
# Glob for all the possible Jamfiles according to the match pattern.
#
jamfile_glob = None
- if not parent_root:
+ if parent_root:
parent = self.dir2parent_jamfile.get(dir)
if not parent:
parent = boost.build.util.path.glob_in_parents(dir,
@@ -261,13 +255,12 @@
# Could not find it, error.
if not no_errors and not jamfile_glob:
- print "Unable to load Jamfile"
- # FIXME:
- #errors.error
- #"Unable to load Jamfile." :
- # "Could not find a Jamfile in directory '$(dir)'". :
- # "Attempted to find it with pattern '"$(JAMFILE:J=" ")"'." :
- # "Please consult the documentation at 'http://www.boost.org'." ;
+ self.manager.errors()(
+ """Unable to load Jamfile.
+Could not find a Jamfile in directory '%s'
+Attempted to find it with pattern '%s'.
+Please consult the documentation at 'http://boost.org/boost-build2'."""
+ % (dir, string.join(self.JAMFILE)))
return jamfile_glob[0]
@@ -277,7 +270,7 @@
Effect of calling this rule twice with the same 'dir' is underfined."""
# See if the Jamfile is where it should be.
-
+
jamfile_to_load = boost.build.util.path.glob(dir, self.JAMROOT)
if not jamfile_to_load:
jamfile_to_load = self.find_jamfile(dir)
@@ -310,14 +303,13 @@
# Now do some checks
if self.current_project != saved_project:
- print "The value of self.current_project magically changed"
- # FIXME:
- #errors.error "The value of the .current-project variable"
- #: "has magically changed after loading a Jamfile."
- #: "This means some of the targets might be defined a the wrong project."
- #: "after loading " $(jamfile-module)
- #: "expected value " $(saved-project)
- #: "actual value " $(.current-project)
+ self.manager.errors()(
+"""The value of the .current-project variable
+has magically changed after loading a Jamfile.
+This means some of the targets might be defined a the wrong project.
+after loading %s
+expected value %s
+actual value %s""" % (jamfile_module, saved_project, self.current_project))
if self.global_build_dir:
id = self.attribute(jamfile_module, "id")
@@ -327,6 +319,8 @@
if location and project_root == dir:
# This is Jamroot
if not id:
+ # FIXME: go via errors module, so that contexts are
+ # shown?
print "warning: the --build-dir option was specified"
print "warning: but Jamroot at '%s'" % dir
print "warning: specified no project id"
@@ -386,7 +380,7 @@
# We search for parent/project-root only if jamfile was specified
# --- i.e
# if the project is not standalone.
- parent_module = load_parent(location)
+ parent_module = self.load_parent(location)
else:
# It's either jamroot, or standalone project.
# If it's jamroot, inherit from user-config.
@@ -413,7 +407,8 @@
target = boost.build.build.targets.ProjectTarget(self.manager,
module_name, module_name, parent,
self.attribute(module_name,"requirements"),
- # FIXME: why we need this?
+ # FIXME: why we need to pass this? It's not
+ # passed in jam code.
self.attribute(module_name, "default-build"))
self.module2target[module_name] = target
Modified: branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/main.py
==============================================================================
--- branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/main.py (original)
+++ branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/main.py 2007-10-10 05:29:13 EDT (Wed, 10 Oct 2007)
@@ -33,18 +33,22 @@
manager = Manager(engine, global_build_dir)
- boost.build.tools.common.init(manager)
-
- project_here = manager.projects().load('.')
+ try:
+ boost.build.tools.common.init(manager)
+
+ project_here = manager.projects().load('.')
- result = manager.projects().target(project_here).generate(
+ result = manager.projects().target(project_here).generate(
property_set.empty())
- actual_targets = []
- for t in result.targets():
- actual_targets.append(t.actualize())
-
- bjam.call("set-top-level-targets", actual_targets)
- return []
+ actual_targets = []
+ for t in result.targets():
+ actual_targets.append(t.actualize())
+
+ bjam.call("set-top-level-targets", actual_targets)
+ return []
+ except Exception, e:
+ print e.message
+ return []
Modified: branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/manager.py
==============================================================================
--- branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/manager.py (original)
+++ branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/manager.py 2007-10-10 05:29:13 EDT (Wed, 10 Oct 2007)
@@ -6,6 +6,7 @@
from build.targets import TargetRegistry
from build.project import ProjectRegistry
from build.scanner import ScannerRegistry
+from build.errors import Errors
from boost.build.util.logger import NullLogger
from build import build_request, property_set, feature
import bjam
@@ -32,6 +33,7 @@
self.logger_ = NullLogger ()
self.scanners_ = ScannerRegistry (self)
self.argv_ = bjam.variable("ARGV")
+ self.errors_ = Errors()
# Object Map.
# TODO: This is a kludge: maps object names to the actual instances.
@@ -66,6 +68,12 @@
def set_logger (self, logger):
self.logger_ = logger
+ def errors (self):
+ return self.errors_
+
+ def getenv(self, name):
+ return bjam.variable(name)
+
def register_object (self, value):
""" Stores an object in a map and returns a key that can be used to retrieve it.
"""
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