Show More
@@ -1,3 +1,3 b'' | |||
|
1 |
This file used to be symlink in SVN, but now it serves as a *warning* so that |
|
|
2 |
nobody creates symlinks to the bzr repository |
|
|
3 | ||
|
1 | This file used to be symlink in SVN, but now it serves as a *warning* so that | |
|
2 | nobody creates symlinks to the bzr repository | |
|
3 |
@@ -1,30 +1,30 b'' | |||
|
1 |
include README_Windows.txt |
|
|
2 |
include win32_manual_post_install.py |
|
|
3 |
include ipython.py |
|
|
4 | ||
|
5 |
graft scripts |
|
|
6 | ||
|
7 |
graft setupext |
|
|
8 | ||
|
9 |
graft IPython/UserConfig |
|
|
10 | ||
|
11 |
graft doc |
|
|
12 |
exclude doc/*.1 |
|
|
13 |
exclude doc/manual_base* |
|
|
14 |
exclude doc/ChangeLog.* |
|
|
15 |
exclude doc/\#* |
|
|
16 |
exclude doc/update_magic.sh |
|
|
17 |
exclude doc/update_version.sh |
|
|
18 |
exclude doc/manual_base* |
|
|
19 |
exclude doc/manual/WARNINGS |
|
|
20 |
exclude doc/manual/*.aux |
|
|
21 |
exclude doc/manual/*.log |
|
|
22 |
exclude doc/manual/*.out |
|
|
23 |
exclude doc/manual/*.pl |
|
|
24 |
exclude doc/manual/*.tex |
|
|
25 | ||
|
26 |
global-exclude *~ |
|
|
27 |
global-exclude *.flc |
|
|
28 |
global-exclude *.pyc |
|
|
29 |
global-exclude .dircopy.log |
|
|
30 |
global-exclude .svn |
|
|
1 | include README_Windows.txt | |
|
2 | include win32_manual_post_install.py | |
|
3 | include ipython.py | |
|
4 | ||
|
5 | graft scripts | |
|
6 | ||
|
7 | graft setupext | |
|
8 | ||
|
9 | graft IPython/UserConfig | |
|
10 | ||
|
11 | graft doc | |
|
12 | exclude doc/*.1 | |
|
13 | exclude doc/manual_base* | |
|
14 | exclude doc/ChangeLog.* | |
|
15 | exclude doc/\#* | |
|
16 | exclude doc/update_magic.sh | |
|
17 | exclude doc/update_version.sh | |
|
18 | exclude doc/manual_base* | |
|
19 | exclude doc/manual/WARNINGS | |
|
20 | exclude doc/manual/*.aux | |
|
21 | exclude doc/manual/*.log | |
|
22 | exclude doc/manual/*.out | |
|
23 | exclude doc/manual/*.pl | |
|
24 | exclude doc/manual/*.tex | |
|
25 | ||
|
26 | global-exclude *~ | |
|
27 | global-exclude *.flc | |
|
28 | global-exclude *.pyc | |
|
29 | global-exclude .dircopy.log | |
|
30 | global-exclude .svn |
@@ -1,11 +1,11 b'' | |||
|
1 |
Please see the doc/ directory for full manuals and other documents. The manual is |
|
|
2 |
prepared using the LyX system (www.lyx.org), but in the doc/manual directory |
|
|
3 |
you'll find HTML and PDF versions. |
|
|
4 | ||
|
5 |
These manuals normally get installed to $PREFIX/share/doc/ipython-VERSION, unless you |
|
|
6 |
redirect the installer via a --prefix/--home option. Normally, $PREFIX is |
|
|
7 |
/usr, but your Python may be installed elsewhere. You can see its value by |
|
|
8 |
running: |
|
|
9 | ||
|
10 |
python -c "import sys;print sys.prefix" |
|
|
11 | ||
|
1 | Please see the doc/ directory for full manuals and other documents. The manual is | |
|
2 | prepared using the LyX system (www.lyx.org), but in the doc/manual directory | |
|
3 | you'll find HTML and PDF versions. | |
|
4 | ||
|
5 | These manuals normally get installed to $PREFIX/share/doc/ipython-VERSION, unless you | |
|
6 | redirect the installer via a --prefix/--home option. Normally, $PREFIX is | |
|
7 | /usr, but your Python may be installed elsewhere. You can see its value by | |
|
8 | running: | |
|
9 | ||
|
10 | python -c "import sys;print sys.prefix" | |
|
11 |
@@ -1,50 +1,50 b'' | |||
|
1 |
Notes for Windows Users |
|
|
2 |
======================= |
|
|
3 | ||
|
4 |
See http://ipython.scipy.org/moin/IpythonOnWindows for up-to-date information |
|
|
5 |
about running IPython on Windows. |
|
|
6 | ||
|
7 | ||
|
8 |
Requirements |
|
|
9 |
------------ |
|
|
10 | ||
|
11 |
IPython runs under (as far as the Windows family is concerned): |
|
|
12 | ||
|
13 |
- Windows XP, 2000 (and probably WinNT): works well. It needs: |
|
|
14 | ||
|
15 |
* PyWin32: http://sourceforge.net/projects/pywin32/ |
|
|
16 | ||
|
17 |
* PyReadline: http://ipython.scipy.org/moin/PyReadline/Intro |
|
|
18 |
|
|
|
19 |
* If you are using Python2.4, this in turn requires Tomas Heller's ctypes |
|
|
20 |
from: http://starship.python.net/crew/theller/ctypes (not needed for Python |
|
|
21 |
2.5 users, since 2.5 already ships with ctypes). |
|
|
22 | ||
|
23 |
- Windows 95/98/ME: I have no idea. It should work, but I can't test. |
|
|
24 | ||
|
25 |
- CygWin environments should work, they are basically Posix. |
|
|
26 | ||
|
27 |
It needs Python 2.3 or newer. |
|
|
28 | ||
|
29 | ||
|
30 |
Installation |
|
|
31 |
------------ |
|
|
32 | ||
|
33 |
Double-click the supplied .exe installer file. If all goes well, that's all |
|
|
34 |
you need to do. You should now have an IPython entry in your Start Menu. |
|
|
35 | ||
|
36 | ||
|
37 |
Installation from source distribution |
|
|
38 |
------------------------------------- |
|
|
39 | ||
|
40 |
In case the automatic installer does not work for some reason, you can |
|
|
41 |
download the ipython-XXX.tar.gz file, which contains the full IPython source |
|
|
42 |
distribution (the popular WinZip can read .tar.gz files). |
|
|
43 | ||
|
44 |
After uncompressing the archive, you can install it at a command terminal just |
|
|
45 |
like any other Python module, by using python setup.py install'. After this |
|
|
46 |
completes, you can run the supplied win32_manual_post_install.py script which |
|
|
47 |
will add the relevant shortcuts to your startup menu. |
|
|
48 | ||
|
49 |
Optionally, you may skip installation altogether and just launch "ipython.py" |
|
|
50 |
from the root folder of the extracted source distribution. |
|
|
1 | Notes for Windows Users | |
|
2 | ======================= | |
|
3 | ||
|
4 | See http://ipython.scipy.org/moin/IpythonOnWindows for up-to-date information | |
|
5 | about running IPython on Windows. | |
|
6 | ||
|
7 | ||
|
8 | Requirements | |
|
9 | ------------ | |
|
10 | ||
|
11 | IPython runs under (as far as the Windows family is concerned): | |
|
12 | ||
|
13 | - Windows XP, 2000 (and probably WinNT): works well. It needs: | |
|
14 | ||
|
15 | * PyWin32: http://sourceforge.net/projects/pywin32/ | |
|
16 | ||
|
17 | * PyReadline: http://ipython.scipy.org/moin/PyReadline/Intro | |
|
18 | ||
|
19 | * If you are using Python2.4, this in turn requires Tomas Heller's ctypes | |
|
20 | from: http://starship.python.net/crew/theller/ctypes (not needed for Python | |
|
21 | 2.5 users, since 2.5 already ships with ctypes). | |
|
22 | ||
|
23 | - Windows 95/98/ME: I have no idea. It should work, but I can't test. | |
|
24 | ||
|
25 | - CygWin environments should work, they are basically Posix. | |
|
26 | ||
|
27 | It needs Python 2.3 or newer. | |
|
28 | ||
|
29 | ||
|
30 | Installation | |
|
31 | ------------ | |
|
32 | ||
|
33 | Double-click the supplied .exe installer file. If all goes well, that's all | |
|
34 | you need to do. You should now have an IPython entry in your Start Menu. | |
|
35 | ||
|
36 | ||
|
37 | Installation from source distribution | |
|
38 | ------------------------------------- | |
|
39 | ||
|
40 | In case the automatic installer does not work for some reason, you can | |
|
41 | download the ipython-XXX.tar.gz file, which contains the full IPython source | |
|
42 | distribution (the popular WinZip can read .tar.gz files). | |
|
43 | ||
|
44 | After uncompressing the archive, you can install it at a command terminal just | |
|
45 | like any other Python module, by using python setup.py install'. After this | |
|
46 | completes, you can run the supplied win32_manual_post_install.py script which | |
|
47 | will add the relevant shortcuts to your startup menu. | |
|
48 | ||
|
49 | Optionally, you may skip installation altogether and just launch "ipython.py" | |
|
50 | from the root folder of the extracted source distribution. |
@@ -1,106 +1,106 b'' | |||
|
1 | #!/usr/bin/env python | |
|
2 | # -*- coding: utf-8 -*- | |
|
3 | r"""Setup script for exe distribution of IPython (does not require python). | |
|
4 | ||
|
5 | - Requires py2exe | |
|
6 | ||
|
7 | - install pyreadline *package dir* in ipython root directory by running: | |
|
8 | ||
|
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 | |
|
11 | ||
|
12 | OR (if you want the latest trunk): | |
|
13 | ||
|
14 | svn co http://ipython.scipy.org/svn/ipython/pyreadline/trunk/pyreadline | |
|
15 | ||
|
16 | - Create the distribution in 'dist' by running "python exesetup.py py2exe" | |
|
17 | ||
|
18 | - Run ipython.exe to go. | |
|
19 | ||
|
20 | """ | |
|
21 | ||
|
22 | #***************************************************************************** | |
|
23 | # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu> | |
|
24 | # | |
|
25 | # Distributed under the terms of the BSD License. The full license is in | |
|
26 | # the file COPYING, distributed as part of this software. | |
|
27 | #***************************************************************************** | |
|
28 | ||
|
29 | # Stdlib imports | |
|
30 | import os | |
|
31 | import sys | |
|
32 | ||
|
33 | from glob import glob | |
|
34 | ||
|
35 | ||
|
36 | # A few handy globals | |
|
37 | isfile = os.path.isfile | |
|
38 | pjoin = os.path.join | |
|
39 | ||
|
40 | from distutils.core import setup | |
|
41 | from distutils import dir_util | |
|
42 | import py2exe | |
|
43 | ||
|
44 | # update the manuals when building a source dist | |
|
45 | # Release.py contains version, authors, license, url, keywords, etc. | |
|
46 | execfile(pjoin('IPython','Release.py')) | |
|
47 | ||
|
48 | # A little utility we'll need below, since glob() does NOT allow you to do | |
|
49 | # exclusion on multiple endings! | |
|
50 | def file_doesnt_endwith(test,endings): | |
|
51 | """Return true if test is a file and its name does NOT end with any | |
|
52 | of the strings listed in endings.""" | |
|
53 | if not isfile(test): | |
|
54 | return False | |
|
55 | for e in endings: | |
|
56 | if test.endswith(e): | |
|
57 | return False | |
|
58 | return True | |
|
59 | ||
|
60 | ||
|
61 | egg_extra_kwds = {} | |
|
62 | ||
|
63 | # Call the setup() routine which does most of the work | |
|
64 | setup(name = name, | |
|
65 | options = { | |
|
66 | 'py2exe': { | |
|
67 | 'packages' : ['IPython', 'IPython.Extensions', 'IPython.external', | |
|
68 | 'pyreadline'], | |
|
69 | 'excludes' : ["Tkconstants","Tkinter","tcl",'IPython.igrid','wx', | |
|
70 | 'wxPython','igrid', 'PyQt4', 'zope', 'Zope', 'Zope2', | |
|
71 | '_curses','enthought.traits','gtk','qt', 'pydb','idlelib', | |
|
72 | ] | |
|
73 | ||
|
74 | } | |
|
75 | }, | |
|
76 | version = version, | |
|
77 | description = description, | |
|
78 | long_description = long_description, | |
|
79 | author = authors['Fernando'][0], | |
|
80 | author_email = authors['Fernando'][1], | |
|
81 | url = url, | |
|
82 | download_url = download_url, | |
|
83 | license = license, | |
|
84 | platforms = platforms, | |
|
85 | keywords = keywords, | |
|
86 | console = ['ipykit.py'], | |
|
87 | ||
|
88 | # extra params needed for eggs | |
|
89 | **egg_extra_kwds | |
|
90 | ) | |
|
91 | ||
|
92 | minimal_conf = """ | |
|
93 | import IPython.ipapi | |
|
94 | ip = IPython.ipapi.get() | |
|
95 | ||
|
96 | ip.load('ipy_kitcfg') | |
|
97 | import ipy_profile_sh | |
|
98 | """ | |
|
99 | ||
|
100 | if not os.path.isdir("dist/_ipython"): | |
|
101 | print "Creating simple _ipython dir" | |
|
102 | os.mkdir("dist/_ipython") | |
|
103 | open("dist/_ipython/ipythonrc.ini","w").write("# intentionally blank\n") | |
|
104 | open("dist/_ipython/ipy_user_conf.py","w").write(minimal_conf) | |
|
105 | if os.path.isdir('bin'): | |
|
106 | dir_util.copy_tree('bin','dist/bin') | |
|
1 | #!/usr/bin/env python | |
|
2 | # -*- coding: utf-8 -*- | |
|
3 | r"""Setup script for exe distribution of IPython (does not require python). | |
|
4 | ||
|
5 | - Requires py2exe | |
|
6 | ||
|
7 | - install pyreadline *package dir* in ipython root directory by running: | |
|
8 | ||
|
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 | |
|
11 | ||
|
12 | OR (if you want the latest trunk): | |
|
13 | ||
|
14 | svn co http://ipython.scipy.org/svn/ipython/pyreadline/trunk/pyreadline | |
|
15 | ||
|
16 | - Create the distribution in 'dist' by running "python exesetup.py py2exe" | |
|
17 | ||
|
18 | - Run ipython.exe to go. | |
|
19 | ||
|
20 | """ | |
|
21 | ||
|
22 | #***************************************************************************** | |
|
23 | # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu> | |
|
24 | # | |
|
25 | # Distributed under the terms of the BSD License. The full license is in | |
|
26 | # the file COPYING, distributed as part of this software. | |
|
27 | #***************************************************************************** | |
|
28 | ||
|
29 | # Stdlib imports | |
|
30 | import os | |
|
31 | import sys | |
|
32 | ||
|
33 | from glob import glob | |
|
34 | ||
|
35 | ||
|
36 | # A few handy globals | |
|
37 | isfile = os.path.isfile | |
|
38 | pjoin = os.path.join | |
|
39 | ||
|
40 | from distutils.core import setup | |
|
41 | from distutils import dir_util | |
|
42 | import py2exe | |
|
43 | ||
|
44 | # update the manuals when building a source dist | |
|
45 | # Release.py contains version, authors, license, url, keywords, etc. | |
|
46 | execfile(pjoin('IPython','Release.py')) | |
|
47 | ||
|
48 | # A little utility we'll need below, since glob() does NOT allow you to do | |
|
49 | # exclusion on multiple endings! | |
|
50 | def file_doesnt_endwith(test,endings): | |
|
51 | """Return true if test is a file and its name does NOT end with any | |
|
52 | of the strings listed in endings.""" | |
|
53 | if not isfile(test): | |
|
54 | return False | |
|
55 | for e in endings: | |
|
56 | if test.endswith(e): | |
|
57 | return False | |
|
58 | return True | |
|
59 | ||
|
60 | ||
|
61 | egg_extra_kwds = {} | |
|
62 | ||
|
63 | # Call the setup() routine which does most of the work | |
|
64 | setup(name = name, | |
|
65 | options = { | |
|
66 | 'py2exe': { | |
|
67 | 'packages' : ['IPython', 'IPython.Extensions', 'IPython.external', | |
|
68 | 'pyreadline'], | |
|
69 | 'excludes' : ["Tkconstants","Tkinter","tcl",'IPython.igrid','wx', | |
|
70 | 'wxPython','igrid', 'PyQt4', 'zope', 'Zope', 'Zope2', | |
|
71 | '_curses','enthought.traits','gtk','qt', 'pydb','idlelib', | |
|
72 | ] | |
|
73 | ||
|
74 | } | |
|
75 | }, | |
|
76 | version = version, | |
|
77 | description = description, | |
|
78 | long_description = long_description, | |
|
79 | author = authors['Fernando'][0], | |
|
80 | author_email = authors['Fernando'][1], | |
|
81 | url = url, | |
|
82 | download_url = download_url, | |
|
83 | license = license, | |
|
84 | platforms = platforms, | |
|
85 | keywords = keywords, | |
|
86 | console = ['ipykit.py'], | |
|
87 | ||
|
88 | # extra params needed for eggs | |
|
89 | **egg_extra_kwds | |
|
90 | ) | |
|
91 | ||
|
92 | minimal_conf = """ | |
|
93 | import IPython.ipapi | |
|
94 | ip = IPython.ipapi.get() | |
|
95 | ||
|
96 | ip.load('ipy_kitcfg') | |
|
97 | import ipy_profile_sh | |
|
98 | """ | |
|
99 | ||
|
100 | if not os.path.isdir("dist/_ipython"): | |
|
101 | print "Creating simple _ipython dir" | |
|
102 | os.mkdir("dist/_ipython") | |
|
103 | open("dist/_ipython/ipythonrc.ini","w").write("# intentionally blank\n") | |
|
104 | open("dist/_ipython/ipy_user_conf.py","w").write(minimal_conf) | |
|
105 | if os.path.isdir('bin'): | |
|
106 | dir_util.copy_tree('bin','dist/bin') |
@@ -1,21 +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 | #!/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,180 +1,180 b'' | |||
|
1 | #!/usr/bin/env python | |
|
2 | # -*- coding: utf-8 -*- | |
|
3 | """Setup script for IPython. | |
|
4 | ||
|
5 | Under Posix environments it works like a typical setup.py script. | |
|
6 | Under Windows, the command sdist is not supported, since IPython | |
|
7 | requires utilities, which are not available under Windows.""" | |
|
8 | ||
|
9 | #***************************************************************************** | |
|
10 | # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu> | |
|
11 | # | |
|
12 | # Distributed under the terms of the BSD License. The full license is in | |
|
13 | # the file COPYING, distributed as part of this software. | |
|
14 | #***************************************************************************** | |
|
15 | ||
|
16 | # Stdlib imports | |
|
17 | import os | |
|
18 | import sys | |
|
19 | ||
|
20 | from glob import glob | |
|
21 | from setupext import install_data_ext | |
|
22 | ||
|
23 | # A few handy globals | |
|
24 | isfile = os.path.isfile | |
|
25 | pjoin = os.path.join | |
|
26 | ||
|
27 | # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly | |
|
28 | # update it when the contents of directories change. | |
|
29 | if os.path.exists('MANIFEST'): os.remove('MANIFEST') | |
|
30 | ||
|
31 | if os.name == 'posix': | |
|
32 | os_name = 'posix' | |
|
33 | elif os.name in ['nt','dos']: | |
|
34 | os_name = 'windows' | |
|
35 | else: | |
|
36 | print 'Unsupported operating system:',os.name | |
|
37 | sys.exit(1) | |
|
38 | ||
|
39 | # Under Windows, 'sdist' is not supported, since it requires lyxport (and | |
|
40 | # hence lyx,perl,latex,pdflatex,latex2html,sh,...) | |
|
41 | if os_name == 'windows' and 'sdist' in sys.argv: | |
|
42 | print 'The sdist command is not available under Windows. Exiting.' | |
|
43 | sys.exit(1) | |
|
44 | ||
|
45 | from distutils.core import setup | |
|
46 | ||
|
47 | # update the manuals when building a source dist | |
|
48 | if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): | |
|
49 | from IPython.genutils import target_update | |
|
50 | # list of things to be updated. Each entry is a triplet of args for | |
|
51 | # target_update() | |
|
52 | to_update = [('doc/magic.tex', | |
|
53 | ['IPython/Magic.py'], | |
|
54 | "cd doc && ./update_magic.sh" ), | |
|
55 | ||
|
56 | ('doc/manual.lyx', | |
|
57 | ['IPython/Release.py','doc/manual_base.lyx'], | |
|
58 | "cd doc && ./update_version.sh" ), | |
|
59 | ||
|
60 | ('doc/manual/manual.html', | |
|
61 | ['doc/manual.lyx', | |
|
62 | 'doc/magic.tex', | |
|
63 | 'doc/examples/example-gnuplot.py', | |
|
64 | 'doc/examples/example-embed.py', | |
|
65 | 'doc/examples/example-embed-short.py', | |
|
66 | 'IPython/UserConfig/ipythonrc', | |
|
67 | ], | |
|
68 | "cd doc && " | |
|
69 | "lyxport -tt --leave --pdf " | |
|
70 | "--html -o '-noinfo -split +1 -local_icons' manual.lyx"), | |
|
71 | ||
|
72 | ('doc/new_design.pdf', | |
|
73 | ['doc/new_design.lyx'], | |
|
74 | "cd doc && lyxport -tt --pdf new_design.lyx"), | |
|
75 | ||
|
76 | ('doc/ipython.1.gz', | |
|
77 | ['doc/ipython.1'], | |
|
78 | "cd doc && gzip -9c ipython.1 > ipython.1.gz"), | |
|
79 | ||
|
80 | ('doc/pycolor.1.gz', | |
|
81 | ['doc/pycolor.1'], | |
|
82 | "cd doc && gzip -9c pycolor.1 > pycolor.1.gz"), | |
|
83 | ] | |
|
84 | for target in to_update: | |
|
85 | target_update(*target) | |
|
86 | ||
|
87 | # Release.py contains version, authors, license, url, keywords, etc. | |
|
88 | execfile(pjoin('IPython','Release.py')) | |
|
89 | ||
|
90 | # A little utility we'll need below, since glob() does NOT allow you to do | |
|
91 | # exclusion on multiple endings! | |
|
92 | def file_doesnt_endwith(test,endings): | |
|
93 | """Return true if test is a file and its name does NOT end with any | |
|
94 | of the strings listed in endings.""" | |
|
95 | if not isfile(test): | |
|
96 | return False | |
|
97 | for e in endings: | |
|
98 | if test.endswith(e): | |
|
99 | return False | |
|
100 | return True | |
|
101 | ||
|
102 | # I can't find how to make distutils create a nested dir. structure, so | |
|
103 | # in the meantime do it manually. Butt ugly. | |
|
104 | # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain | |
|
105 | # information on how to do this more cleanly once python 2.4 can be assumed. | |
|
106 | # Thanks to Noel for the tip. | |
|
107 | docdirbase = 'share/doc/ipython-%s' % version | |
|
108 | manpagebase = 'share/man/man1' | |
|
109 | ||
|
110 | # We only need to exclude from this things NOT already excluded in the | |
|
111 | # MANIFEST.in file. | |
|
112 | exclude = ('.sh','.1.gz') | |
|
113 | docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('doc/*')) | |
|
114 | ||
|
115 | examfiles = filter(isfile, glob('doc/examples/*.py')) | |
|
116 | manfiles = filter(isfile, glob('doc/manual/*.html')) + \ | |
|
117 | filter(isfile, glob('doc/manual/*.css')) + \ | |
|
118 | filter(isfile, glob('doc/manual/*.png')) | |
|
119 | manpages = filter(isfile, glob('doc/*.1.gz')) | |
|
120 | cfgfiles = filter(isfile, glob('IPython/UserConfig/*')) | |
|
121 | scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor', | |
|
122 | 'scripts/irunner']) | |
|
123 | igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*')) | |
|
124 | ||
|
125 | # Script to be run by the windows binary installer after the default setup | |
|
126 | # routine, to add shortcuts and similar windows-only things. Windows | |
|
127 | # post-install scripts MUST reside in the scripts/ dir, otherwise distutils | |
|
128 | # doesn't find them. | |
|
129 | if 'bdist_wininst' in sys.argv: | |
|
130 | if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): | |
|
131 | print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting." | |
|
132 | sys.exit(1) | |
|
133 | scriptfiles.append('scripts/ipython_win_post_install.py') | |
|
134 | ||
|
135 | datafiles = [('data', docdirbase, docfiles), | |
|
136 | ('data', pjoin(docdirbase, 'examples'),examfiles), | |
|
137 | ('data', pjoin(docdirbase, 'manual'),manfiles), | |
|
138 | ('data', manpagebase, manpages), | |
|
139 | ('lib', 'IPython/UserConfig', cfgfiles), | |
|
140 | ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles), | |
|
141 | ] | |
|
142 | ||
|
143 | if 'setuptools' in sys.modules: | |
|
144 | # setuptools config for egg building | |
|
145 | egg_extra_kwds = { | |
|
146 | 'entry_points': { | |
|
147 | 'console_scripts': [ | |
|
148 | 'ipython = IPython.ipapi:launch_new_instance', | |
|
149 | 'pycolor = IPython.PyColorize:main' | |
|
150 | ]} | |
|
151 | } | |
|
152 | scriptfiles = [] | |
|
153 | # eggs will lack docs, eaxmples | |
|
154 | datafiles = [] | |
|
155 | ||
|
156 | #datafiles = [('lib', 'IPython/UserConfig', cfgfiles)] | |
|
157 | else: | |
|
158 | egg_extra_kwds = {} | |
|
159 | ||
|
160 | ||
|
161 | # Call the setup() routine which does most of the work | |
|
162 | setup(name = name, | |
|
163 | version = version, | |
|
164 | description = description, | |
|
165 | long_description = long_description, | |
|
166 | author = authors['Fernando'][0], | |
|
167 | author_email = authors['Fernando'][1], | |
|
168 | url = url, | |
|
169 | download_url = download_url, | |
|
170 | license = license, | |
|
171 | platforms = platforms, | |
|
172 | keywords = keywords, | |
|
173 | packages = ['IPython', 'IPython.Extensions', 'IPython.external'], | |
|
174 | scripts = scriptfiles, | |
|
175 | ||
|
176 | cmdclass = {'install_data': install_data_ext}, | |
|
177 | data_files = datafiles, | |
|
178 | # extra params needed for eggs | |
|
179 | **egg_extra_kwds | |
|
180 | ) | |
|
1 | #!/usr/bin/env python | |
|
2 | # -*- coding: utf-8 -*- | |
|
3 | """Setup script for IPython. | |
|
4 | ||
|
5 | Under Posix environments it works like a typical setup.py script. | |
|
6 | Under Windows, the command sdist is not supported, since IPython | |
|
7 | requires utilities, which are not available under Windows.""" | |
|
8 | ||
|
9 | #***************************************************************************** | |
|
10 | # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu> | |
|
11 | # | |
|
12 | # Distributed under the terms of the BSD License. The full license is in | |
|
13 | # the file COPYING, distributed as part of this software. | |
|
14 | #***************************************************************************** | |
|
15 | ||
|
16 | # Stdlib imports | |
|
17 | import os | |
|
18 | import sys | |
|
19 | ||
|
20 | from glob import glob | |
|
21 | from setupext import install_data_ext | |
|
22 | ||
|
23 | # A few handy globals | |
|
24 | isfile = os.path.isfile | |
|
25 | pjoin = os.path.join | |
|
26 | ||
|
27 | # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly | |
|
28 | # update it when the contents of directories change. | |
|
29 | if os.path.exists('MANIFEST'): os.remove('MANIFEST') | |
|
30 | ||
|
31 | if os.name == 'posix': | |
|
32 | os_name = 'posix' | |
|
33 | elif os.name in ['nt','dos']: | |
|
34 | os_name = 'windows' | |
|
35 | else: | |
|
36 | print 'Unsupported operating system:',os.name | |
|
37 | sys.exit(1) | |
|
38 | ||
|
39 | # Under Windows, 'sdist' is not supported, since it requires lyxport (and | |
|
40 | # hence lyx,perl,latex,pdflatex,latex2html,sh,...) | |
|
41 | if os_name == 'windows' and 'sdist' in sys.argv: | |
|
42 | print 'The sdist command is not available under Windows. Exiting.' | |
|
43 | sys.exit(1) | |
|
44 | ||
|
45 | from distutils.core import setup | |
|
46 | ||
|
47 | # update the manuals when building a source dist | |
|
48 | if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): | |
|
49 | from IPython.genutils import target_update | |
|
50 | # list of things to be updated. Each entry is a triplet of args for | |
|
51 | # target_update() | |
|
52 | to_update = [('doc/magic.tex', | |
|
53 | ['IPython/Magic.py'], | |
|
54 | "cd doc && ./update_magic.sh" ), | |
|
55 | ||
|
56 | ('doc/manual.lyx', | |
|
57 | ['IPython/Release.py','doc/manual_base.lyx'], | |
|
58 | "cd doc && ./update_version.sh" ), | |
|
59 | ||
|
60 | ('doc/manual/manual.html', | |
|
61 | ['doc/manual.lyx', | |
|
62 | 'doc/magic.tex', | |
|
63 | 'doc/examples/example-gnuplot.py', | |
|
64 | 'doc/examples/example-embed.py', | |
|
65 | 'doc/examples/example-embed-short.py', | |
|
66 | 'IPython/UserConfig/ipythonrc', | |
|
67 | ], | |
|
68 | "cd doc && " | |
|
69 | "lyxport -tt --leave --pdf " | |
|
70 | "--html -o '-noinfo -split +1 -local_icons' manual.lyx"), | |
|
71 | ||
|
72 | ('doc/new_design.pdf', | |
|
73 | ['doc/new_design.lyx'], | |
|
74 | "cd doc && lyxport -tt --pdf new_design.lyx"), | |
|
75 | ||
|
76 | ('doc/ipython.1.gz', | |
|
77 | ['doc/ipython.1'], | |
|
78 | "cd doc && gzip -9c ipython.1 > ipython.1.gz"), | |
|
79 | ||
|
80 | ('doc/pycolor.1.gz', | |
|
81 | ['doc/pycolor.1'], | |
|
82 | "cd doc && gzip -9c pycolor.1 > pycolor.1.gz"), | |
|
83 | ] | |
|
84 | for target in to_update: | |
|
85 | target_update(*target) | |
|
86 | ||
|
87 | # Release.py contains version, authors, license, url, keywords, etc. | |
|
88 | execfile(pjoin('IPython','Release.py')) | |
|
89 | ||
|
90 | # A little utility we'll need below, since glob() does NOT allow you to do | |
|
91 | # exclusion on multiple endings! | |
|
92 | def file_doesnt_endwith(test,endings): | |
|
93 | """Return true if test is a file and its name does NOT end with any | |
|
94 | of the strings listed in endings.""" | |
|
95 | if not isfile(test): | |
|
96 | return False | |
|
97 | for e in endings: | |
|
98 | if test.endswith(e): | |
|
99 | return False | |
|
100 | return True | |
|
101 | ||
|
102 | # I can't find how to make distutils create a nested dir. structure, so | |
|
103 | # in the meantime do it manually. Butt ugly. | |
|
104 | # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain | |
|
105 | # information on how to do this more cleanly once python 2.4 can be assumed. | |
|
106 | # Thanks to Noel for the tip. | |
|
107 | docdirbase = 'share/doc/ipython-%s' % version | |
|
108 | manpagebase = 'share/man/man1' | |
|
109 | ||
|
110 | # We only need to exclude from this things NOT already excluded in the | |
|
111 | # MANIFEST.in file. | |
|
112 | exclude = ('.sh','.1.gz') | |
|
113 | docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('doc/*')) | |
|
114 | ||
|
115 | examfiles = filter(isfile, glob('doc/examples/*.py')) | |
|
116 | manfiles = filter(isfile, glob('doc/manual/*.html')) + \ | |
|
117 | filter(isfile, glob('doc/manual/*.css')) + \ | |
|
118 | filter(isfile, glob('doc/manual/*.png')) | |
|
119 | manpages = filter(isfile, glob('doc/*.1.gz')) | |
|
120 | cfgfiles = filter(isfile, glob('IPython/UserConfig/*')) | |
|
121 | scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor', | |
|
122 | 'scripts/irunner']) | |
|
123 | igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*')) | |
|
124 | ||
|
125 | # Script to be run by the windows binary installer after the default setup | |
|
126 | # routine, to add shortcuts and similar windows-only things. Windows | |
|
127 | # post-install scripts MUST reside in the scripts/ dir, otherwise distutils | |
|
128 | # doesn't find them. | |
|
129 | if 'bdist_wininst' in sys.argv: | |
|
130 | if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): | |
|
131 | print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting." | |
|
132 | sys.exit(1) | |
|
133 | scriptfiles.append('scripts/ipython_win_post_install.py') | |
|
134 | ||
|
135 | datafiles = [('data', docdirbase, docfiles), | |
|
136 | ('data', pjoin(docdirbase, 'examples'),examfiles), | |
|
137 | ('data', pjoin(docdirbase, 'manual'),manfiles), | |
|
138 | ('data', manpagebase, manpages), | |
|
139 | ('lib', 'IPython/UserConfig', cfgfiles), | |
|
140 | ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles), | |
|
141 | ] | |
|
142 | ||
|
143 | if 'setuptools' in sys.modules: | |
|
144 | # setuptools config for egg building | |
|
145 | egg_extra_kwds = { | |
|
146 | 'entry_points': { | |
|
147 | 'console_scripts': [ | |
|
148 | 'ipython = IPython.ipapi:launch_new_instance', | |
|
149 | 'pycolor = IPython.PyColorize:main' | |
|
150 | ]} | |
|
151 | } | |
|
152 | scriptfiles = [] | |
|
153 | # eggs will lack docs, eaxmples | |
|
154 | datafiles = [] | |
|
155 | ||
|
156 | #datafiles = [('lib', 'IPython/UserConfig', cfgfiles)] | |
|
157 | else: | |
|
158 | egg_extra_kwds = {} | |
|
159 | ||
|
160 | ||
|
161 | # Call the setup() routine which does most of the work | |
|
162 | setup(name = name, | |
|
163 | version = version, | |
|
164 | description = description, | |
|
165 | long_description = long_description, | |
|
166 | author = authors['Fernando'][0], | |
|
167 | author_email = authors['Fernando'][1], | |
|
168 | url = url, | |
|
169 | download_url = download_url, | |
|
170 | license = license, | |
|
171 | platforms = platforms, | |
|
172 | keywords = keywords, | |
|
173 | packages = ['IPython', 'IPython.Extensions', 'IPython.external'], | |
|
174 | scripts = scriptfiles, | |
|
175 | ||
|
176 | cmdclass = {'install_data': install_data_ext}, | |
|
177 | data_files = datafiles, | |
|
178 | # extra params needed for eggs | |
|
179 | **egg_extra_kwds | |
|
180 | ) |
@@ -1,32 +1,32 b'' | |||
|
1 | """ An example of one way to embed IPython in your own application | |
|
2 | ||
|
3 | This basically means starting up IPython with some of your programs objects visible in the IPython | |
|
4 | user namespace. | |
|
5 | ||
|
6 | """ | |
|
7 | ||
|
8 | import sys | |
|
9 | sys.path.append('..') | |
|
10 | ||
|
11 | import IPython.ipapi | |
|
12 | ||
|
13 | my_ns = dict(a=10) | |
|
14 | ||
|
15 | ses = IPython.ipapi.make_session(my_ns) | |
|
16 | ||
|
17 | # Now get the ipapi instance, to be stored somewhere in your program for manipulation of the running | |
|
18 | # IPython session. See http://ipython.scipy.org/moin/IpythonExtensionApi | |
|
19 | ||
|
20 | ip = ses.IP.getapi() | |
|
21 | ||
|
22 | # let's play with the ipapi a bit, creating a magic function for a soon-to-be-started IPython | |
|
23 | def mymagic_f(self,s): | |
|
24 | print "mymagic says",s | |
|
25 | ||
|
26 | ip.expose_magic("mymagic",mymagic_f) | |
|
27 | ||
|
28 | # And finally, start the IPython interaction! This will block until you say Exit. | |
|
29 | ||
|
30 | ses.mainloop() | |
|
31 | ||
|
32 | print "IPython session finished! namespace content:",my_ns | |
|
1 | """ An example of one way to embed IPython in your own application | |
|
2 | ||
|
3 | This basically means starting up IPython with some of your programs objects visible in the IPython | |
|
4 | user namespace. | |
|
5 | ||
|
6 | """ | |
|
7 | ||
|
8 | import sys | |
|
9 | sys.path.append('..') | |
|
10 | ||
|
11 | import IPython.ipapi | |
|
12 | ||
|
13 | my_ns = dict(a=10) | |
|
14 | ||
|
15 | ses = IPython.ipapi.make_session(my_ns) | |
|
16 | ||
|
17 | # Now get the ipapi instance, to be stored somewhere in your program for manipulation of the running | |
|
18 | # IPython session. See http://ipython.scipy.org/moin/IpythonExtensionApi | |
|
19 | ||
|
20 | ip = ses.IP.getapi() | |
|
21 | ||
|
22 | # let's play with the ipapi a bit, creating a magic function for a soon-to-be-started IPython | |
|
23 | def mymagic_f(self,s): | |
|
24 | print "mymagic says",s | |
|
25 | ||
|
26 | ip.expose_magic("mymagic",mymagic_f) | |
|
27 | ||
|
28 | # And finally, start the IPython interaction! This will block until you say Exit. | |
|
29 | ||
|
30 | ses.mainloop() | |
|
31 | ||
|
32 | print "IPython session finished! namespace content:",my_ns |
@@ -1,54 +1,54 b'' | |||
|
1 | import sys | |
|
2 | sys.path.append('..') | |
|
3 | ||
|
4 | import IPython.ipapi | |
|
5 | IPython.ipapi.make_session() | |
|
6 | ip = IPython.ipapi.get() | |
|
7 | ||
|
8 | def test_runlines(): | |
|
9 | import textwrap | |
|
10 | ip.runlines(['a = 10', 'a+=1']) | |
|
11 | ip.runlines('assert a == 11\nassert 1') | |
|
12 | ||
|
13 | assert ip.user_ns['a'] == 11 | |
|
14 | complex = textwrap.dedent("""\ | |
|
15 | if 1: | |
|
16 | print "hello" | |
|
17 | if 1: | |
|
18 | print "world" | |
|
19 | ||
|
20 | if 1: | |
|
21 | print "foo" | |
|
22 | if 1: | |
|
23 | print "bar" | |
|
24 | ||
|
25 | if 1: | |
|
26 | print "bar" | |
|
27 | ||
|
28 | """) | |
|
29 | ||
|
30 | ||
|
31 | ip.runlines(complex) | |
|
32 | ||
|
33 | ||
|
34 | def test_db(): | |
|
35 | ip.db['__unittest_'] = 12 | |
|
36 | assert ip.db['__unittest_'] == 12 | |
|
37 | del ip.db['__unittest_'] | |
|
38 | assert '__unittest_' not in ip.db | |
|
39 | ||
|
40 | def test_defalias(): | |
|
41 | slot = [None] | |
|
42 | # test callable alias | |
|
43 | def cb(localip,s): | |
|
44 | assert localip is ip | |
|
45 | slot[0] = s | |
|
46 | ||
|
47 | ip.defalias('testalias', cb) | |
|
48 | ip.runlines('testalias foo bar') | |
|
49 | assert slot[0] == 'testalias foo bar' | |
|
50 | ||
|
51 | ||
|
52 | test_runlines() | |
|
53 | test_db() | |
|
54 | test_defalias | |
|
1 | import sys | |
|
2 | sys.path.append('..') | |
|
3 | ||
|
4 | import IPython.ipapi | |
|
5 | IPython.ipapi.make_session() | |
|
6 | ip = IPython.ipapi.get() | |
|
7 | ||
|
8 | def test_runlines(): | |
|
9 | import textwrap | |
|
10 | ip.runlines(['a = 10', 'a+=1']) | |
|
11 | ip.runlines('assert a == 11\nassert 1') | |
|
12 | ||
|
13 | assert ip.user_ns['a'] == 11 | |
|
14 | complex = textwrap.dedent("""\ | |
|
15 | if 1: | |
|
16 | print "hello" | |
|
17 | if 1: | |
|
18 | print "world" | |
|
19 | ||
|
20 | if 1: | |
|
21 | print "foo" | |
|
22 | if 1: | |
|
23 | print "bar" | |
|
24 | ||
|
25 | if 1: | |
|
26 | print "bar" | |
|
27 | ||
|
28 | """) | |
|
29 | ||
|
30 | ||
|
31 | ip.runlines(complex) | |
|
32 | ||
|
33 | ||
|
34 | def test_db(): | |
|
35 | ip.db['__unittest_'] = 12 | |
|
36 | assert ip.db['__unittest_'] == 12 | |
|
37 | del ip.db['__unittest_'] | |
|
38 | assert '__unittest_' not in ip.db | |
|
39 | ||
|
40 | def test_defalias(): | |
|
41 | slot = [None] | |
|
42 | # test callable alias | |
|
43 | def cb(localip,s): | |
|
44 | assert localip is ip | |
|
45 | slot[0] = s | |
|
46 | ||
|
47 | ip.defalias('testalias', cb) | |
|
48 | ip.runlines('testalias foo bar') | |
|
49 | assert slot[0] == 'testalias foo bar' | |
|
50 | ||
|
51 | ||
|
52 | test_runlines() | |
|
53 | test_db() | |
|
54 | test_defalias |
@@ -1,141 +1,141 b'' | |||
|
1 | #!python | |
|
2 | """Windows-specific part of the installation""" | |
|
3 | ||
|
4 | import os, sys | |
|
5 | ||
|
6 | try: | |
|
7 | import shutil,pythoncom | |
|
8 | from win32com.shell import shell | |
|
9 | import _winreg as wreg | |
|
10 | except ImportError: | |
|
11 | print """ | |
|
12 | You seem to be missing the PythonWin extensions necessary for automatic | |
|
13 | installation. You can get them (free) from | |
|
14 | http://starship.python.net/crew/mhammond/ | |
|
15 | ||
|
16 | Please see the manual for details if you want to finish the installation by | |
|
17 | hand, or get PythonWin and repeat the procedure. | |
|
18 | ||
|
19 | Press <Enter> to exit this installer.""" | |
|
20 | raw_input() | |
|
21 | sys.exit() | |
|
22 | ||
|
23 | ||
|
24 | def make_shortcut(fname,target,args='',start_in='',comment='',icon=None): | |
|
25 | """Make a Windows shortcut (.lnk) file. | |
|
26 | ||
|
27 | make_shortcut(fname,target,args='',start_in='',comment='',icon=None) | |
|
28 | ||
|
29 | Arguments: | |
|
30 | fname - name of the final shortcut file (include the .lnk) | |
|
31 | target - what the shortcut will point to | |
|
32 | args - additional arguments to pass to the target program | |
|
33 | start_in - directory where the target command will be called | |
|
34 | comment - for the popup tooltips | |
|
35 | icon - optional icon file. This must be a tuple of the type | |
|
36 | (icon_file,index), where index is the index of the icon you want | |
|
37 | in the file. For single .ico files, index=0, but for icon libraries | |
|
38 | contained in a single file it can be >0. | |
|
39 | """ | |
|
40 | ||
|
41 | shortcut = pythoncom.CoCreateInstance( | |
|
42 | shell.CLSID_ShellLink, None, | |
|
43 | pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink | |
|
44 | ) | |
|
45 | shortcut.SetPath(target) | |
|
46 | shortcut.SetArguments(args) | |
|
47 | shortcut.SetWorkingDirectory(start_in) | |
|
48 | shortcut.SetDescription(comment) | |
|
49 | if icon: | |
|
50 | shortcut.SetIconLocation(*icon) | |
|
51 | shortcut.QueryInterface(pythoncom.IID_IPersistFile).Save(fname,0) | |
|
52 | ||
|
53 | ||
|
54 | def run(wait=0): | |
|
55 | # Find where the Start Menu and My Documents are on the filesystem | |
|
56 | key = wreg.OpenKey(wreg.HKEY_CURRENT_USER, | |
|
57 | r'Software\Microsoft\Windows\CurrentVersion' | |
|
58 | r'\Explorer\Shell Folders') | |
|
59 | ||
|
60 | programs_dir = wreg.QueryValueEx(key,'Programs')[0] | |
|
61 | my_documents_dir = wreg.QueryValueEx(key,'Personal')[0] | |
|
62 | key.Close() | |
|
63 | ||
|
64 | # Find where the 'program files' directory is | |
|
65 | key = wreg.OpenKey(wreg.HKEY_LOCAL_MACHINE, | |
|
66 | r'SOFTWARE\Microsoft\Windows\CurrentVersion') | |
|
67 | ||
|
68 | program_files_dir = wreg.QueryValueEx(key,'ProgramFilesDir')[0] | |
|
69 | key.Close() | |
|
70 | ||
|
71 | ||
|
72 | # File and directory names | |
|
73 | ip_dir = program_files_dir + r'\IPython' | |
|
74 | ip_prog_dir = programs_dir + r'\IPython' | |
|
75 | doc_dir = ip_dir+r'\doc' | |
|
76 | ip_filename = ip_dir+r'\IPython_shell.py' | |
|
77 | pycon_icon = doc_dir+r'\pycon.ico' | |
|
78 | ||
|
79 | if not os.path.isdir(ip_dir): | |
|
80 | os.mkdir(ip_dir) | |
|
81 | ||
|
82 | # Copy startup script and documentation | |
|
83 | shutil.copy(sys.prefix+r'\Scripts\ipython',ip_filename) | |
|
84 | if os.path.isdir(doc_dir): | |
|
85 | shutil.rmtree(doc_dir) | |
|
86 | shutil.copytree('doc',doc_dir) | |
|
87 | ||
|
88 | # make shortcuts for IPython, html and pdf docs. | |
|
89 | print 'Making entries for IPython in Start Menu...', | |
|
90 | ||
|
91 | # Create .bat file in \Scripts | |
|
92 | fic = open(sys.prefix + r'\Scripts\ipython.bat','w') | |
|
93 | fic.write('"' + sys.prefix + r'\python.exe' + '" -i ' + '"' + | |
|
94 | sys.prefix + r'\Scripts\ipython" %*') | |
|
95 | fic.close() | |
|
96 | ||
|
97 | # Create .bat file in \\Scripts | |
|
98 | fic = open(sys.prefix + '\\Scripts\\ipython.bat','w') | |
|
99 | fic.write('"' + sys.prefix + '\\python.exe' + '" -i ' + '"' + sys.prefix + '\\Scripts\ipython" %*') | |
|
100 | fic.close() | |
|
101 | ||
|
102 | # Create shortcuts in Programs\IPython: | |
|
103 | if not os.path.isdir(ip_prog_dir): | |
|
104 | os.mkdir(ip_prog_dir) | |
|
105 | os.chdir(ip_prog_dir) | |
|
106 | ||
|
107 | man_pdf = doc_dir + r'\manual.pdf' | |
|
108 | man_htm = doc_dir + r'\manual\manual.html' | |
|
109 | ||
|
110 | make_shortcut('IPython.lnk',sys.executable, '"%s"' % ip_filename, | |
|
111 | my_documents_dir, | |
|
112 | 'IPython - Enhanced python command line interpreter', | |
|
113 | (pycon_icon,0)) | |
|
114 | make_shortcut('pysh.lnk',sys.executable, '"%s" -p pysh' % ip_filename, | |
|
115 | my_documents_dir, | |
|
116 | 'pysh - a system shell with Python syntax (IPython based)', | |
|
117 | (pycon_icon,0)) | |
|
118 | make_shortcut('Manual in HTML format.lnk',man_htm,'','', | |
|
119 | 'IPython Manual - HTML format') | |
|
120 | make_shortcut('Manual in PDF format.lnk',man_pdf,'','', | |
|
121 | 'IPython Manual - PDF format') | |
|
122 | ||
|
123 | print """Done. | |
|
124 | ||
|
125 | I created the directory %s. There you will find the | |
|
126 | IPython startup script and manuals. | |
|
127 | ||
|
128 | An IPython menu was also created in your Start Menu, with entries for | |
|
129 | IPython itself and the manual in HTML and PDF formats. | |
|
130 | ||
|
131 | For reading PDF documents you need the freely available Adobe Acrobat | |
|
132 | Reader. If you don't have it, you can download it from: | |
|
133 | http://www.adobe.com/products/acrobat/readstep2.html | |
|
134 | """ % ip_dir | |
|
135 | ||
|
136 | if wait: | |
|
137 | print "Finished with IPython installation. Press Enter to exit this installer.", | |
|
138 | raw_input() | |
|
139 | ||
|
140 | if __name__ == '__main__': | |
|
141 | run() | |
|
1 | #!python | |
|
2 | """Windows-specific part of the installation""" | |
|
3 | ||
|
4 | import os, sys | |
|
5 | ||
|
6 | try: | |
|
7 | import shutil,pythoncom | |
|
8 | from win32com.shell import shell | |
|
9 | import _winreg as wreg | |
|
10 | except ImportError: | |
|
11 | print """ | |
|
12 | You seem to be missing the PythonWin extensions necessary for automatic | |
|
13 | installation. You can get them (free) from | |
|
14 | http://starship.python.net/crew/mhammond/ | |
|
15 | ||
|
16 | Please see the manual for details if you want to finish the installation by | |
|
17 | hand, or get PythonWin and repeat the procedure. | |
|
18 | ||
|
19 | Press <Enter> to exit this installer.""" | |
|
20 | raw_input() | |
|
21 | sys.exit() | |
|
22 | ||
|
23 | ||
|
24 | def make_shortcut(fname,target,args='',start_in='',comment='',icon=None): | |
|
25 | """Make a Windows shortcut (.lnk) file. | |
|
26 | ||
|
27 | make_shortcut(fname,target,args='',start_in='',comment='',icon=None) | |
|
28 | ||
|
29 | Arguments: | |
|
30 | fname - name of the final shortcut file (include the .lnk) | |
|
31 | target - what the shortcut will point to | |
|
32 | args - additional arguments to pass to the target program | |
|
33 | start_in - directory where the target command will be called | |
|
34 | comment - for the popup tooltips | |
|
35 | icon - optional icon file. This must be a tuple of the type | |
|
36 | (icon_file,index), where index is the index of the icon you want | |
|
37 | in the file. For single .ico files, index=0, but for icon libraries | |
|
38 | contained in a single file it can be >0. | |
|
39 | """ | |
|
40 | ||
|
41 | shortcut = pythoncom.CoCreateInstance( | |
|
42 | shell.CLSID_ShellLink, None, | |
|
43 | pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink | |
|
44 | ) | |
|
45 | shortcut.SetPath(target) | |
|
46 | shortcut.SetArguments(args) | |
|
47 | shortcut.SetWorkingDirectory(start_in) | |
|
48 | shortcut.SetDescription(comment) | |
|
49 | if icon: | |
|
50 | shortcut.SetIconLocation(*icon) | |
|
51 | shortcut.QueryInterface(pythoncom.IID_IPersistFile).Save(fname,0) | |
|
52 | ||
|
53 | ||
|
54 | def run(wait=0): | |
|
55 | # Find where the Start Menu and My Documents are on the filesystem | |
|
56 | key = wreg.OpenKey(wreg.HKEY_CURRENT_USER, | |
|
57 | r'Software\Microsoft\Windows\CurrentVersion' | |
|
58 | r'\Explorer\Shell Folders') | |
|
59 | ||
|
60 | programs_dir = wreg.QueryValueEx(key,'Programs')[0] | |
|
61 | my_documents_dir = wreg.QueryValueEx(key,'Personal')[0] | |
|
62 | key.Close() | |
|
63 | ||
|
64 | # Find where the 'program files' directory is | |
|
65 | key = wreg.OpenKey(wreg.HKEY_LOCAL_MACHINE, | |
|
66 | r'SOFTWARE\Microsoft\Windows\CurrentVersion') | |
|
67 | ||
|
68 | program_files_dir = wreg.QueryValueEx(key,'ProgramFilesDir')[0] | |
|
69 | key.Close() | |
|
70 | ||
|
71 | ||
|
72 | # File and directory names | |
|
73 | ip_dir = program_files_dir + r'\IPython' | |
|
74 | ip_prog_dir = programs_dir + r'\IPython' | |
|
75 | doc_dir = ip_dir+r'\doc' | |
|
76 | ip_filename = ip_dir+r'\IPython_shell.py' | |
|
77 | pycon_icon = doc_dir+r'\pycon.ico' | |
|
78 | ||
|
79 | if not os.path.isdir(ip_dir): | |
|
80 | os.mkdir(ip_dir) | |
|
81 | ||
|
82 | # Copy startup script and documentation | |
|
83 | shutil.copy(sys.prefix+r'\Scripts\ipython',ip_filename) | |
|
84 | if os.path.isdir(doc_dir): | |
|
85 | shutil.rmtree(doc_dir) | |
|
86 | shutil.copytree('doc',doc_dir) | |
|
87 | ||
|
88 | # make shortcuts for IPython, html and pdf docs. | |
|
89 | print 'Making entries for IPython in Start Menu...', | |
|
90 | ||
|
91 | # Create .bat file in \Scripts | |
|
92 | fic = open(sys.prefix + r'\Scripts\ipython.bat','w') | |
|
93 | fic.write('"' + sys.prefix + r'\python.exe' + '" -i ' + '"' + | |
|
94 | sys.prefix + r'\Scripts\ipython" %*') | |
|
95 | fic.close() | |
|
96 | ||
|
97 | # Create .bat file in \\Scripts | |
|
98 | fic = open(sys.prefix + '\\Scripts\\ipython.bat','w') | |
|
99 | fic.write('"' + sys.prefix + '\\python.exe' + '" -i ' + '"' + sys.prefix + '\\Scripts\ipython" %*') | |
|
100 | fic.close() | |
|
101 | ||
|
102 | # Create shortcuts in Programs\IPython: | |
|
103 | if not os.path.isdir(ip_prog_dir): | |
|
104 | os.mkdir(ip_prog_dir) | |
|
105 | os.chdir(ip_prog_dir) | |
|
106 | ||
|
107 | man_pdf = doc_dir + r'\manual.pdf' | |
|
108 | man_htm = doc_dir + r'\manual\manual.html' | |
|
109 | ||
|
110 | make_shortcut('IPython.lnk',sys.executable, '"%s"' % ip_filename, | |
|
111 | my_documents_dir, | |
|
112 | 'IPython - Enhanced python command line interpreter', | |
|
113 | (pycon_icon,0)) | |
|
114 | make_shortcut('pysh.lnk',sys.executable, '"%s" -p pysh' % ip_filename, | |
|
115 | my_documents_dir, | |
|
116 | 'pysh - a system shell with Python syntax (IPython based)', | |
|
117 | (pycon_icon,0)) | |
|
118 | make_shortcut('Manual in HTML format.lnk',man_htm,'','', | |
|
119 | 'IPython Manual - HTML format') | |
|
120 | make_shortcut('Manual in PDF format.lnk',man_pdf,'','', | |
|
121 | 'IPython Manual - PDF format') | |
|
122 | ||
|
123 | print """Done. | |
|
124 | ||
|
125 | I created the directory %s. There you will find the | |
|
126 | IPython startup script and manuals. | |
|
127 | ||
|
128 | An IPython menu was also created in your Start Menu, with entries for | |
|
129 | IPython itself and the manual in HTML and PDF formats. | |
|
130 | ||
|
131 | For reading PDF documents you need the freely available Adobe Acrobat | |
|
132 | Reader. If you don't have it, you can download it from: | |
|
133 | http://www.adobe.com/products/acrobat/readstep2.html | |
|
134 | """ % ip_dir | |
|
135 | ||
|
136 | if wait: | |
|
137 | print "Finished with IPython installation. Press Enter to exit this installer.", | |
|
138 | raw_input() | |
|
139 | ||
|
140 | if __name__ == '__main__': | |
|
141 | run() |
General Comments 0
You need to be logged in to leave comments.
Login now