diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2008-03-31 04:28:40 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2008-03-31 04:28:40 (GMT) |
commit | 371d1747f9ba084c04f5252c6e04837b59753e7e (patch) | |
tree | 1a4a03f44f3b25106e803ecf08f0f358dd9f4f91 /Parser | |
parent | 105f3d4fdc7d7c7d9198ef4c9b2be8d5755584b4 (diff) | |
download | cpython-371d1747f9ba084c04f5252c6e04837b59753e7e.zip cpython-371d1747f9ba084c04f5252c6e04837b59753e7e.tar.gz cpython-371d1747f9ba084c04f5252c6e04837b59753e7e.tar.bz2 |
Use file.write instead of print to make it easier to merge with 3k.
Diffstat (limited to 'Parser')
-rwxr-xr-x | Parser/asdl_c.py | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index 7e12ea6..25ff424 100755 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -1106,7 +1106,7 @@ class ChainOfVisitors: v.visit(object) v.emit("", 0) -common_msg = "/* File automatically generated by %s. */\n" +common_msg = "/* File automatically generated by %s. */\n\n" c_file_msg = """ /* @@ -1116,6 +1116,7 @@ c_file_msg = """ The __version__ number is set to the revision number of the commit containing the grammar change. */ + """ def main(srcfile): @@ -1129,27 +1130,27 @@ def main(srcfile): if INC_DIR: p = "%s/%s-ast.h" % (INC_DIR, mod.name) f = open(p, "wb") - print >> f, auto_gen_msg - print >> f, '#include "asdl.h"\n' + f.write(auto_gen_msg) + f.write('#include "asdl.h"\n\n') c = ChainOfVisitors(TypeDefVisitor(f), StructVisitor(f), PrototypeVisitor(f), ) c.visit(mod) - print >>f, "PyObject* PyAST_mod2obj(mod_ty t);" - print >>f, "mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);" - print >>f, "int PyAST_Check(PyObject* obj);" + f.write("PyObject* PyAST_mod2obj(mod_ty t);\n") + f.write("mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);\n") + f.write("int PyAST_Check(PyObject* obj);\n") f.close() if SRC_DIR: p = os.path.join(SRC_DIR, str(mod.name) + "-ast.c") f = open(p, "wb") - print >> f, auto_gen_msg - print >> f, c_file_msg % parse_version(mod) - print >> f, '#include "Python.h"' - print >> f, '#include "%s-ast.h"' % mod.name - print >> f - print >>f, "static PyTypeObject AST_type;" + f.write(auto_gen_msg) + f.write(c_file_msg % parse_version(mod)) + f.write('#include "Python.h"\n') + f.write('#include "%s-ast.h"\n' % mod.name) + f.write('\n') + f.write("static PyTypeObject AST_type;\n") v = ChainOfVisitors( PyTypesDeclareVisitor(f), PyTypesVisitor(f), |