Permalink
Browse files

emscripten.py

  • Loading branch information...
1 parent dd766e9 commit a523ad539ccf91b7a162ac1ac18f9e1bf88f5147 alon@honor committed Sep 10, 2010
Showing with 30 additions and 463 deletions.
  1. +21 −0 emscripten.py
  2. +0 −443 patches/sauer
  3. +9 −19 tests/runner.py
  4. +0 −1 tests/settings.py
View
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+import os, sys, subprocess
+
+COMPILER = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'src', 'parser.js')
+
+def emscripten(filename, output_filename, js_engine):
+ cwd = os.getcwd()
+ os.chdir(os.path.dirname(COMPILER))
+ if output_filename is not None:
+ subprocess.Popen([js_engine] + [COMPILER], stdin=open(filename, 'r'), stdout=open(output_filename, 'w'), stderr=subprocess.STDOUT).communicate()[0]
+ else:
+ subprocess.Popen([js_engine] + [COMPILER], stdin=open(filename, 'r')).communicate()[0]
+ os.chdir(cwd)
+
+if __name__ == '__main__':
+ if sys.argv.__len__() != 3:
+ print '''\nEmscripten usage: emscripten.py INFILE PATH-TO-JS-ENGINE\n'''
+ else:
+ emscripten(sys.argv[1], None, sys.argv[2])
+
Oops, something went wrong.

0 comments on commit a523ad5

Please sign in to comment.