Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: tools/BUILD_simulator.py

Issue 1298813002: Clean up BUILD_simulator.py (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698