Show More
@@ -1,56 +1,80 | |||||
1 | import os,sys |
|
1 | import os,sys | |
2 |
|
2 | |||
3 | import ipy_rehashdir,glob |
|
3 | import ipy_rehashdir,glob | |
4 | from ipy_rehashdir import selflaunch, PyLauncher |
|
4 | from ipy_rehashdir import selflaunch, PyLauncher | |
5 |
|
5 | |||
6 | def pylaunchers(): |
|
6 | def pylaunchers(): | |
7 | """Create launchers for python scripts in cwd and store them in alias table |
|
7 | """Create launchers for python scripts in cwd and store them in alias table | |
8 |
|
8 | |||
9 | This is useful if you want to invoke .py scripts from ipykit session, |
|
9 | This is useful if you want to invoke .py scripts from ipykit session, | |
10 | just adding .py files in PATH does not work without file association. |
|
10 | just adding .py files in PATH does not work without file association. | |
11 |
|
11 | |||
12 | .ipy files will be run like macros. |
|
12 | .ipy files will be run like macros. | |
13 |
|
13 | |||
14 | """ |
|
14 | """ | |
15 | fs = glob.glob('*.?py*') |
|
15 | fs = glob.glob('*.?py*') | |
16 | for f in fs: |
|
16 | for f in fs: | |
17 | l = PyLauncher(f) |
|
17 | l = PyLauncher(f) | |
18 | n = os.path.splitext(f)[0] |
|
18 | n = os.path.splitext(f)[0] | |
19 | ip.defalias(n, l) |
|
19 | ip.defalias(n, l) | |
20 | ip.magic('store '+n) |
|
20 | ip.magic('store '+n) | |
21 |
|
21 | |||
22 |
|
22 | |||
23 | def exta_imports(): |
|
23 | def exta_imports(): | |
24 | # add some modules that you'd want to be bundled in the ipykit |
|
24 | # add some modules that you'd want to be bundled in the ipykit | |
25 | # library zip file here. Do this if you get ImportErrors from scripts you |
|
25 | # library zip file here. Do this if you get ImportErrors from scripts you | |
26 | # try to launch with 'py' or pylaunchers. In theory you could include |
|
26 | # try to launch with 'py' or pylaunchers. In theory you could include | |
27 | # the whole stdlib here for full script coverage |
|
27 | # the whole stdlib here for full script coverage | |
28 |
|
28 | |||
29 | # note that this is never run, it's just here for py2exe |
|
29 | # note that this is never run, it's just here for py2exe | |
30 | import distutils.dir_util |
|
30 | import distutils.dir_util | |
31 |
|
31 | |||
|
32 | def kitroot(): | |||
|
33 | return os.environ.get('IPYKITROOT', None) | |||
|
34 | ||||
32 | def main(): |
|
35 | def main(): | |
33 | root = os.environ.get('IPYKITROOT', None) |
|
36 | ||
34 | if not root: |
|
37 | if not kitroot(): | |
35 | print "Can't configure ipykit, IPYKITROOT should be set." |
|
38 | print "Can't configure ipykit, IPYKITROOT should be set." | |
36 | return |
|
39 | return | |
37 |
|
40 | |||
38 | os.environ["PATH"] = os.environ["PATH"] + ";" + root + "\\bin;" |
|
41 | os.environ["PATH"] = os.environ["PATH"] + ";" + kitroot() + "\\bin;" | |
39 | ip.to_user_ns("pylaunchers") |
|
42 | ip.to_user_ns("pylaunchers") | |
|
43 | cmds = ip.db.get('syscmdlist', None) | |||
|
44 | if cmds is None: | |||
|
45 | ip.magic('rehashx') | |||
|
46 | cmds = ip.db.get('syscmdlist', []) | |||
|
47 | #print cmds | |||
|
48 | if 'sc1' in cmds: | |||
|
49 | print "Default editor: Sc1" | |||
|
50 | import ipy_editors | |||
|
51 | ipy_editors.scite('sc1') | |||
|
52 | ||||
|
53 | # for icp, imv, imkdir, etc. | |||
|
54 | import ipy_fsops | |||
|
55 | ||||
|
56 | greeting = """\n\n === Welcome to ipykit === | |||
|
57 | ||||
|
58 | %quickref - learn quickly about IPython. | |||
40 |
|
59 | |||
|
60 | """ | |||
41 |
|
61 | |||
42 | def ipython_firstrun(ip): |
|
62 | def ipython_firstrun(ip): | |
|
63 | ||||
43 | print "First run of ipykit - configuring" |
|
64 | print "First run of ipykit - configuring" | |
|
65 | ||||
44 | ip.defalias('py',selflaunch) |
|
66 | ip.defalias('py',selflaunch) | |
45 |
ip.defalias('d',' |
|
67 | ip.defalias('d','dir /w /og /on') | |
46 | ip.defalias('ls','ls') |
|
|||
47 | ip.magic('store py') |
|
68 | ip.magic('store py') | |
48 | ip.magic('store d') |
|
69 | ip.magic('store d') | |
49 | ip.magic('store ls') |
|
70 | ||
|
71 | bins = kitroot() +'/bin' | |||
|
72 | ||||
|
73 | print greeting | |||
50 |
|
74 | |||
51 | def init_ipython(ipy): |
|
75 | def init_ipython(ipy): | |
52 | global ip |
|
76 | global ip | |
53 | ip = ipy |
|
77 | ip = ipy | |
54 | main() |
|
78 | main() | |
55 |
|
79 | |||
56 |
|
80 |
@@ -1,105 +1,106 | |||||
1 | #!/usr/bin/env python |
|
1 | #!/usr/bin/env python | |
2 | # -*- coding: utf-8 -*- |
|
2 | # -*- coding: utf-8 -*- | |
3 | r"""Setup script for exe distribution of IPython (does not require python). |
|
3 | r"""Setup script for exe distribution of IPython (does not require python). | |
4 |
|
4 | |||
5 | - Requires py2exe |
|
5 | - Requires py2exe | |
6 |
|
6 | |||
7 | - install pyreadline *package dir* in ipython root directory by running: |
|
7 | - install pyreadline *package dir* in ipython root directory by running: | |
8 |
|
8 | |||
9 | svn co http://ipython.scipy.org/svn/ipython/pyreadline/branches/maintenance_1.3/pyreadline/ |
|
9 | svn co http://ipython.scipy.org/svn/ipython/pyreadline/branches/maintenance_1.3/pyreadline/ | |
10 | wget http://ipython.scipy.org/svn/ipython/pyreadline/branches/maintenance_1.3/readline.py |
|
10 | wget http://ipython.scipy.org/svn/ipython/pyreadline/branches/maintenance_1.3/readline.py | |
11 |
|
11 | |||
12 | OR (if you want the latest trunk): |
|
12 | OR (if you want the latest trunk): | |
13 |
|
13 | |||
14 | svn co http://ipython.scipy.org/svn/ipython/pyreadline/trunk/pyreadline |
|
14 | svn co http://ipython.scipy.org/svn/ipython/pyreadline/trunk/pyreadline | |
15 |
|
15 | |||
16 | - Create the distribution in 'dist' by running "python exesetup.py py2exe" |
|
16 | - Create the distribution in 'dist' by running "python exesetup.py py2exe" | |
17 |
|
17 | |||
18 | - Run ipython.exe to go. |
|
18 | - Run ipython.exe to go. | |
19 |
|
19 | |||
20 | """ |
|
20 | """ | |
21 |
|
21 | |||
22 | #***************************************************************************** |
|
22 | #***************************************************************************** | |
23 | # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu> |
|
23 | # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu> | |
24 | # |
|
24 | # | |
25 | # Distributed under the terms of the BSD License. The full license is in |
|
25 | # Distributed under the terms of the BSD License. The full license is in | |
26 | # the file COPYING, distributed as part of this software. |
|
26 | # the file COPYING, distributed as part of this software. | |
27 | #***************************************************************************** |
|
27 | #***************************************************************************** | |
28 |
|
28 | |||
29 | # Stdlib imports |
|
29 | # Stdlib imports | |
30 | import os |
|
30 | import os | |
31 | import sys |
|
31 | import sys | |
32 |
|
32 | |||
33 | from glob import glob |
|
33 | from glob import glob | |
34 |
|
34 | |||
35 |
|
35 | |||
36 | # A few handy globals |
|
36 | # A few handy globals | |
37 | isfile = os.path.isfile |
|
37 | isfile = os.path.isfile | |
38 | pjoin = os.path.join |
|
38 | pjoin = os.path.join | |
39 |
|
39 | |||
40 | from distutils.core import setup |
|
40 | from distutils.core import setup | |
41 | from distutils import dir_util |
|
41 | from distutils import dir_util | |
42 | import py2exe |
|
42 | import py2exe | |
43 |
|
43 | |||
44 | # update the manuals when building a source dist |
|
44 | # update the manuals when building a source dist | |
45 | # Release.py contains version, authors, license, url, keywords, etc. |
|
45 | # Release.py contains version, authors, license, url, keywords, etc. | |
46 | execfile(pjoin('IPython','Release.py')) |
|
46 | execfile(pjoin('IPython','Release.py')) | |
47 |
|
47 | |||
48 | # A little utility we'll need below, since glob() does NOT allow you to do |
|
48 | # A little utility we'll need below, since glob() does NOT allow you to do | |
49 | # exclusion on multiple endings! |
|
49 | # exclusion on multiple endings! | |
50 | def file_doesnt_endwith(test,endings): |
|
50 | def file_doesnt_endwith(test,endings): | |
51 | """Return true if test is a file and its name does NOT end with any |
|
51 | """Return true if test is a file and its name does NOT end with any | |
52 | of the strings listed in endings.""" |
|
52 | of the strings listed in endings.""" | |
53 | if not isfile(test): |
|
53 | if not isfile(test): | |
54 | return False |
|
54 | return False | |
55 | for e in endings: |
|
55 | for e in endings: | |
56 | if test.endswith(e): |
|
56 | if test.endswith(e): | |
57 | return False |
|
57 | return False | |
58 | return True |
|
58 | return True | |
59 |
|
59 | |||
60 |
|
60 | |||
61 | egg_extra_kwds = {} |
|
61 | egg_extra_kwds = {} | |
62 |
|
62 | |||
63 | # Call the setup() routine which does most of the work |
|
63 | # Call the setup() routine which does most of the work | |
64 | setup(name = name, |
|
64 | setup(name = name, | |
65 | options = { |
|
65 | options = { | |
66 | 'py2exe': { |
|
66 | 'py2exe': { | |
67 | 'packages' : ['IPython', 'IPython.Extensions', 'IPython.external', |
|
67 | 'packages' : ['IPython', 'IPython.Extensions', 'IPython.external', | |
68 | 'pyreadline'], |
|
68 | 'pyreadline'], | |
69 | 'excludes' : ["Tkconstants","Tkinter","tcl",'IPython.igrid','wx', |
|
69 | 'excludes' : ["Tkconstants","Tkinter","tcl",'IPython.igrid','wx', | |
70 | 'wxPython','igrid', 'PyQt4', 'zope', 'Zope', 'Zope2', |
|
70 | 'wxPython','igrid', 'PyQt4', 'zope', 'Zope', 'Zope2', | |
71 |
'_curses','enthought.traits','gtk','qt' |
|
71 | '_curses','enthought.traits','gtk','qt', 'pydb','idlelib', | |
|
72 | ] | |||
72 |
|
73 | |||
73 | } |
|
74 | } | |
74 | }, |
|
75 | }, | |
75 | version = version, |
|
76 | version = version, | |
76 | description = description, |
|
77 | description = description, | |
77 | long_description = long_description, |
|
78 | long_description = long_description, | |
78 | author = authors['Fernando'][0], |
|
79 | author = authors['Fernando'][0], | |
79 | author_email = authors['Fernando'][1], |
|
80 | author_email = authors['Fernando'][1], | |
80 | url = url, |
|
81 | url = url, | |
81 | download_url = download_url, |
|
82 | download_url = download_url, | |
82 | license = license, |
|
83 | license = license, | |
83 | platforms = platforms, |
|
84 | platforms = platforms, | |
84 | keywords = keywords, |
|
85 | keywords = keywords, | |
85 | console = ['ipykit.py'], |
|
86 | console = ['ipykit.py'], | |
86 |
|
87 | |||
87 | # extra params needed for eggs |
|
88 | # extra params needed for eggs | |
88 | **egg_extra_kwds |
|
89 | **egg_extra_kwds | |
89 | ) |
|
90 | ) | |
90 |
|
91 | |||
91 | minimal_conf = """ |
|
92 | minimal_conf = """ | |
92 | import IPython.ipapi |
|
93 | import IPython.ipapi | |
93 | ip = IPython.ipapi.get() |
|
94 | ip = IPython.ipapi.get() | |
94 | import ipy_profile_sh |
|
|||
95 | ip.load('ipy_kitcfg') |
|
|||
96 |
|
95 | |||
|
96 | ip.load('ipy_kitcfg') | |||
|
97 | import ipy_profile_sh | |||
97 | """ |
|
98 | """ | |
98 |
|
99 | |||
99 | if not os.path.isdir("dist/_ipython"): |
|
100 | if not os.path.isdir("dist/_ipython"): | |
100 | print "Creating simple _ipython dir" |
|
101 | print "Creating simple _ipython dir" | |
101 | os.mkdir("dist/_ipython") |
|
102 | os.mkdir("dist/_ipython") | |
102 | open("dist/_ipython/ipythonrc.ini","w").write("# intentionally blank\n") |
|
103 | open("dist/_ipython/ipythonrc.ini","w").write("# intentionally blank\n") | |
103 | open("dist/_ipython/ipy_user_conf.py","w").write(minimal_conf) |
|
104 | open("dist/_ipython/ipy_user_conf.py","w").write(minimal_conf) | |
104 | if os.path.isdir('bin'): |
|
105 | if os.path.isdir('bin'): | |
105 |
dir_util.copy_tree('bin','dist/ |
|
106 | dir_util.copy_tree('bin','dist/bin') |
@@ -1,31 +1,39 | |||||
1 | """ Create ipykit and exe installer |
|
1 | """ Create ipykit and exe installer | |
2 |
|
2 | |||
3 | requires py2exe |
|
3 | requires py2exe | |
4 |
|
4 | |||
5 | """ |
|
5 | """ | |
6 | #!/bin/sh |
|
6 | #!/bin/sh | |
7 | # IPython release script |
|
7 | # IPython release script | |
8 |
|
8 | |||
9 |
|
9 | |||
10 | import os |
|
10 | import os | |
11 | import distutils.dir_util |
|
11 | import distutils.dir_util | |
|
12 | import sys | |||
|
13 | ||||
|
14 | execfile('../IPython/Release.py') | |||
|
15 | ||||
12 | def c(cmd): |
|
16 | def c(cmd): | |
13 | print ">",cmd |
|
17 | print ">",cmd | |
14 | os.system(cmd) |
|
18 | os.system(cmd) | |
15 |
|
19 | |||
|
20 | ipykit_name = "ipykit-%s" % version | |||
|
21 | ||||
|
22 | ||||
16 | os.chdir('..') |
|
23 | os.chdir('..') | |
17 | if os.path.isdir('dist'): |
|
24 | if os.path.isdir('dist'): | |
18 | distutils.dir_util.remove_tree('dist') |
|
25 | distutils.dir_util.remove_tree('dist') | |
19 |
if os.path.isdir( |
|
26 | if os.path.isdir(ipykit_name): | |
20 |
distutils.dir_util.remove_tree( |
|
27 | distutils.dir_util.remove_tree(ipykit_name) | |
21 |
|
28 | |||
22 | c("python exesetup.py py2exe") |
|
29 | c("python exesetup.py py2exe") | |
23 | os.rename('dist','ipykit') |
|
|||
24 |
|
30 | |||
25 | c("zip -r ipykit.zip ipykit") |
|
31 | os.rename('dist',ipykit_name) | |
|
32 | ||||
|
33 | c("zip -r %s.zip %s" % (ipykit_name, ipykit_name)) | |||
26 |
|
34 | |||
27 | c("python setup.py bdist_wininst --install-script=ipython_win_post_install.py") |
|
35 | c("python setup.py bdist_wininst --install-script=ipython_win_post_install.py") | |
28 |
|
36 | |||
29 | os.chdir("dist") |
|
37 | os.chdir("dist") | |
30 | c("svn export http://ipython.scipy.org/svn/ipython/ipython/trunk ipython") |
|
38 | #c("svn export http://ipython.scipy.org/svn/ipython/ipython/trunk ipython") | |
31 | c("zip -r ipython_svn.zip ipython") |
|
39 | #c("zip -r ipython_svn.zip ipython") |
General Comments 0
You need to be logged in to leave comments.
Login now