Show More
@@ -0,0 +1,21 b'' | |||||
|
1 | #!/usr/bin/env python | |||
|
2 | # -*- coding: utf-8 -*- | |||
|
3 | """ IPykit launcher | |||
|
4 | ||||
|
5 | w/o args, this launches a full ipykit session. | |||
|
6 | ||||
|
7 | If the first arg is a .py script, it will be run WITHOUT ipython, | |||
|
8 | to facilitate running python scripts almost normally on machines w/o python | |||
|
9 | in their own process (as opposed to %run). | |||
|
10 | ||||
|
11 | """ | |||
|
12 | ||||
|
13 | import sys | |||
|
14 | if len(sys.argv) > 1 and sys.argv[1].endswith('.py'): | |||
|
15 | # shortcut for running ipykit.exe directly on a .py file - do not bother | |||
|
16 | # starting ipython, just handle as normal python scripts | |||
|
17 | sys.argv = sys.argv[1:] | |||
|
18 | execfile(sys.argv[0]) | |||
|
19 | else: | |||
|
20 | import IPython | |||
|
21 | IPython.Shell.start().mainloop() |
@@ -1,15 +1,29 b'' | |||||
1 | #import IPython.ipapi |
|
|||
2 | #ip = IPython.ipapi.get() |
|
|||
3 |
|
|
1 | ||
4 | import os |
|
2 | import os,sys | |
5 |
|
3 | |||
|
4 | def selflaunch(line): | |||
|
5 | """ Launch python script with 'this' interpreter | |||
|
6 | ||||
|
7 | e.g. d:\foo\ipython.exe a.py | |||
|
8 | ||||
|
9 | """ | |||
|
10 | cmd = sys.executable + ' ' + line.split(None,1)[1] | |||
|
11 | print ">",cmd | |||
|
12 | os.system(cmd) | |||
|
13 | ||||
6 | def main(): |
|
14 | def main(): | |
|
15 | import IPython.ipapi | |||
|
16 | ip = IPython.ipapi.get() | |||
|
17 | ||||
7 | root = os.environ.get('IPYKITROOT', None) |
|
18 | root = os.environ.get('IPYKITROOT', None) | |
8 | if not root: |
|
19 | if not root: | |
9 | print "Can't configure ipykit, IPYKITROOT should be set." |
|
20 | print "Can't configure ipykit, IPYKITROOT should be set." | |
10 | return |
|
21 | return | |
11 |
|
22 | |||
12 | os.environ["PATH"] = os.environ["PATH"] + ";" + root + "\\bin;" |
|
23 | os.environ["PATH"] = os.environ["PATH"] + ";" + root + "\\bin;" | |
|
24 | ||||
|
25 | ip.defalias('py',selflaunch) | |||
|
26 | ||||
13 |
|
27 | |||
14 | main() |
|
28 | main() | |
15 |
|
29 |
@@ -1,7 +1,7 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """Magic functions for InteractiveShell. |
|
2 | """Magic functions for InteractiveShell. | |
3 |
|
3 | |||
4 |
$Id: Magic.py 26 |
|
4 | $Id: Magic.py 2663 2007-08-22 21:46:52Z vivainio $""" | |
5 |
|
5 | |||
6 | #***************************************************************************** |
|
6 | #***************************************************************************** | |
7 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and |
|
7 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and | |
@@ -2295,13 +2295,16 b' Defaulting color scheme to \'NoColor\'"""' | |||||
2295 | res = [] |
|
2295 | res = [] | |
2296 | showlast = [] |
|
2296 | showlast = [] | |
2297 | for alias in aliases: |
|
2297 | for alias in aliases: | |
|
2298 | special = False | |||
2298 | try: |
|
2299 | try: | |
2299 | tgt = atab[alias][1] |
|
2300 | tgt = atab[alias][1] | |
2300 | except TypeError: |
|
2301 | except TypeError: | |
2301 | # unsubscriptable? probably a callable |
|
2302 | # unsubscriptable? probably a callable | |
2302 | tgt = atab[alias] |
|
2303 | tgt = atab[alias] | |
|
2304 | special = True | |||
2303 | # 'interesting' aliases |
|
2305 | # 'interesting' aliases | |
2304 |
if (alias in stored or |
|
2306 | if (alias in stored or | |
|
2307 | special or | |||
2305 | alias.lower() != os.path.splitext(tgt)[0].lower() or |
|
2308 | alias.lower() != os.path.splitext(tgt)[0].lower() or | |
2306 | ' ' in tgt): |
|
2309 | ' ' in tgt): | |
2307 | showlast.append((alias, tgt)) |
|
2310 | showlast.append((alias, tgt)) |
@@ -18,6 +18,10 b'' | |||||
18 | * genutils.py, Prompts.py, Magic.py: win32 - prompt (with \yDEPTH) and |
|
18 | * genutils.py, Prompts.py, Magic.py: win32 - prompt (with \yDEPTH) and | |
19 | term title now include the drive letter, and always use / instead of |
|
19 | term title now include the drive letter, and always use / instead of | |
20 | os.sep (as per recommended approach for win32 ipython in general). |
|
20 | os.sep (as per recommended approach for win32 ipython in general). | |
|
21 | ||||
|
22 | * ipykit.py, ipy_kitcfg.py: special launcher for ipykit. Allows running | |||
|
23 | plain python scripts from ipykit command line by running | |||
|
24 | "py myscript.py", even w/o installed python. | |||
21 |
|
25 | |||
22 | 2007-08-21 Ville Vainio <vivainio@gmail.com> |
|
26 | 2007-08-21 Ville Vainio <vivainio@gmail.com> | |
23 |
|
27 |
@@ -79,7 +79,7 b' setup(name = name,' | |||||
79 | license = license, |
|
79 | license = license, | |
80 | platforms = platforms, |
|
80 | platforms = platforms, | |
81 | keywords = keywords, |
|
81 | keywords = keywords, | |
82 |
console = ['ipyt |
|
82 | console = ['ipykit.py'], | |
83 |
|
83 | |||
84 | # extra params needed for eggs |
|
84 | # extra params needed for eggs | |
85 | **egg_extra_kwds |
|
85 | **egg_extra_kwds |
@@ -7,6 +7,9 b" in './scripts' directory. This file is here (ipython source root directory)" | |||||
7 | to facilitate non-root 'zero-installation' (just copy the source tree |
|
7 | to facilitate non-root 'zero-installation' (just copy the source tree | |
8 | somewhere and run ipython.py) and development. """ |
|
8 | somewhere and run ipython.py) and development. """ | |
9 |
|
9 | |||
|
10 | import sys | |||
|
11 | print "e",sys.executable | |||
|
12 | ||||
10 | import IPython |
|
13 | import IPython | |
11 |
|
14 | |||
12 | IPython.Shell.start().mainloop() |
|
15 | IPython.Shell.start().mainloop() |
General Comments 0
You need to be logged in to leave comments.
Login now