Merge pull request #537 from berkerpeksag/issue-535

Fix output of hy2py on Python 3.
This commit is contained in:
Morten Linderud 2014-03-29 20:36:40 +01:00
commit 2fda9b0c79

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python
from __future__ import print_function
from hy.importer import (import_file_to_ast, import_file_to_hst)
from hy.importer import import_file_to_ast, import_file_to_hst
import argparse
import sys
@ -25,15 +26,15 @@ options = parser.parse_args(sys.argv[1:])
if options.with_source:
hst = import_file_to_hst(options.args[0])
print(str(hst).encode("utf-8"))
print(hst)
print()
print()
_ast = import_file_to_ast(options.args[0], module_name)
if options.with_ast:
print(astor.dump(_ast).encode("utf-8"))
print(astor.dump(_ast))
print()
print()
if not options.without_python:
print(astor.codegen.to_source(_ast).encode("utf-8"))
print(astor.codegen.to_source(_ast))