summaryrefslogtreecommitdiff
path: root/bootstrap.py
diff options
context:
space:
mode:
authorDirk Baechle <dl9obn@darc.de>2013-05-22 22:47:29 +0200
committerDirk Baechle <dl9obn@darc.de>2013-05-22 22:47:29 +0200
commitdabd53ff2c940d1d184963925a52885407dd4a41 (patch)
treed9b3360310a18f045ae12b4380bf86cea15cc2d9 /bootstrap.py
parentcc7ac69ca8331dd77fef8ac334bed0c1ad42e4a2 (diff)
downloadscons-dabd53ff2c940d1d184963925a52885407dd4a41.tar.gz
- fixed bootstrap.py, such that it can be called from an arbitrary working directory again
- fixed indentation in SConsDoc.py
Diffstat (limited to 'bootstrap.py')
-rwxr-xr-xbootstrap.py31
1 files changed, 7 insertions, 24 deletions
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