Index: tools/BUILD_simulator.py |
diff --git a/tools/BUILD_simulator.py b/tools/BUILD_simulator.py |
old mode 100644 |
new mode 100755 |
index 65e6b7d11ed769ce5369baffb3dfee644a7390ba..cf3de1d63a327a5b55f66ac721e587037b79958c |
--- a/tools/BUILD_simulator.py |
+++ b/tools/BUILD_simulator.py |
@@ -10,14 +10,15 @@ |
# We start by adding some symbols to our namespace that BUILD.public calls. |
+from pprint import pprint |
+from glob import glob as python_glob |
+ |
# We don't really care about this, so just no-op it. |
def exports_files(files): |
pass |
# Simulates BUILD file glob(). |
def glob(include, exclude=()): |
- from glob import glob as python_glob |
- |
files = set() |
for pattern in include: |
files.update(python_glob(pattern)) |
@@ -28,15 +29,12 @@ def glob(include, exclude=()): |
# We've put enough into our environment now to treat BUILD.public as if it were |
# Python code. This pulls its variable definitions (SRCS, HDRS, DEFINES, etc.) |
mtklein
2015/08/17 22:40:34
Update all the comments when we're settled?
hal.canary
2015/08/18 15:14:23
Done.
|
# into our local namespace. |
-execfile('BUILD.public') |
+local_namespace = {} |
+execfile('BUILD.public', globals(), local_namespace) |
mtklein
2015/08/17 22:40:34
Let's do this:
from pprint import pprint
from glo
hal.canary
2015/08/18 15:14:23
global is a keyword. Otherwise, done.
|
-# Pretty-print every variable whose name is COMPLETELY_UPPERCASE, |
-# i.e. every variable from BUILD.public. This is obviously quite heuristic. |
-from pprint import pprint |
with open('tools/BUILD.public.expected', 'w') as out: |
print >>out, "This file is auto-generated by tools/BUILD_simulator.py." |
print >>out, "It expands BUILD.public to make it easy to see changes." |
- for name, value in sorted(locals().items()): |
- if name.isupper(): |
- print >>out, name, '= ', |
- pprint(value, out) |
+ for name, value in sorted(local_namespace.items()): |
+ print >>out, name, '= ', |
+ pprint(value, out) |