Commits

David Cournapeau committed 9988f3a

Add function to parse vcbat output into env var.

Comments (0)

Files changed (1)

src/engine/SCons/Tool/MSVCCommon.py

     output = stdout.decode("mbcs")
     return output
 
+_ENV_TO_T = {"include": "INCLUDE", "path": "Path",
+             "lib": "LIB", "libpath": "LIBPATH"}
+
+def parse_output(output, keep = ("include", "lib", "libpath", "path")):
+    dkeep = dict([(i, []) for i in keep])
+    dk = []
+    for i in keep:
+        dk.append(re.compile('%s=([\S\s]*)' % _ENV_TO_T[i]))
+
+    for i in output.split('\n'):
+        for j in range(len(dk)):
+            m = dk[j].match(i)
+            if m:
+                dkeep[keep[j]].append(m.groups(0))
+
+    ret = {}
+    for k in dkeep.keys():
+        ret[k.lower()] = dkeep[k]
+    return ret
+
 def generate(env):
     from logging import basicConfig, DEBUG
     basicConfig(level = DEBUG)
             try:
                 file = find_bat(v, flavor)
                 out = get_output(file)
+                print parse_output(out)
             except IOError:
                 pass
 
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.