From 412e04144b3ce118f450e250134d66724a68ce04 Mon Sep 17 00:00:00 2001 From: Dirk Baechle Date: Wed, 22 May 2013 22:47:29 +0200 Subject: - fixed bootstrap.py, such that it can be called from an arbitrary working directory again - fixed indentation in SConsDoc.py --- bin/SConsDoc.py | 2 +- bootstrap.py | 31 +++++++------------------------ 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/bin/SConsDoc.py b/bin/SConsDoc.py index c9d1e6e..dc9d161 100644 --- a/bin/SConsDoc.py +++ b/bin/SConsDoc.py @@ -331,7 +331,7 @@ if not has_libxml2: # Use lxml xmlschema = etree.XMLSchema(xmlschema_context) try: - doc = etree.parse(fpath) + doc = etree.parse(fpath) except Exception, e: print "ERROR: %s fails to parse:"%fpath print e diff --git a/bootstrap.py b/bootstrap.py index 78a85b5..1f80fb2 100755 --- a/bootstrap.py +++ b/bootstrap.py @@ -80,9 +80,7 @@ def parseManifestLines(basedir, lines): comment lines, starting with a '#'. """ sources = [] - oldwd = os.path.abspath(os.getcwd()) basewd = os.path.abspath(basedir) - os.chdir(basedir) for l in lines: if l.startswith('#'): # Skip comments @@ -90,33 +88,18 @@ def parseManifestLines(basedir, lines): l = l.rstrip('\n') if l.endswith('**'): # Glob all files recursively - globwd, tail = os.path.split(l) - if globwd: - os.chdir(globwd) - for path, dirs, files in os.walk('.'): + globwd = os.path.dirname(os.path.join(basewd, l)) + for path, dirs, files in os.walk(globwd): for f in files: - if globwd: - fpath = os.path.join(globwd, path, f) - else: - fpath = os.path.join(path, f) - sources.append(os.path.normpath(fpath)) - if globwd: - os.chdir(basewd) + fpath = os.path.join(globwd, path, f) + sources.append(os.path.relpath(fpath, basewd)) elif '*' in l: # Glob file pattern - globwd, tail = os.path.split(l) - if globwd: - os.chdir(globwd) - files = glob.glob(tail) - for f in files: - fpath = os.path.join(globwd, f) - sources.append(os.path.normpath(fpath)) - os.chdir(basewd) - else: - sources.extend(glob.glob(tail)) + files = glob.glob(os.path.join(basewd, l)) + for f in files: + sources.append(os.path.relpath(f, basewd)) else: sources.append(l) - os.chdir(oldwd) return sources -- cgit v0.12