[pypy-svn] r13378 - pypy/dist/pypy/bin
adim at codespeak.net
adim at codespeak.net
Tue Jun 14 12:11:47 CEST 2005
Author: adim
Date: Tue Jun 14 12:11:46 2005
New Revision: 13378
Modified:
pypy/dist/pypy/bin/translator.py
Log:
added readline / history / tab support for translator shell
(fed up with always retyping the same things ... )
History file is $HOME/.pypytrhist
Modified: pypy/dist/pypy/bin/translator.py
==============================================================================
--- pypy/dist/pypy/bin/translator.py (original)
+++ pypy/dist/pypy/bin/translator.py Tue Jun 14 12:11:46 2005
@@ -209,11 +209,28 @@
print 'Backend', options.backend, 'compiled code returns (%s)' % backendReturn, '[use -t to perform a sanity check]'
+def setup_readline():
+ import readline
+ import rlcompleter
+ readline.parse_and_bind("tab: complete")
+ import os
+ histfile = os.path.join(os.environ["HOME"], ".pypytrhist")
+ try:
+ readline.read_history_file(histfile)
+ except IOError:
+ pass
+ import atexit
+ atexit.register(readline.write_history_file, histfile)
+
if __name__ == '__main__':
from pypy.translator.test import snippet as test
from pypy.translator.llvm.test import llvmsnippet as test2
from pypy.rpython.rtyper import RPythonTyper
+ try:
+ setup_readline()
+ except ImportError, err:
+ print "Disabling readline support (%s)" % err
if (os.getcwd() not in sys.path and
os.path.curdir not in sys.path):
sys.path.insert(0, os.getcwd())
More information about the Pypy-commit
mailing list