ref: 23268279f2e36ead00de93724e5ac5d8dba6194f
parent: 120ba9664992cada4781e4d524304e4499e9083f
author: yenatch <[email protected]>
date: Sat Dec 7 14:58:30 EST 2013
prequeue: less wasteful stdout rerouting
--- a/preprocessor.py
+++ b/preprocessor.py
@@ -279,7 +279,9 @@
def main():
processor = setup_processor()
- processor.preprocess()
+ output = processor.preprocess()
+ processor.update_globals()
+ return output
if __name__ == '__main__':
main()
--- a/prequeue.py
+++ b/prequeue.py
@@ -13,17 +13,20 @@
def main():
processor = preprocessor.setup_processor()
+ stdin = sys.stdin
+ stdout = sys.stdout
+
for source in sys.argv[1:]:
dest = os.path.splitext(source)[0] + '.tx'
-
- stdout = sys.stdout
-
sys.stdin = open(source, 'r')
sys.stdout = open(dest, 'w')
-
processor.preprocess()
- sys.stdout = stdout
+ processor.update_globals()
+
+ sys.stdin = stdin
+ sys.stdout = stdout
+
if __name__ == '__main__':
main()