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