update astor to 0.6
This commit is contained in:
parent
5975ad344d
commit
6bb997dbea
@ -11,7 +11,7 @@ import sys
|
|||||||
import os
|
import os
|
||||||
import importlib
|
import importlib
|
||||||
|
|
||||||
import astor.codegen
|
import astor.code_gen
|
||||||
|
|
||||||
import hy
|
import hy
|
||||||
|
|
||||||
@ -413,17 +413,17 @@ def hy2py_main():
|
|||||||
else pretty_error(import_buffer_to_ast, stdin_text, module_name))
|
else pretty_error(import_buffer_to_ast, stdin_text, module_name))
|
||||||
if options.with_ast:
|
if options.with_ast:
|
||||||
if PY3 and platform.system() == "Windows":
|
if PY3 and platform.system() == "Windows":
|
||||||
_print_for_windows(astor.dump(_ast))
|
_print_for_windows(astor.dump_tree(_ast))
|
||||||
else:
|
else:
|
||||||
print(astor.dump(_ast))
|
print(astor.dump_tree(_ast))
|
||||||
print()
|
print()
|
||||||
print()
|
print()
|
||||||
|
|
||||||
if not options.without_python:
|
if not options.without_python:
|
||||||
if PY3 and platform.system() == "Windows":
|
if PY3 and platform.system() == "Windows":
|
||||||
_print_for_windows(astor.codegen.to_source(_ast))
|
_print_for_windows(astor.code_gen.to_source(_ast))
|
||||||
else:
|
else:
|
||||||
print(astor.codegen.to_source(_ast))
|
print(astor.code_gen.to_source(_ast))
|
||||||
|
|
||||||
parser.exit(0)
|
parser.exit(0)
|
||||||
|
|
||||||
|
@ -79,8 +79,8 @@ If the second argument `codegen` is true, generate python code instead."
|
|||||||
(spoof-positions tree)
|
(spoof-positions tree)
|
||||||
(setv compiled (hy.compiler.hy-compile tree (calling-module-name)))
|
(setv compiled (hy.compiler.hy-compile tree (calling-module-name)))
|
||||||
((if codegen
|
((if codegen
|
||||||
astor.codegen.to_source
|
astor.code-gen.to-source
|
||||||
astor.dump)
|
astor.dump-tree)
|
||||||
compiled))
|
compiled))
|
||||||
|
|
||||||
(defn distinct [coll]
|
(defn distinct [coll]
|
||||||
|
2
setup.py
2
setup.py
@ -30,7 +30,7 @@ class Install(install):
|
|||||||
"." + filename[:-len(".hy")])
|
"." + filename[:-len(".hy")])
|
||||||
install.run(self)
|
install.run(self)
|
||||||
|
|
||||||
install_requires = ['rply>=0.7.5', 'astor>=0.5', 'clint>=0.4']
|
install_requires = ['rply>=0.7.5', 'astor>=0.6', 'clint>=0.4']
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
install_requires.append('pyreadline>=2.1')
|
install_requires.append('pyreadline>=2.1')
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@
|
|||||||
|
|
||||||
(defn test-gensym-in-macros []
|
(defn test-gensym-in-macros []
|
||||||
(import ast)
|
(import ast)
|
||||||
(import [astor.codegen [to_source]])
|
(import [astor.code-gen [to-source]])
|
||||||
(import [hy.importer [import_buffer_to_ast]])
|
(import [hy.importer [import_buffer_to_ast]])
|
||||||
(setv macro1 "(defmacro nif [expr pos zero neg]
|
(setv macro1 "(defmacro nif [expr pos zero neg]
|
||||||
(setv g (gensym))
|
(setv g (gensym))
|
||||||
@ -170,7 +170,7 @@
|
|||||||
|
|
||||||
(defn test-with-gensym []
|
(defn test-with-gensym []
|
||||||
(import ast)
|
(import ast)
|
||||||
(import [astor.codegen [to_source]])
|
(import [astor.code-gen [to-source]])
|
||||||
(import [hy.importer [import_buffer_to_ast]])
|
(import [hy.importer [import_buffer_to_ast]])
|
||||||
(setv macro1 "(defmacro nif [expr pos zero neg]
|
(setv macro1 "(defmacro nif [expr pos zero neg]
|
||||||
(with-gensyms [a]
|
(with-gensyms [a]
|
||||||
@ -194,7 +194,7 @@
|
|||||||
|
|
||||||
(defn test-defmacro-g! []
|
(defn test-defmacro-g! []
|
||||||
(import ast)
|
(import ast)
|
||||||
(import [astor.codegen [to_source]])
|
(import [astor.code-gen [to-source]])
|
||||||
(import [hy.importer [import_buffer_to_ast]])
|
(import [hy.importer [import_buffer_to_ast]])
|
||||||
(setv macro1 "(defmacro/g! nif [expr pos zero neg]
|
(setv macro1 "(defmacro/g! nif [expr pos zero neg]
|
||||||
`(do
|
`(do
|
||||||
@ -223,7 +223,7 @@
|
|||||||
(defn test-defmacro! []
|
(defn test-defmacro! []
|
||||||
;; defmacro! must do everything defmacro/g! can
|
;; defmacro! must do everything defmacro/g! can
|
||||||
(import ast)
|
(import ast)
|
||||||
(import [astor.codegen [to_source]])
|
(import [astor.code-gen [to-source]])
|
||||||
(import [hy.importer [import_buffer_to_ast]])
|
(import [hy.importer [import_buffer_to_ast]])
|
||||||
(setv macro1 "(defmacro! nif [expr pos zero neg]
|
(setv macro1 "(defmacro! nif [expr pos zero neg]
|
||||||
`(do
|
`(do
|
||||||
|
@ -72,7 +72,7 @@ def test_bin_hy_stdin():
|
|||||||
|
|
||||||
output, _ = run_cmd("hy --spy", '(koan)')
|
output, _ = run_cmd("hy --spy", '(koan)')
|
||||||
assert "monk" in output
|
assert "monk" in output
|
||||||
assert "\\n Ummon" in output
|
assert "\n Ummon" in output
|
||||||
|
|
||||||
# --spy should work even when an exception is thrown
|
# --spy should work even when an exception is thrown
|
||||||
output, _ = run_cmd("hy --spy", '(foof)')
|
output, _ = run_cmd("hy --spy", '(foof)')
|
||||||
@ -195,7 +195,7 @@ def test_bin_hy_icmd_file():
|
|||||||
|
|
||||||
def test_bin_hy_icmd_and_spy():
|
def test_bin_hy_icmd_and_spy():
|
||||||
output, _ = run_cmd("hy -i \"(+ [] [])\" --spy", "(+ 1 1)")
|
output, _ = run_cmd("hy -i \"(+ [] [])\" --spy", "(+ 1 1)")
|
||||||
assert "([] + [])" in output
|
assert "[] + []" in output
|
||||||
|
|
||||||
|
|
||||||
def test_bin_hy_missing_file():
|
def test_bin_hy_missing_file():
|
||||||
|
Loading…
Reference in New Issue
Block a user