1 | #!/usr/bin/env python
|
---|
2 | import os
|
---|
3 |
|
---|
4 | def main10():
|
---|
5 | from IPython.Shell import IPShellEmbed
|
---|
6 |
|
---|
7 | banner = welcome()
|
---|
8 | exit_msg = ''
|
---|
9 | args = ['-colors','Linux','-noconfirm_exit', '-readline',
|
---|
10 | '-xmode', 'Plain', '-autocall', '2', '-auto_indent',
|
---|
11 | '-pi1', 'ASAP> ', '-po', 'asap>: ', '-pprint']
|
---|
12 | ipshell = IPShellEmbed(sys.argv[1:],banner,exit_msg)
|
---|
13 | return ipshell
|
---|
14 |
|
---|
15 |
|
---|
16 | def main11():
|
---|
17 | from IPython.config.loader import Config
|
---|
18 | cfg = Config()
|
---|
19 | prompt_config = cfg.PromptManager
|
---|
20 | prompt_config.in_template = 'ASAP> '
|
---|
21 | prompt_config.out_template = 'asap>: '
|
---|
22 | cfg.InteractiveShell.autoindent = True
|
---|
23 | cfg.InteractiveShell.autocall = 2
|
---|
24 | cfg.InteractiveShell.magic_pprint = True
|
---|
25 | cfg.InteractiveShell.use_readline=True
|
---|
26 | cfg.InteractiveShell.confirm_exit=False
|
---|
27 | cfg.InteractiveShell.xmode='Plain'
|
---|
28 |
|
---|
29 | from IPython.frontend.terminal.embed import InteractiveShellEmbed
|
---|
30 | ipshell = InteractiveShellEmbed(config=cfg,
|
---|
31 | banner1 = welcome(),
|
---|
32 | exit_msg = '')
|
---|
33 | return ipshell
|
---|
34 |
|
---|
35 | try:
|
---|
36 | os.system('clear')
|
---|
37 | import IPython
|
---|
38 | from asap import *
|
---|
39 | vers = int(IPython.__version__.split(".")[1])
|
---|
40 | if vers >= 11:
|
---|
41 | ipshell = main11()
|
---|
42 | else:
|
---|
43 | ipshell = main10()
|
---|
44 | ipshell()
|
---|
45 |
|
---|
46 | except ImportError:
|
---|
47 | banner = "No ipython found. Running standard python"
|
---|
48 | import code
|
---|
49 | from asap import *
|
---|
50 | del main
|
---|
51 | code.interact(banner, local=locals())
|
---|