Commit Graph

62 Commits

Author SHA1 Message Date
Berker Peksag
cdea12b276 Make hy2py public. 2014-04-30 01:51:21 +03:00
Berker Peksag
612d3ae457 Fix output of hy2py on Python 3.
Closes #535.
2014-03-18 10:08:20 +02:00
Gergely Nagy
a619295dd7
bin/hy2py: Add a bunch of command-line options
The hy2py tool has been very useful for me, but most of the time, it's
only a part of its output that one is interested in. The whole output,
with source code, AST and python code together is one big monstrosity.
So instead of printing all that, lets have a few handy command-line
options to control which part gets printed.

By default, only the generated python source is, as that's what the name
of the tool implies.

Also, don't run it. That's what hy is for.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2014-01-14 09:17:56 +01:00
Paul Tagliamonte
c5c36e1022 Merge branch 'master' into paultag/bugfix/python3.4
Conflicts:
	bin/hy2py
2014-01-03 19:57:05 -05:00
Nicolas Dandrimont
9a128edcb2 Pretty print the AST in hy2py 2014-01-03 17:18:33 +01:00
Nicolas Dandrimont
f452558f5e Force output encoding of hy2py as utf-8
Fixes hy2py in py34
2014-01-01 22:12:50 -05:00
Bob Tolbert
df7bb1d29a Provide bin scripts for both Windows and *nix
Summary: This update does away with the scripts in bin and changes
setup.py to use entry_points in cmdline.py for the scripts 'hy' and
'hyc'.

This fixes installing and running on Windows.

The tests are updated to run the 'hy' script produced by setup.py
and not from bin/hy. This is more correct and makes the tox tests
run on both Window and *nix.

For running hy or nosetests directly in the source tree, you do have
to run 'python setup.py develop' first. But since tox runs and builds
dists, all tox tests pass on all platforms.

Also, since there is no built-in readline on Windows, the setup.py
only on Windows requires 'pyreadline' as a replacement.

Switched from optparse to argparse in cmdline.py

Instead of trying to manually separate args meant for
hy from args meant for a hy script, this switches from
optparse to argparse for the CLI.

argparse automatically peels out args meant for hy and leaves
the rest, including the user hy script in options.args.

This fixes the issue @paultag found running "hy foo" where
foo is not a real file. Also added a test that makes sure
trying to run a non-existent script exits instead of dropping
the user into the REPL.

Added argparse as setup.py resource (and removed from tox.ini) as well as removed uses of deprecated setf
2013-07-14 09:06:42 -06:00
Morten Linderud
42468051f5 Builtins fix for 2 and 3, tests aswell 2013-06-25 17:02:02 +02:00
Paul Tagliamonte
e1091afe94 fix up the quit message to be wiseass like python's 2013-06-22 22:39:05 -04:00
Morten Linderud
25a81b4ef4 Fixed exit and quit with HyQuitter 2013-06-23 04:15:32 +02:00
Konrad Hinsen
269da19d76 Make macros module-specific.
A macro is available in the module where it was defined and
in any module that does a require of the defining module.
Only macros defined in hy.core are globally available.
Fixes #181
2013-05-16 15:34:14 +02:00
Paul Tagliamonte
9776b7133e update readme 2013-04-27 20:52:37 -04:00
Will Kahn-Greene
4e59af0033 Redid command line code
This supports:

* -h, --help
* --version
* -c cmd
* -i cmd
* file
* -

Plus it's easy to add new options.

Also, now we can do ridiculous things like have projects where
the installation is:

$ curl -s http://example.com/install-hypster-program | hy
2013-04-23 22:02:41 -04:00
Paul Tagliamonte
6f7f402c19 Merge branch 'master' into pr/140
Conflicts:
	hy/compiler.py
	tests/native_tests/language.hy
2013-04-21 12:29:09 -04:00
Paul Tagliamonte
feabe3ff4a Merge branch 'master' into pr/125 2013-04-21 10:58:08 -04:00
Julien Danjou
3226ecc33f Fix bin/hy and add a unit test
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-20 22:28:45 +02:00
Gergely Nagy
494bf0e8ad Remove the import-as and import-from builtins
The new and improved (import) can handle all cases import-as and
import-from did, so drop the latter two from the language. To do this,
the import builtin had to be changed a little: if there's a single
import statement to return, return it as-is, otherwise return a list of
imports.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2013-04-20 16:06:32 +02:00
James King
047956c59b Clean up based on review 2013-04-19 10:36:51 -04:00
James King
18ed72136f Merge branch 'master' into feature/lambda-list-keyword
Conflicts:
	hy/compiler.py
	hy/lex/states.py
	hy/util.py
	tests/compilers/test_ast.py
	tests/lex/test_lex.py
