$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: juergen.hunold_at_[hidden]
Date: 2008-07-23 05:57:42
Author: jhunold
Date: 2008-07-23 05:57:41 EDT (Wed, 23 Jul 2008)
New Revision: 47702
URL: http://svn.boost.org/trac/boost/changeset/47702
Log:
Fix: Loading of parent projects.
Ref: Add typechecks for glob-rules.
Fix: Working "glob-in-parents"
ToDo: Rework path.py
Text files modified: 
   branches/build/python_port/python/boost/build/build/project.py |    33 ++++++++++++++++-----------------       
   branches/build/python_port/python/boost/build/util/path.py     |    23 ++++++++++++++++++++---                 
   2 files changed, 36 insertions(+), 20 deletions(-)
Modified: branches/build/python_port/python/boost/build/build/project.py
==============================================================================
--- branches/build/python_port/python/boost/build/build/project.py	(original)
+++ branches/build/python_port/python/boost/build/build/project.py	2008-07-23 05:57:41 EDT (Wed, 23 Jul 2008)
@@ -172,7 +172,7 @@
             print "error: Did not find Jamfile or project-root.jam in any parent directory."
             sys.exit(1)
     
-        return load(os.path.dirname(found[0]))
+        return self.load(os.path.dirname(found[0]))
 
     def act_as_jamfile(self, module, location):
         """Makes the specified 'module' act as if it were a regularly loaded Jamfile 
@@ -212,7 +212,7 @@
         
             project_module = self.module_name(location)
             if not project_module in self.jamfile_modules and \
-               boost.build.util.path.glob(location, self.JAMROOT + self.JAMFILE):
+               boost.build.util.path.glob([location], self.JAMROOT + self.JAMFILE):
                 project_module = self.load(location)
 
         return project_module
@@ -251,7 +251,7 @@
         else:
             jamfile = self.dir2jamfile.get(dir)
             if not jamfile:
-                jamfile = boost.build.util.path.glob(dir, self.JAMFILE)
+                jamfile = boost.build.util.path.glob([dir], self.JAMFILE)
                 self.dir2jamfile[dir] = jamfile
             jamfile_glob = jamfile
 
@@ -286,8 +286,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)
+        jamfile_to_load = boost.build.util.path.glob([dir], self.JAMROOT)
         if not jamfile_to_load:
             jamfile_to_load = self.find_jamfile(dir)
         else:
@@ -311,7 +310,7 @@
         # loaded the current Jamfile with use-project. Do a final check to make
         # sure it's not loaded already.
         if not jamfile_module in self.jamfile_modules:
-            self.jamfile_modules[jamfile_module] = 1
+            self.jamfile_modules[jamfile_module] = True
 
             # FIXME:
             # mark-as-user $(jamfile-module) ;
@@ -395,16 +394,16 @@
         else:
             attributes.set("source-location", "", exact=1)
 
-        attributes.set("requirements", property_set.empty(), exact=1)
-        attributes.set("usage-requirements", property_set.empty(), exact=1)
-        attributes.set("default-build", [], exact=1)
-        attributes.set("projects-to-build", [], exact=1)
-        attributes.set("project-root", None, exact=1)
-        attributes.set("build-dir", None, exact=1)
+        attributes.set("requirements", property_set.empty(), exact=True)
+        attributes.set("usage-requirements", property_set.empty(), exact=True)
+        attributes.set("default-build", [], exact=True)
+        attributes.set("projects-to-build", [], exact=True)
+        attributes.set("project-root", None, exact=True)
+        attributes.set("build-dir", None, exact=True)
         
         self.project_rules_.init_project(module_name)
 
-        jamroot = 0
+        jamroot = False
 
         parent_module = None;
         if module_name == "site-config":
@@ -422,7 +421,7 @@
             # If it's jamroot, inherit from user-config.
             if location:
                 parent_module = "user-config" ;                
-                jamroot = 1 ;
+                jamroot = True ;
                 
         if parent_module:
             self.inherit_attributes(module_name, parent_module)
@@ -461,9 +460,9 @@
         #                                 [ path.make [ modules.binding $(parent-module) ] ] ] ;
         #    }
         
-        attributes.set("project-root", pattributes.get("project-root"), exact=1)
-        attributes.set("default-build", pattributes.get("default-build"), exact=1)
-        attributes.set("requirements", pattributes.get("requirements"), exact=1)
+        attributes.set("project-root", pattributes.get("project-root"), exact=True)
+        attributes.set("default-build", pattributes.get("default-build"), exact=True)
+        attributes.set("requirements", pattributes.get("requirements"), exact=True)
         attributes.set("usage-requirements",
                        pattributes.get("usage-requirements"), exact=1)
 
Modified: branches/build/python_port/python/boost/build/util/path.py
==============================================================================
--- branches/build/python_port/python/boost/build/util/path.py	(original)
+++ branches/build/python_port/python/boost/build/util/path.py	2008-07-23 05:57:41 EDT (Wed, 23 Jul 2008)
@@ -835,8 +835,14 @@
         [ glob . : *.cpp ] 
         [ glob . : */build/Jamfile ]
     """
+
+    assert(isinstance(patterns, list))
+    assert(isinstance(dirs, list))
+
     if not exclude_patterns:
         exclude_patterns = []
+    else:
+       assert(isinstance(exclude_patterns, list))
 
     real_patterns = [os.path.join(d, p) for p in patterns for d in dirs]    
     real_exclude_patterns = [os.path.join(d, p) for p in exclude_patterns
@@ -867,14 +873,25 @@
     return result
 
 def glob_in_parents(dir, patterns, upper_limit=None):
+    """Recursive version of GLOB which globs upward.
+    FixMe: This is not an optimal solution"""    
+    
+    assert(isinstance(dir, str))
+    assert(isinstance(patterns, list))
+
     result = []
-    absolute_dir = os.path.join(os.getcwd(), dir)
 
+    # first, go up one directory
+    absolute_dir = os.path.join(os.path.split(os.getcwd())[0], dir)
     while absolute_dir:
-        result = glob(absolute_dir, patterns)
+        result = glob([absolute_dir], patterns)
         if result:
             break
-        absolute_dir = os.path.dirname(absolute_dir)
+        new_dir = os.path.join(os.path.split(absolute_dir)[0], dir)        
+        # If we can not get up, exit with empty result
+        if new_dir == absolute_dir:
+            break
+        absolute_dir = new_dir
 
     return result