[2498] | 1 | #!/usr/bin/env python
|
---|
| 2 | import os
|
---|
| 3 |
|
---|
[2929] | 4 | def _main010():
|
---|
[2621] | 5 | from IPython.Shell import IPShellEmbed
|
---|
| 6 |
|
---|
[2623] | 7 | banner = welcome()
|
---|
| 8 | exit_msg = ''
|
---|
| 9 | args = ['-colors','Linux','-noconfirm_exit', '-readline',
|
---|
[2651] | 10 | '-xmode', 'Plain', '-autocall', '2', '-autoindent',
|
---|
[2623] | 11 | '-pi1', 'ASAP> ', '-po', 'asap>: ', '-pprint']
|
---|
[2651] | 12 | ipshell = IPShellEmbed(args,banner,exit_msg)
|
---|
[2621] | 13 | return ipshell
|
---|
| 14 |
|
---|
| 15 |
|
---|
[2929] | 16 | def _main011():
|
---|
[2498] | 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'
|
---|
[2929] | 28 | try:
|
---|
| 29 | from IPython.terminal.embed import InteractiveShellEmbed
|
---|
| 30 | except ImportError:
|
---|
| 31 | from IPython.frontend.terminal.embed import InteractiveShellEmbed
|
---|
[2498] | 32 | ipshell = InteractiveShellEmbed(config=cfg,
|
---|
| 33 | banner1 = welcome(),
|
---|
| 34 | exit_msg = '')
|
---|
[2621] | 35 | return ipshell
|
---|
[2498] | 36 |
|
---|
| 37 | try:
|
---|
| 38 | os.system('clear')
|
---|
| 39 | import IPython
|
---|
[2929] | 40 | from asap import *
|
---|
| 41 | vitems = IPython.__version__.split(".")
|
---|
| 42 | vmaj = int(vitems[0])
|
---|
| 43 | vmin = int(vitems[1])
|
---|
| 44 | if vmaj == 0:
|
---|
| 45 | if vmin >= 11:
|
---|
| 46 | ipshell = _main011()
|
---|
| 47 | else:
|
---|
| 48 | ipshell = _main010()
|
---|
[2621] | 49 | else:
|
---|
[2929] | 50 | ipshell = _main011()
|
---|
[2623] | 51 | ipshell()
|
---|
[2621] | 52 |
|
---|
[2498] | 53 | except ImportError:
|
---|
[2621] | 54 | banner = "No ipython found. Running standard python"
|
---|
| 55 | import code
|
---|
[2499] | 56 | from asap import *
|
---|
[2621] | 57 | code.interact(banner, local=locals())
|
---|