2013-04-18 15:17:30 -04:00
Paul R. Tagliamonte
a3c6f12b86 Screw it; buyer beware. 2013-04-12 23:08:22 -04:00
Konrad Hinsen
c30a116416 Add "from __future__ import division" to Python code generated by hy2py
This is mainly to make we don't forget this. The current state of hy2py
is more a proof-of-concept than a usable tool anyway.
2013-04-12 08:00:08 +02:00
Konrad Hinsen
0c56885d42 Use __future__.division for all Hy code
Fixes #106
Note: This is implemented by replacing all calls to Python's
builtin "compile" function by calls to hy.importer.compile_,
which adds the "future division" flag. Anyone using "compile"
in future work will have to remember this.
2013-04-12 05:23:25 +02:00
James King
484a96abae WIP - Move _parse_lamba_list to the functiondef 2013-04-10 16:52:28 -04:00
James King
7417789ce0 WIP - Adding Call support and FuncionDef
The test is still broken, there are print statements... this is an
ongoing WIP and will get squashed before submitted the PR.
2013-04-09 15:23:50 -04:00
Konrad Hinsen
8212ed5794 Do not quit hy if hy.core.process raises an exception 2013-04-09 19:50:49 +02:00
Julien Danjou
bcdf31e287 Do not quit hy if compile error occurs
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-03 11:44:28 +02:00
James King
aa3a4e54cd Minor py3.3 fixes 2013-04-02 14:38:21 -04:00
Paul R. Tagliamonte
de7a450d92 Adding in a completer. 2013-03-28 21:42:40 -04:00
Paul R. Tagliamonte
4c50424a66 Don't tab complete yet 2013-03-27 22:20:16 -04:00
Paul Tagliamonte
3d8b436c33 bleh, undoing. We'll have to do something special 2013-03-26 19:17:42 -04:00
Thom Neale
2d781ac631 Import rlcompleter for tab completion 2013-03-26 10:35:12 -03:00
Paul R. Tagliamonte
c7219e3522 Adding in more macrofun 2013-03-25 20:54:36 -04:00
Paul R. Tagliamonte
0558dadf69 hy repl things 2013-03-25 20:31:58 -04:00
Paul Tagliamonte
eb356cb12b Adding in some readline cuteness 2013-03-25 19:10:59 -04:00
Paul Tagliamonte
980cd493e0 futzing with a few things 2013-03-21 19:27:34 -04:00
Paul R. Tagliamonte
e2ff4a447f Adding in another trivial example 2013-03-15 13:00:28 -04:00
Paul R. Tagliamonte
723cf75f73 respacing 2013-03-15 12:38:44 -04:00
Paul R. Tagliamonte
7741b2e1dd Adding in #! as a comment 2013-03-14 21:03:33 -04:00
Paul R. Tagliamonte
4172ca2db7 Fixing up the REPL a skitchbit. 2013-03-14 19:44:33 -04:00
Paul R. Tagliamonte
ff37c47c43 Adding in a Hy REPL 2013-03-14 17:36:38 -04:00
Paul R. Tagliamonte
9b32506854 Fixing catch a bit to now force a param. 2013-03-14 09:21:03 -04:00
Paul R. Tagliamonte
10b887bbc8 Moving to astor.codegen 2013-03-11 21:12:38 -04:00
Paul R. Tagliamonte
05893569d7 thinking things out. 2013-03-08 23:41:04 -05:00
Paul Tagliamonte
67b803b99a Breaking things to start again. 2013-03-08 18:18:43 -05:00
Paul R. Tagliamonte
e6d094fd40 Add in for loops. 2013-03-06 22:09:13 -05:00
Paul R. Tagliamonte
37a11247c7 Tweaking the AST. 2013-03-05 21:42:54 -05:00
Paul Tagliamonte
12d7fc6726 trainhacking++ 2013-03-05 18:16:04 -05:00
Paul R. Tagliamonte
ef9007c229 Futzing about. 2013-03-03 16:26:17 -05:00
Paul R. Tagliamonte
95657f64bc bleh 2013-03-03 00:08:47 -05:00
Paul R. Tagliamonte
dc4bb92725 Adding in some slight tweaks. 2013-03-02 21:30:37 -05:00