diff --git a/hy/cmdline.py b/hy/cmdline.py index fb58539..c88ec32 100644 --- a/hy/cmdline.py +++ b/hy/cmdline.py @@ -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) diff --git a/hy/core/language.hy b/hy/core/language.hy index a939edc..91ecb7b 100644 --- a/hy/core/language.hy +++ b/hy/core/language.hy @@ -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." diff --git a/setup.py b/setup.py index f0445bd..72ee75e 100755 --- a/setup.py +++ b/setup.py @@ -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') diff --git a/tests/native_tests/native_macros.hy b/tests/native_tests/native_macros.hy index d3efcb6..1ef274d 100644 --- a/tests/native_tests/native_macros.hy +++ b/tests/native_tests/native_macros.hy @@ -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 diff --git a/tests/test_bin.py b/tests/test_bin.py index 0b2a0ad..3b28e0d 100644 --- a/tests/test_bin.py +++ b/tests/test_bin.py @@ -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():