Show More
@@ -1,48 +1,53 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """ Imports and provides the "correct" version of readline for the platform. |
|
2 | """ Imports and provides the "correct" version of readline for the platform. | |
3 |
|
3 | |||
4 | Readline is used throughout IPython as "import IPython.rlineimpl as readline. |
|
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 boolean |
|
6 | In addition to normal readline stuff, this module provides have_readline boolean | |
7 | and _outputfile variable used in genutils. |
|
7 | and _outputfile variable used in genutils. | |
8 |
|
8 | |||
9 | $Id: Magic.py 1096 2006-01-28 20:08:02Z vivainio $""" |
|
9 | $Id: Magic.py 1096 2006-01-28 20:08:02Z vivainio $""" | |
10 |
|
10 | |||
11 |
|
11 | |||
12 | import sys |
|
12 | import sys | |
13 |
|
13 | |||
14 | have_readline = False |
|
14 | have_readline = False | |
15 |
|
15 | |||
16 | if sys.platform == 'win32': |
|
16 | if sys.platform == 'win32': | |
17 | try: |
|
17 | try: | |
18 |
|
|
18 | import pyreadline.rlmain | |
|
19 | #add config for inputrcpath here: | |||
|
20 | #pyreadline.rlmain.config_path="c:/python/test_config.ini" | |||
|
21 | from readline import * | |||
19 | print "Using the new pyreadline (thanks for participating in the testing!)" |
|
22 | print "Using the new pyreadline (thanks for participating in the testing!)" | |
|
23 | ||||
20 | have_readline = True |
|
24 | have_readline = True | |
21 | import pyreadline as _rl |
|
25 | ||
|
26 | import readline as _rl | |||
22 | except ImportError: |
|
27 | except ImportError: | |
23 | print "IPython team recommends the new pyreadline for Windows use, it wasn't found." |
|
28 | print "IPython team recommends the new pyreadline for Windows use, it wasn't found." | |
24 | print "It's superior especially with non-US keyboard layouts." |
|
29 | print "It's superior especially with non-US keyboard layouts." | |
25 | print "Try installing it with 'easy_install pyreadline (ctypes is required) or" |
|
30 | print "Try installing it with 'easy_install pyreadline (ctypes is required) or" | |
26 | print "svn co http://ipython.scipy.org/svn/ipython/pyreadline/trunk pyreadline" |
|
31 | print "svn co http://ipython.scipy.org/svn/ipython/pyreadline/trunk pyreadline" | |
27 | print "Trying 'old' windows readline." |
|
32 | print "Trying 'old' windows readline." | |
28 |
|
33 | |||
29 | try: |
|
34 | try: | |
30 | from readline import * |
|
35 | from readline import * | |
31 | import readline as _rl |
|
36 | import readline as _rl | |
32 | have_readline = True |
|
37 | have_readline = True | |
33 | except ImportError: |
|
38 | except ImportError: | |
34 | pass |
|
39 | pass | |
35 |
|
40 | |||
36 | if have_readline: |
|
41 | if have_readline: | |
37 | try: |
|
42 | try: | |
38 | _outputfile=_rl.GetOutputFile() |
|
43 | _outputfile=_rl.GetOutputFile() | |
39 | except NameError: |
|
44 | except NameError: | |
40 | print "Failed GetOutputFile" |
|
45 | print "Failed GetOutputFile" | |
41 | have_readline = False |
|
46 | have_readline = False | |
42 |
|
47 | |||
43 | else: |
|
48 | else: | |
44 | try: |
|
49 | try: | |
45 | from readline import * |
|
50 | from readline import * | |
46 | have_readline = True |
|
51 | have_readline = True | |
47 | except ImportError: |
|
52 | except ImportError: | |
48 | pass |
|
53 | pass |
General Comments 0
You need to be logged in to leave comments.
Login now