update astor to 0.6

This commit is contained in:
gilch 2017-10-31 14:13:41 -06:00
parent 5975ad344d
commit 6bb997dbea
5 changed files with 15 additions and 15 deletions

View File

@ -11,7 +11,7 @@ import sys
import os
import importlib
import astor.codegen
import astor.code_gen
import hy
@ -413,17 +413,17 @@ def hy2py_main():
else pretty_error(import_buffer_to_ast, stdin_text, module_name))
if options.with_ast:
if PY3 and platform.system() == "Windows":
_print_for_windows(astor.dump(_ast))
_print_for_windows(astor.dump_tree(_ast))
else:
print(astor.dump(_ast))
print(astor.dump_tree(_ast))
print()
print()
if not options.without_python:
if PY3 and platform.system() == "Windows":
_print_for_windows(astor.codegen.to_source(_ast))
_print_for_windows(astor.code_gen.to_source(_ast))
else:
print(astor.codegen.to_source(_ast))
print(astor.code_gen.to_source(_ast))
parser.exit(0)

View File

@ -79,9 +79,9 @@ If the second argument `codegen` is true, generate python code instead."
(spoof-positions tree)
(setv compiled (hy.compiler.hy-compile tree (calling-module-name)))
((if codegen
astor.codegen.to_source
astor.dump)
compiled))
astor.code-gen.to-source
astor.dump-tree)
compiled))
(defn distinct [coll]
"Return a generator from the original collection `coll` with no duplicates."

View File

@ -30,7 +30,7 @@ class Install(install):
"." + filename[:-len(".hy")])
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':
install_requires.append('pyreadline>=2.1')

View File

@ -144,7 +144,7 @@
(defn test-gensym-in-macros []
(import ast)
(import [astor.codegen [to_source]])
(import [astor.code-gen [to-source]])
(import [hy.importer [import_buffer_to_ast]])
(setv macro1 "(defmacro nif [expr pos zero neg]
(setv g (gensym))
@ -170,7 +170,7 @@
(defn test-with-gensym []
(import ast)
(import [astor.codegen [to_source]])
(import [astor.code-gen [to-source]])
(import [hy.importer [import_buffer_to_ast]])
(setv macro1 "(defmacro nif [expr pos zero neg]
(with-gensyms [a]
@ -194,7 +194,7 @@
(defn test-defmacro-g! []
(import ast)
(import [astor.codegen [to_source]])
(import [astor.code-gen [to-source]])
(import [hy.importer [import_buffer_to_ast]])
(setv macro1 "(defmacro/g! nif [expr pos zero neg]
`(do
@ -223,7 +223,7 @@
(defn test-defmacro! []
;; defmacro! must do everything defmacro/g! can
(import ast)
(import [astor.codegen [to_source]])
(import [astor.code-gen [to-source]])
(import [hy.importer [import_buffer_to_ast]])
(setv macro1 "(defmacro! nif [expr pos zero neg]
`(do

View File

@ -72,7 +72,7 @@ def test_bin_hy_stdin():
output, _ = run_cmd("hy --spy", '(koan)')
assert "monk" in output
assert "\\n Ummon" in output
assert "\n Ummon" in output
# --spy should work even when an exception is thrown
output, _ = run_cmd("hy --spy", '(foof)')
@ -195,7 +195,7 @@ def test_bin_hy_icmd_file():
def test_bin_hy_icmd_and_spy():
output, _ = run_cmd("hy -i \"(+ [] [])\" --spy", "(+ 1 1)")
assert "([] + [])" in output
assert "[] + []" in output
def test_bin_hy_missing_file():