Show More
The requested changes are too big and content was truncated. Show full diff
@@ -1,54 +1,40 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 |
""" Imports and provides the |
|
|
2 | """ Imports and provides the 'correct' version of readline for the platform. | |
|
3 | 3 | |
|
4 |
Readline is used throughout IPython as |
|
|
4 | Readline is used throughout IPython as 'import IPython.rlineimpl as readline'. | |
|
5 | 5 | |
|
6 |
In addition to normal readline stuff, this module provides have_readline |
|
|
7 | and _outputfile variable used in genutils. | |
|
6 | In addition to normal readline stuff, this module provides have_readline | |
|
7 | boolean and _outputfile variable used in genutils. | |
|
8 | 8 | |
|
9 | 9 | $Id: Magic.py 1096 2006-01-28 20:08:02Z vivainio $""" |
|
10 | 10 | |
|
11 | ||
|
12 | 11 | import sys |
|
13 | 12 | |
|
14 | have_readline = False | |
|
15 | ||
|
16 | if sys.platform == 'win32': | |
|
17 | try: | |
|
18 | import pyreadline.rlmain | |
|
19 | #add config for inputrcpath here: | |
|
20 | #pyreadline.rlmain.config_path="c:/python/test_config.ini" | |
|
21 | from readline import * | |
|
22 | #print "Using the new pyreadline (thanks for participating in the testing!)" | |
|
23 | ||
|
24 | have_readline = True | |
|
25 | ||
|
26 | import readline as _rl | |
|
27 | except ImportError: | |
|
28 | #print "IPython team recommends the new pyreadline for Windows use, " | |
|
29 | #print "It's superior especially with non-US keyboard layouts." | |
|
30 | #print "Try installing it with 'easy_install pyreadline (ctypes is required) or" | |
|
31 | #print "svn co http://ipython.scipy.org/svn/ipython/pyreadline/trunk pyreadline" | |
|
32 | #print "Trying 'old' windows readline." | |
|
33 | #print "Using 'old' readline, you might want to try pyreadline:" | |
|
34 | #print "http://projects.scipy.org/ipython/ipython/wiki/PyReadline/Intro" | |
|
35 | 13 | try: |
|
36 | 14 |
|
|
37 | 15 |
|
|
38 | 16 |
|
|
39 | 17 |
|
|
40 | pass | |
|
18 | have_readline = False | |
|
41 | 19 | |
|
42 | if have_readline: | |
|
20 | if sys.platform == 'win32' and have_readline: | |
|
43 | 21 |
|
|
44 | 22 |
|
|
45 | 23 |
|
|
46 | 24 |
|
|
47 | 25 |
|
|
48 | 26 | |
|
49 | else: | |
|
27 | # the clear_history() function was only introduced in Python 2.4 and is | |
|
28 | # actually optional in the readline API, so we must explicitly check for its | |
|
29 | # existence. Some known platforms actually don't have it. This thread: | |
|
30 | # http://mail.python.org/pipermail/python-dev/2003-August/037845.html | |
|
31 | # has the original discussion. | |
|
32 | ||
|
33 | if have_readline: | |
|
34 | import readline | |
|
50 | 35 | try: |
|
51 |
|
|
|
52 | have_readline = True | |
|
53 | except ImportError: | |
|
54 | pass | |
|
36 | readline.clear_history | |
|
37 | except AttributeError: | |
|
38 | def clear_history(): pass | |
|
39 | readline.clear_history = clear_history | |
|
40 | del readline |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
General Comments 0
You need to be logged in to leave comments.
Login now