From 3c3d67ecb01ccdc6843e7d00cf7995220a75c4d8 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Mon, 26 Jul 2010 09:55:45 +0000 Subject: [PATCH] Fix project loading. - If we have Jamroot and Jamfile, load both - Actually inherit build-dir from parent. [SVN r64355] --- v2/build/project.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/v2/build/project.py b/v2/build/project.py index 77d745b77..ff50f224d 100644 --- a/v2/build/project.py +++ b/v2/build/project.py @@ -280,7 +280,8 @@ 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] + if jamfile_glob: + return jamfile_glob[0] def load_jamfile(self, dir): """Load a Jamfile at the given directory. Returns nothing. @@ -288,10 +289,12 @@ Please consult the documentation at 'http://boost.org/boost-build2'.""" Effect of calling this rule twice with the same 'dir' is underfined.""" # See if the Jamfile is where it should be. + is_jamroot = False jamfile_to_load = b2.util.path.glob([dir], self.JAMROOT) if not jamfile_to_load: jamfile_to_load = self.find_jamfile(dir) else: + is_jamroot = True jamfile_to_load = jamfile_to_load[0] # The module of the jamfile. @@ -319,7 +322,12 @@ Please consult the documentation at 'http://boost.org/boost-build2'.""" bjam.call("load", jamfile_module, jamfile_to_load) basename = os.path.basename(jamfile_to_load) - + + if is_jamroot: + jamfile = self.find_jamfile(dir, no_errors=True) + if jamfile: + bjam.call("load", jamfile_module, jamfile) + # Now do some checks if self.current_project != saved_project: self.manager.errors()( @@ -482,8 +490,8 @@ actual value %s""" % (jamfile_module, saved_project, self.current_project)) parent_dir = os.path.join(os.getcwd(), parent_location) build_dir = os.path.join(parent_build_dir, - b2.util.path.relpath(parent_dir, - our_dir)) + os.path.relpath(our_dir, parent_dir)) + attributes.set("build-dir", build_dir, exact=True) def register_id(self, id, module): """Associate the given id with the given project module.""" @@ -747,7 +755,7 @@ class ProjectAttributes: self.__dict__["source-location"] = source_location elif attribute == "build-dir": - self.__dict__["build-dir"] = os.path.join(self.location, specification) + self.__dict__["build-dir"] = os.path.join(self.location, specification[0]) elif not attribute in ["id", "default-build", "location", "source-location", "parent",