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