##// END OF EJS Templates
More updates for release of 0.9.rc1....
Fernando Perez -
Show More
@@ -1,32 +1,33 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 include setupbase.py
4 include setupbase.py
5
5
6 graft scripts
6 graft scripts
7
7
8 graft setupext
8 graft setupext
9
9
10 graft IPython/UserConfig
10 graft IPython/UserConfig
11
11
12 graft IPython/kernel
12 graft IPython/kernel
13 graft IPython/config
13 graft IPython/config
14 graft IPython/testing
14 graft IPython/testing
15 graft IPython/tools
15 graft IPython/tools
16
16
17 recursive-include IPython/Extensions igrid_help*
17 recursive-include IPython/Extensions igrid_help*
18
18
19 graft docs
19 graft docs
20 exclude docs/\#*
20 exclude docs/\#*
21 exclude docs/man/*.1
21 exclude docs/man/*.1
22
22
23 # docs subdirs we want to skip
23 # docs subdirs we want to skip
24 prune docs/attic
24 prune docs/attic
25 prune docs/build
25 prune docs/build
26
26
27 global-exclude *~
27 global-exclude *~
28 global-exclude *.flc
28 global-exclude *.flc
29 global-exclude *.pyc
29 global-exclude *.pyc
30 global-exclude .dircopy.log
30 global-exclude .dircopy.log
31 global-exclude .svn
31 global-exclude .svn
32 global-exclude .bzr
32 global-exclude .bzr
33 global-exclude .hgignore
1 NO CONTENT: modified file chmod 100644 => 100755
NO CONTENT: modified file chmod 100644 => 100755
@@ -1,85 +1,89 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, shutil
4 import os, sys, shutil
5
5
6 def mkshortcut(target,description,link_file,*args,**kw):
6 def mkshortcut(target,description,link_file,*args,**kw):
7 """make a shortcut if it doesn't exist, and register its creation"""
7 """make a shortcut if it doesn't exist, and register its creation"""
8
8
9 create_shortcut(target, description, link_file,*args,**kw)
9 create_shortcut(target, description, link_file,*args,**kw)
10 file_created(link_file)
10 file_created(link_file)
11
11
12 def install():
12 def install():
13 """Routine to be run by the win32 installer with the -install switch."""
13 """Routine to be run by the win32 installer with the -install switch."""
14
14
15 from IPython.Release import version
15 from IPython.Release import version
16
16
17 # Get some system constants
17 # Get some system constants
18 prefix = sys.prefix
18 prefix = sys.prefix
19 python = prefix + r'\python.exe'
19 python = prefix + r'\python.exe'
20 # Lookup path to common startmenu ...
20 # Lookup path to common startmenu ...
21 ip_dir = get_special_folder_path('CSIDL_COMMON_PROGRAMS') + r'\IPython'
21 ip_dir = get_special_folder_path('CSIDL_COMMON_PROGRAMS') + r'\IPython'
22
22
23 # Some usability warnings at installation time. I don't want them at the
23 # Some usability warnings at installation time. I don't want them at the
24 # top-level, so they don't appear if the user is uninstalling.
24 # top-level, so they don't appear if the user is uninstalling.
25 try:
25 try:
26 import ctypes
26 import ctypes
27 except ImportError:
27 except ImportError:
28 print ('To take full advantage of IPython, you need ctypes from:\n'
28 print ('To take full advantage of IPython, you need ctypes from:\n'
29 'http://sourceforge.net/projects/ctypes')
29 'http://sourceforge.net/projects/ctypes')
30
30
31 try:
31 try:
32 import win32con
32 import win32con
33 except ImportError:
33 except ImportError:
34 print ('To take full advantage of IPython, you need pywin32 from:\n'
34 print ('To take full advantage of IPython, you need pywin32 from:\n'
35 'http://starship.python.net/crew/mhammond/win32/Downloads.html')
35 'http://starship.python.net/crew/mhammond/win32/Downloads.html')
36
36
37 try:
37 try:
38 import readline
38 import readline
39 except ImportError:
39 except ImportError:
40 print ('To take full advantage of IPython, you need readline from:\n'
40 print ('To take full advantage of IPython, you need readline from:\n'
41 'http://sourceforge.net/projects/uncpythontools')
41 'https://launchpad.net/pyreadline')
42
42
43 ipybase = '"' + prefix + r'\scripts\ipython"'
43 ipybase = '"' + prefix + r'\scripts\ipython"'
44 # Create IPython entry ...
44 # Create IPython entry ...
45 if not os.path.isdir(ip_dir):
45 if not os.path.isdir(ip_dir):
46 os.mkdir(ip_dir)
46 os.mkdir(ip_dir)
47 directory_created(ip_dir)
47 directory_created(ip_dir)
48
48
49 # Create program shortcuts ...
49 # Create program shortcuts ...
50 f = ip_dir + r'\IPython.lnk'
50 f = ip_dir + r'\IPython.lnk'
51 a = ipybase
51 a = ipybase
52 mkshortcut(python,'IPython',f,a)
52 mkshortcut(python,'IPython',f,a)
53
53
54 f = ip_dir + r'\pysh.lnk'
54 f = ip_dir + r'\pysh.lnk'
55 a = ipybase+' -p sh'
55 a = ipybase+' -p sh'
56 mkshortcut(python,'IPython command prompt mode',f,a)
56 mkshortcut(python,'IPython (command prompt mode)',f,a)
57
58 f = ip_dir + r'\pylab.lnk'
59 a = ipybase+' -pylab'
60 mkshortcut(python,'IPython (PyLab mode)',f,a)
57
61
58 f = ip_dir + r'\scipy.lnk'
62 f = ip_dir + r'\scipy.lnk'
59 a = ipybase+' -pylab -p scipy'
63 a = ipybase+' -pylab -p scipy'
60 mkshortcut(python,'IPython scipy profile',f,a)
64 mkshortcut(python,'IPython (scipy profile)',f,a)
61
65
62 # Create documentation shortcuts ...
66 # Create documentation shortcuts ...
63 t = prefix + r'\share\doc\ipython\manual\ipython.pdf'
67 t = prefix + r'\share\doc\ipython\manual\ipython.pdf'
64 f = ip_dir + r'\Manual in PDF.lnk'
68 f = ip_dir + r'\Manual in PDF.lnk'
65 mkshortcut(t,r'IPython Manual - PDF-Format',f)
69 mkshortcut(t,r'IPython Manual - PDF-Format',f)
66
70
67 t = prefix + r'\share\doc\ipython\manual\html\index.html'
71 t = prefix + r'\share\doc\ipython\manual\html\index.html'
68 f = ip_dir + r'\Manual in HTML.lnk'
72 f = ip_dir + r'\Manual in HTML.lnk'
69 mkshortcut(t,'IPython Manual - HTML-Format',f)
73 mkshortcut(t,'IPython Manual - HTML-Format',f)
70
74
71 # make ipython.py
75 # make ipython.py
72 shutil.copy(prefix + r'\scripts\ipython', prefix + r'\scripts\ipython.py')
76 shutil.copy(prefix + r'\scripts\ipython', prefix + r'\scripts\ipython.py')
73
77
74 def remove():
78 def remove():
75 """Routine to be run by the win32 installer with the -remove switch."""
79 """Routine to be run by the win32 installer with the -remove switch."""
76 pass
80 pass
77
81
78 # main()
82 # main()
79 if len(sys.argv) > 1:
83 if len(sys.argv) > 1:
80 if sys.argv[1] == '-install':
84 if sys.argv[1] == '-install':
81 install()
85 install()
82 elif sys.argv[1] == '-remove':
86 elif sys.argv[1] == '-remove':
83 remove()
87 remove()
84 else:
88 else:
85 print "Script was called with option %s" % sys.argv[1]
89 print "Script was called with option %s" % sys.argv[1]
@@ -1,277 +1,278 b''
1 # encoding: utf-8
1 # encoding: utf-8
2
2
3 """
3 """
4 This module defines the things that are used in setup.py for building IPython
4 This module defines the things that are used in setup.py for building IPython
5
5
6 This includes:
6 This includes:
7
7
8 * The basic arguments to setup
8 * The basic arguments to setup
9 * Functions for finding things like packages, package data, etc.
9 * Functions for finding things like packages, package data, etc.
10 * A function for checking dependencies.
10 * A function for checking dependencies.
11 """
11 """
12
12
13 __docformat__ = "restructuredtext en"
13 __docformat__ = "restructuredtext en"
14
14
15 #-------------------------------------------------------------------------------
15 #-------------------------------------------------------------------------------
16 # Copyright (C) 2008 The IPython Development Team
16 # Copyright (C) 2008 The IPython Development Team
17 #
17 #
18 # Distributed under the terms of the BSD License. The full license is in
18 # Distributed under the terms of the BSD License. The full license is in
19 # the file COPYING, distributed as part of this software.
19 # the file COPYING, distributed as part of this software.
20 #-------------------------------------------------------------------------------
20 #-------------------------------------------------------------------------------
21
21
22 #-------------------------------------------------------------------------------
22 #-------------------------------------------------------------------------------
23 # Imports
23 # Imports
24 #-------------------------------------------------------------------------------
24 #-------------------------------------------------------------------------------
25
25
26 import os, sys
26 import os, sys
27
27
28 from glob import glob
28 from glob import glob
29
29
30 from setupext import install_data_ext
30 from setupext import install_data_ext
31
31
32 #-------------------------------------------------------------------------------
32 #-------------------------------------------------------------------------------
33 # Useful globals and utility functions
33 # Useful globals and utility functions
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 def oscmd(s):
40 def oscmd(s):
41 print ">", s
41 print ">", s
42 os.system(s)
42 os.system(s)
43
43
44 # A little utility we'll need below, since glob() does NOT allow you to do
44 # A little utility we'll need below, since glob() does NOT allow you to do
45 # exclusion on multiple endings!
45 # exclusion on multiple endings!
46 def file_doesnt_endwith(test,endings):
46 def file_doesnt_endwith(test,endings):
47 """Return true if test is a file and its name does NOT end with any
47 """Return true if test is a file and its name does NOT end with any
48 of the strings listed in endings."""
48 of the strings listed in endings."""
49 if not isfile(test):
49 if not isfile(test):
50 return False
50 return False
51 for e in endings:
51 for e in endings:
52 if test.endswith(e):
52 if test.endswith(e):
53 return False
53 return False
54 return True
54 return True
55
55
56 #---------------------------------------------------------------------------
56 #---------------------------------------------------------------------------
57 # Basic project information
57 # Basic project information
58 #---------------------------------------------------------------------------
58 #---------------------------------------------------------------------------
59
59
60 # Release.py contains version, authors, license, url, keywords, etc.
60 # Release.py contains version, authors, license, url, keywords, etc.
61 execfile(pjoin('IPython','Release.py'))
61 execfile(pjoin('IPython','Release.py'))
62
62
63 # Create a dict with the basic information
63 # Create a dict with the basic information
64 # This dict is eventually passed to setup after additional keys are added.
64 # This dict is eventually passed to setup after additional keys are added.
65 setup_args = dict(
65 setup_args = dict(
66 name = name,
66 name = name,
67 version = version,
67 version = version,
68 description = description,
68 description = description,
69 long_description = long_description,
69 long_description = long_description,
70 author = author,
70 author = author,
71 author_email = author_email,
71 author_email = author_email,
72 url = url,
72 url = url,
73 download_url = download_url,
73 download_url = download_url,
74 license = license,
74 license = license,
75 platforms = platforms,
75 platforms = platforms,
76 keywords = keywords,
76 keywords = keywords,
77 cmdclass = {'install_data': install_data_ext},
77 cmdclass = {'install_data': install_data_ext},
78 )
78 )
79
79
80
80
81 #---------------------------------------------------------------------------
81 #---------------------------------------------------------------------------
82 # Find packages
82 # Find packages
83 #---------------------------------------------------------------------------
83 #---------------------------------------------------------------------------
84
84
85 def add_package(packages,pname,config=False,tests=False,scripts=False,
85 def add_package(packages,pname,config=False,tests=False,scripts=False,
86 others=None):
86 others=None):
87 """
87 """
88 Add a package to the list of packages, including certain subpackages.
88 Add a package to the list of packages, including certain subpackages.
89 """
89 """
90 packages.append('.'.join(['IPython',pname]))
90 packages.append('.'.join(['IPython',pname]))
91 if config:
91 if config:
92 packages.append('.'.join(['IPython',pname,'config']))
92 packages.append('.'.join(['IPython',pname,'config']))
93 if tests:
93 if tests:
94 packages.append('.'.join(['IPython',pname,'tests']))
94 packages.append('.'.join(['IPython',pname,'tests']))
95 if scripts:
95 if scripts:
96 packages.append('.'.join(['IPython',pname,'scripts']))
96 packages.append('.'.join(['IPython',pname,'scripts']))
97 if others is not None:
97 if others is not None:
98 for o in others:
98 for o in others:
99 packages.append('.'.join(['IPython',pname,o]))
99 packages.append('.'.join(['IPython',pname,o]))
100
100
101 def find_packages():
101 def find_packages():
102 """
102 """
103 Find all of IPython's packages.
103 Find all of IPython's packages.
104 """
104 """
105 packages = ['IPython']
105 packages = ['IPython']
106 add_package(packages, 'config', tests=True)
106 add_package(packages, 'config', tests=True)
107 add_package(packages , 'Extensions')
107 add_package(packages , 'Extensions')
108 add_package(packages, 'external')
108 add_package(packages, 'external')
109 add_package(packages, 'gui')
109 add_package(packages, 'gui')
110 add_package(packages, 'gui.wx')
110 add_package(packages, 'gui.wx')
111 add_package(packages, 'frontend', tests=True)
111 add_package(packages, 'frontend', tests=True)
112 add_package(packages, 'frontend._process')
112 add_package(packages, 'frontend._process')
113 add_package(packages, 'frontend.wx')
113 add_package(packages, 'frontend.wx')
114 add_package(packages, 'frontend.cocoa', tests=True)
114 add_package(packages, 'frontend.cocoa', tests=True)
115 add_package(packages, 'kernel', config=True, tests=True, scripts=True)
115 add_package(packages, 'kernel', config=True, tests=True, scripts=True)
116 add_package(packages, 'kernel.core', config=True, tests=True)
116 add_package(packages, 'kernel.core', config=True, tests=True)
117 add_package(packages, 'testing', tests=True)
117 add_package(packages, 'testing', tests=True)
118 add_package(packages, 'testing.plugin', tests=False)
118 add_package(packages, 'testing.plugin', tests=False)
119 add_package(packages, 'tools', tests=True)
119 add_package(packages, 'tools', tests=True)
120 add_package(packages, 'UserConfig')
120 add_package(packages, 'UserConfig')
121 return packages
121 return packages
122
122
123 #---------------------------------------------------------------------------
123 #---------------------------------------------------------------------------
124 # Find package data
124 # Find package data
125 #---------------------------------------------------------------------------
125 #---------------------------------------------------------------------------
126
126
127 def find_package_data():
127 def find_package_data():
128 """
128 """
129 Find IPython's package_data.
129 Find IPython's package_data.
130 """
130 """
131 # This is not enough for these things to appear in an sdist.
131 # This is not enough for these things to appear in an sdist.
132 # We need to muck with the MANIFEST to get this to work
132 # We need to muck with the MANIFEST to get this to work
133 package_data = {
133 package_data = {
134 'IPython.UserConfig' : ['*'],
134 'IPython.UserConfig' : ['*'],
135 'IPython.tools.tests' : ['*.txt'],
135 'IPython.tools.tests' : ['*.txt'],
136 'IPython.testing' : ['*.txt']
136 'IPython.testing' : ['*.txt']
137 }
137 }
138 return package_data
138 return package_data
139
139
140
140
141 #---------------------------------------------------------------------------
141 #---------------------------------------------------------------------------
142 # Find data files
142 # Find data files
143 #---------------------------------------------------------------------------
143 #---------------------------------------------------------------------------
144
144
145 def make_dir_struct(tag,base,out_base):
145 def make_dir_struct(tag,base,out_base):
146 """Make the directory structure of all files below a starting dir.
146 """Make the directory structure of all files below a starting dir.
147
147
148 This is just a convenience routine to help build a nested directory
148 This is just a convenience routine to help build a nested directory
149 hierarchy because distutils is too stupid to do this by itself.
149 hierarchy because distutils is too stupid to do this by itself.
150
150
151 XXX - this needs a proper docstring!
151 XXX - this needs a proper docstring!
152 """
152 """
153
153
154 # we'll use these a lot below
154 # we'll use these a lot below
155 lbase = len(base)
155 lbase = len(base)
156 pathsep = os.path.sep
156 pathsep = os.path.sep
157 lpathsep = len(pathsep)
157 lpathsep = len(pathsep)
158
158
159 out = []
159 out = []
160 for (dirpath,dirnames,filenames) in os.walk(base):
160 for (dirpath,dirnames,filenames) in os.walk(base):
161 # we need to strip out the dirpath from the base to map it to the
161 # we need to strip out the dirpath from the base to map it to the
162 # output (installation) path. This requires possibly stripping the
162 # output (installation) path. This requires possibly stripping the
163 # path separator, because otherwise pjoin will not work correctly
163 # path separator, because otherwise pjoin will not work correctly
164 # (pjoin('foo/','/bar') returns '/bar').
164 # (pjoin('foo/','/bar') returns '/bar').
165
165
166 dp_eff = dirpath[lbase:]
166 dp_eff = dirpath[lbase:]
167 if dp_eff.startswith(pathsep):
167 if dp_eff.startswith(pathsep):
168 dp_eff = dp_eff[lpathsep:]
168 dp_eff = dp_eff[lpathsep:]
169 # The output path must be anchored at the out_base marker
169 # The output path must be anchored at the out_base marker
170 out_path = pjoin(out_base,dp_eff)
170 out_path = pjoin(out_base,dp_eff)
171 # Now we can generate the final filenames. Since os.walk only produces
171 # Now we can generate the final filenames. Since os.walk only produces
172 # filenames, we must join back with the dirpath to get full valid file
172 # filenames, we must join back with the dirpath to get full valid file
173 # paths:
173 # paths:
174 pfiles = [pjoin(dirpath,f) for f in filenames]
174 pfiles = [pjoin(dirpath,f) for f in filenames]
175 # Finally, generate the entry we need, which is a triple of (tag,output
175 # Finally, generate the entry we need, which is a triple of (tag,output
176 # path, files) for use as a data_files parameter in install_data.
176 # path, files) for use as a data_files parameter in install_data.
177 out.append((tag,out_path,pfiles))
177 out.append((tag,out_path,pfiles))
178
178
179 return out
179 return out
180
180
181
181
182 def find_data_files():
182 def find_data_files():
183 """
183 """
184 Find IPython's data_files.
184 Find IPython's data_files.
185
185
186 Most of these are docs.
186 Most of these are docs.
187 """
187 """
188
188
189 docdirbase = 'share/doc/ipython'
189 docdirbase = 'share/doc/ipython'
190 manpagebase = 'share/man/man1'
190 manpagebase = 'share/man/man1'
191
191
192 # Simple file lists can be made by hand
192 # Simple file lists can be made by hand
193 manpages = filter(isfile, glob('docs/man/*.1.gz'))
193 manpages = filter(isfile, glob('docs/man/*.1.gz'))
194 igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*'))
194 igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*'))
195
195
196 # For nested structures, use the utility above
196 # For nested structures, use the utility above
197 example_files = make_dir_struct('data','docs/examples',
197 example_files = make_dir_struct('data','docs/examples',
198 pjoin(docdirbase,'examples'))
198 pjoin(docdirbase,'examples'))
199 manual_files = make_dir_struct('data','docs/dist',pjoin(docdirbase,'manual'))
199 manual_files = make_dir_struct('data','docs/dist',pjoin(docdirbase,'manual'))
200
200
201 # And assemble the entire output list
201 # And assemble the entire output list
202 data_files = [ ('data',manpagebase, manpages),
202 data_files = [ ('data',manpagebase, manpages),
203 ('data',pjoin(docdirbase,'extensions'),igridhelpfiles),
203 ('data',pjoin(docdirbase,'extensions'),igridhelpfiles),
204 ] + manual_files + example_files
204 ] + manual_files + example_files
205
205
206 ## import pprint # dbg
206 ## import pprint # dbg
207 ## print '*'*80
207 ## print '*'*80
208 ## print 'data files'
208 ## print 'data files'
209 ## pprint.pprint(data_files)
209 ## pprint.pprint(data_files)
210 ## print '*'*80
210 ## print '*'*80
211
211
212 return data_files
212 return data_files
213
213
214 #---------------------------------------------------------------------------
214 #---------------------------------------------------------------------------
215 # Find scripts
215 # Find scripts
216 #---------------------------------------------------------------------------
216 #---------------------------------------------------------------------------
217
217
218 def find_scripts():
218 def find_scripts():
219 """
219 """
220 Find IPython's scripts.
220 Find IPython's scripts.
221 """
221 """
222 scripts = ['IPython/kernel/scripts/ipengine',
222 scripts = ['IPython/kernel/scripts/ipengine',
223 'IPython/kernel/scripts/ipcontroller',
223 'IPython/kernel/scripts/ipcontroller',
224 'IPython/kernel/scripts/ipcluster',
224 'IPython/kernel/scripts/ipcluster',
225 'scripts/ipython',
225 'scripts/ipython',
226 'scripts/ipythonx',
226 'scripts/ipythonx',
227 'scripts/ipython-wx',
227 'scripts/pycolor',
228 'scripts/pycolor',
228 'scripts/irunner',
229 'scripts/irunner',
229 'scripts/iptest',
230 'scripts/iptest',
230 ]
231 ]
231
232
232 # Script to be run by the windows binary installer after the default setup
233 # Script to be run by the windows binary installer after the default setup
233 # routine, to add shortcuts and similar windows-only things. Windows
234 # routine, to add shortcuts and similar windows-only things. Windows
234 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
235 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
235 # doesn't find them.
236 # doesn't find them.
236 if 'bdist_wininst' in sys.argv:
237 if 'bdist_wininst' in sys.argv:
237 if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
238 if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
238 print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting."
239 print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting."
239 sys.exit(1)
240 sys.exit(1)
240 scripts.append('scripts/ipython_win_post_install.py')
241 scripts.append('scripts/ipython_win_post_install.py')
241
242
242 return scripts
243 return scripts
243
244
244 #---------------------------------------------------------------------------
245 #---------------------------------------------------------------------------
245 # Verify all dependencies
246 # Verify all dependencies
246 #---------------------------------------------------------------------------
247 #---------------------------------------------------------------------------
247
248
248 def check_for_dependencies():
249 def check_for_dependencies():
249 """Check for IPython's dependencies.
250 """Check for IPython's dependencies.
250
251
251 This function should NOT be called if running under setuptools!
252 This function should NOT be called if running under setuptools!
252 """
253 """
253 from setupext.setupext import (
254 from setupext.setupext import (
254 print_line, print_raw, print_status, print_message,
255 print_line, print_raw, print_status, print_message,
255 check_for_zopeinterface, check_for_twisted,
256 check_for_zopeinterface, check_for_twisted,
256 check_for_foolscap, check_for_pyopenssl,
257 check_for_foolscap, check_for_pyopenssl,
257 check_for_sphinx, check_for_pygments,
258 check_for_sphinx, check_for_pygments,
258 check_for_nose, check_for_pexpect
259 check_for_nose, check_for_pexpect
259 )
260 )
260 print_line()
261 print_line()
261 print_raw("BUILDING IPYTHON")
262 print_raw("BUILDING IPYTHON")
262 print_status('python', sys.version)
263 print_status('python', sys.version)
263 print_status('platform', sys.platform)
264 print_status('platform', sys.platform)
264 if sys.platform == 'win32':
265 if sys.platform == 'win32':
265 print_status('Windows version', sys.getwindowsversion())
266 print_status('Windows version', sys.getwindowsversion())
266
267
267 print_raw("")
268 print_raw("")
268 print_raw("OPTIONAL DEPENDENCIES")
269 print_raw("OPTIONAL DEPENDENCIES")
269
270
270 check_for_zopeinterface()
271 check_for_zopeinterface()
271 check_for_twisted()
272 check_for_twisted()
272 check_for_foolscap()
273 check_for_foolscap()
273 check_for_pyopenssl()
274 check_for_pyopenssl()
274 check_for_sphinx()
275 check_for_sphinx()
275 check_for_pygments()
276 check_for_pygments()
276 check_for_nose()
277 check_for_nose()
277 check_for_pexpect()
278 check_for_pexpect()
@@ -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'\docs'
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('docs',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\ipython.pdf'
107 man_pdf = doc_dir + r'\dist\ipython.pdf'
108 man_htm = doc_dir + r'\manual\ipython.html'
108 man_htm = doc_dir + r'\dist\index.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