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