Boost logo

Boost-Commit :

From: juergen.hunold_at_[hidden]
Date: 2008-07-24 15:24:34


Author: jhunold
Date: 2008-07-24 15:24:34 EDT (Thu, 24 Jul 2008)
New Revision: 47769
URL: http://svn.boost.org/trac/boost/changeset/47769

Log:
Fix glob_in_parents

Text files modified:
   branches/build/python_port/python/boost/build/util/path.py | 18 +++++++++---------
   1 files changed, 9 insertions(+), 9 deletions(-)

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-24 15:24:34 EDT (Thu, 24 Jul 2008)
@@ -873,24 +873,24 @@
     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"""
+ """Recursive version of GLOB which glob sall parent directories
+ of dir until the first match is found. Returns an empty result if no match
+ is found"""
     
     assert(isinstance(dir, str))
     assert(isinstance(patterns, list))
 
     result = []
 
- # first, go up one directory
- absolute_dir = os.path.join(os.path.split(os.getcwd())[0], dir)
+ absolute_dir = os.path.join(os.getcwd(), dir)
+ absolute_dir = os.path.normpath(absolute_dir)
     while absolute_dir:
- result = glob([absolute_dir], patterns)
- if result:
- break
- new_dir = os.path.join(os.path.split(absolute_dir)[0], dir)
- # If we can not get up, exit with empty result
+ new_dir = os.path.split(absolute_dir)[0]
         if new_dir == absolute_dir:
             break
+ result = glob([new_dir], patterns)
+ if result:
+ break
         absolute_dir = new_dir
 
     return result


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