hy/bin/hython

34 lines
832 B
Plaintext
Raw Normal View History

2012-12-19 01:02:50 +01:00
#!/usr/bin/env python
2012-12-19 01:24:10 +01:00
# -*- coding: utf-8 -*-
2012-12-19 01:02:50 +01:00
from hy.lang.importer import _hy_import_file
2012-12-19 01:24:10 +01:00
from code import InteractiveConsole
2012-12-29 16:56:45 +01:00
import traceback
2012-12-19 01:02:50 +01:00
import sys
2012-12-29 16:56:45 +01:00
2012-12-28 23:57:16 +01:00
try:
import readline
except ImportError:
pass
2012-12-19 01:02:50 +01:00
2012-12-19 01:24:10 +01:00
if len(sys.argv) > 1:
2012-12-19 05:44:44 +01:00
sys.argv = sys.argv[1:]
2012-12-29 16:56:45 +01:00
try:
mod = _hy_import_file(sys.argv[0], '__main__')
except Exception as e:
exc_type, exc_value, exc_traceback = sys.exc_info()
ntb = exc_traceback.tb_next.tb_next.tb_next # YUCK.
raise type(e), None, ntb
2012-12-19 01:24:10 +01:00
sys.exit(0)
InteractiveConsole().interact(banner="""
"Really, if the lower orders dont set us a good example, what on
earth is the use of them?"
-- Oscar Wilde (The Importance of Being Earnest)
The hython bits have been loaded -- magically, .hy
files are importable!""")