source: trunk/bin/asap@ 2621

Last change on this file since 2621 was 2621, checked in by Malte Marquarding, 13 years ago

allow for ipython >=0.10 (both 0.10 and 0.11)

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