dirkbaechle avatar dirkbaechle committed 114beb0

- fixed bootstrap.py, such that it can be called from an arbitrary working directory again
- fixed indentation in SConsDoc.py

Comments (0)

Files changed (2)

             # 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
         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
         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
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.