[pypy-svn] r40054 - pypy/dist/pypy/lang/js
santagada at codespeak.net
santagada at codespeak.net
Thu Mar 8 02:26:59 CET 2007
Author: santagada
Date: Thu Mar 8 02:26:57 2007
New Revision: 40054
Modified:
pypy/dist/pypy/lang/js/jsparser.py
Log:
some cleanups
Modified: pypy/dist/pypy/lang/js/jsparser.py
==============================================================================
--- pypy/dist/pypy/lang/js/jsparser.py (original)
+++ pypy/dist/pypy/lang/js/jsparser.py Thu Mar 8 02:26:57 2007
@@ -21,6 +21,7 @@
jsdefspath = path.join(jsdir, "jsdefs.js")
jsparsepath = path.join(jsdir, "jsparse.js")
fname = path.join(path.dirname(__file__) ,"tobeparsed.js")
+command = 'js -f %s -f %s -f %s'%(jsdefspath, jsparsepath, fname)
def read_js_output(code_string):
tmp = []
@@ -41,14 +42,8 @@
print code_string
print "------ put:"
print stripped_code
- f_jsdefs = open_file_as_stream(jsdefspath)
- jsdefs = f_jsdefs.readall()
- f_jsdefs.close()
- f_jsparse = open_file_as_stream(jsparsepath)
- jsparse = f_jsparse.readall()
- f_jsparse.close()
f = open_file_as_stream(fname, 'w')
- f.write(jsdefs+jsparse+"print(parse('%s'));\n" % stripped_code)
+ f.write("print(parse('%s'));\n" % stripped_code)
f.close()
c2pread, c2pwrite = os.pipe()
if os.fork() == 0:
@@ -59,7 +54,7 @@
os.close(i)
except OSError:
pass
- cmd = ['/bin/sh', '-c', 'js -f '+fname]
+ cmd = ['/bin/sh', '-c', command]
os.execv(cmd[0], cmd)
os.close(c2pwrite)
f = fdopen_as_stream(c2pread, 'r', 0)
More information about the Pypy-commit
mailing list