From dabd53ff2c940d1d184963925a52885407dd4a41 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 --- bootstrap.py | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) (limited to 'bootstrap.py') diff --git a/bootstrap.py b/bootstrap.py index 78a85b5f..1f80fb28 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 v1.2.1