##// END OF EJS Templates
Merging -r 1192 from lp:ipython.
Brian Granger -
r2146:f57d8b10 merge
parent child Browse files
Show More
@@ -0,0 +1,55 b''
1 """Various utilities common to IPython release and maintenance tools.
2 """
3 # Library imports
4 import os
5 import sys
6
7 from distutils.dir_util import remove_tree
8
9 # Useful shorthands
10 pjoin = os.path.join
11 cd = os.chdir
12
13 # Utility functions
14 def c(cmd):
15 """Run system command, raise SystemExit if it returns an error."""
16 print "$",cmd
17 #stat = os.system(cmd)
18 stat = 0 # Uncomment this and comment previous to run in debug mode
19 if stat:
20 raise SystemExit("Command %s failed with code: %s" % (cmd, stat))
21
22
23 def get_ipdir():
24 """Get IPython directory from command line, or assume it's the one above."""
25
26 # Initialize arguments and check location
27 try:
28 ipdir = sys.argv[1]
29 except IndexError:
30 ipdir = '..'
31
32 ipdir = os.path.abspath(ipdir)
33
34 cd(ipdir)
35 if not os.path.isdir('IPython') and os.path.isfile('setup.py'):
36 raise SystemExit('Invalid ipython directory: %s' % ipdir)
37 return ipdir
38
39
40 def compile_tree():
41 """Compile all Python files below current directory."""
42 vstr = '.'.join(map(str,sys.version_info[:2]))
43 stat = os.system('python %s/lib/python%s/compileall.py .' %
44 (sys.prefix,vstr))
45 if stat:
46 msg = '*** ERROR: Some Python files in tree do NOT compile! ***\n'
47 msg += 'See messages above for the actual file that produced it.\n'
48 raise SystemExit(msg)
49
50
51 def version_info():
52 """Return bzr version info as a dict."""
53 out = os.popen('bzr version-info')
54 pairs = (l.split(':',1) for l in out)
55 return dict(((k,v.strip()) for (k,v) in pairs))
@@ -1,321 +1,321 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','core','release.py'))
61 execfile(pjoin('IPython','core','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, 'config.userconfig')
107 add_package(packages, 'config.userconfig')
108 add_package(packages, 'core', tests=True)
108 add_package(packages, 'core', tests=True)
109 add_package(packages, 'deathrow', tests=True)
109 add_package(packages, 'deathrow', tests=True)
110 add_package(packages , 'extensions')
110 add_package(packages , 'extensions')
111 add_package(packages, 'external')
111 add_package(packages, 'external')
112 add_package(packages, 'frontend', tests=True)
112 add_package(packages, 'frontend', tests=True)
113 # Don't include the cocoa frontend for now as it is not stable
113 # Don't include the cocoa frontend for now as it is not stable
114 if sys.platform == 'darwin' and False:
114 if sys.platform == 'darwin' and False:
115 add_package(packages, 'frontend.cocoa', tests=True, others=['plugin'])
115 add_package(packages, 'frontend.cocoa', tests=True, others=['plugin'])
116 add_package(packages, 'frontend.cocoa.examples')
116 add_package(packages, 'frontend.cocoa.examples')
117 add_package(packages, 'frontend.cocoa.examples.IPython1Sandbox')
117 add_package(packages, 'frontend.cocoa.examples.IPython1Sandbox')
118 add_package(packages, 'frontend.cocoa.examples.IPython1Sandbox.English.lproj')
118 add_package(packages, 'frontend.cocoa.examples.IPython1Sandbox.English.lproj')
119 add_package(packages, 'frontend.process')
119 add_package(packages, 'frontend.process')
120 add_package(packages, 'frontend.wx')
120 add_package(packages, 'frontend.wx')
121 add_package(packages, 'gui')
121 add_package(packages, 'gui')
122 add_package(packages, 'gui.wx')
122 add_package(packages, 'gui.wx')
123 add_package(packages, 'kernel', config=True, tests=True, scripts=True)
123 add_package(packages, 'kernel', config=True, tests=True, scripts=True)
124 add_package(packages, 'kernel.core', config=True, tests=True)
124 add_package(packages, 'kernel.core', config=True, tests=True)
125 add_package(packages, 'lib', tests=True)
125 add_package(packages, 'lib', tests=True)
126 add_package(packages, 'quarantine', tests=True)
126 add_package(packages, 'quarantine', tests=True)
127 add_package(packages, 'scripts')
127 add_package(packages, 'scripts')
128 add_package(packages, 'testing', tests=True)
128 add_package(packages, 'testing', tests=True)
129 add_package(packages, 'testing.plugin', tests=False)
129 add_package(packages, 'testing.plugin', tests=False)
130 add_package(packages, 'utils', tests=True)
130 add_package(packages, 'utils', tests=True)
131 return packages
131 return packages
132
132
133 #---------------------------------------------------------------------------
133 #---------------------------------------------------------------------------
134 # Find package data
134 # Find package data
135 #---------------------------------------------------------------------------
135 #---------------------------------------------------------------------------
136
136
137 def find_package_data():
137 def find_package_data():
138 """
138 """
139 Find IPython's package_data.
139 Find IPython's package_data.
140 """
140 """
141 # This is not enough for these things to appear in an sdist.
141 # This is not enough for these things to appear in an sdist.
142 # We need to muck with the MANIFEST to get this to work
142 # We need to muck with the MANIFEST to get this to work
143 package_data = {
143 package_data = {
144 'IPython.config.userconfig' : ['*'],
144 'IPython.config.userconfig' : ['*'],
145 'IPython.testing' : ['*.txt']
145 'IPython.testing' : ['*.txt']
146 }
146 }
147 return package_data
147 return package_data
148
148
149
149
150 #---------------------------------------------------------------------------
150 #---------------------------------------------------------------------------
151 # Find data files
151 # Find data files
152 #---------------------------------------------------------------------------
152 #---------------------------------------------------------------------------
153
153
154 def make_dir_struct(tag,base,out_base):
154 def make_dir_struct(tag,base,out_base):
155 """Make the directory structure of all files below a starting dir.
155 """Make the directory structure of all files below a starting dir.
156
156
157 This is just a convenience routine to help build a nested directory
157 This is just a convenience routine to help build a nested directory
158 hierarchy because distutils is too stupid to do this by itself.
158 hierarchy because distutils is too stupid to do this by itself.
159
159
160 XXX - this needs a proper docstring!
160 XXX - this needs a proper docstring!
161 """
161 """
162
162
163 # we'll use these a lot below
163 # we'll use these a lot below
164 lbase = len(base)
164 lbase = len(base)
165 pathsep = os.path.sep
165 pathsep = os.path.sep
166 lpathsep = len(pathsep)
166 lpathsep = len(pathsep)
167
167
168 out = []
168 out = []
169 for (dirpath,dirnames,filenames) in os.walk(base):
169 for (dirpath,dirnames,filenames) in os.walk(base):
170 # we need to strip out the dirpath from the base to map it to the
170 # we need to strip out the dirpath from the base to map it to the
171 # output (installation) path. This requires possibly stripping the
171 # output (installation) path. This requires possibly stripping the
172 # path separator, because otherwise pjoin will not work correctly
172 # path separator, because otherwise pjoin will not work correctly
173 # (pjoin('foo/','/bar') returns '/bar').
173 # (pjoin('foo/','/bar') returns '/bar').
174
174
175 dp_eff = dirpath[lbase:]
175 dp_eff = dirpath[lbase:]
176 if dp_eff.startswith(pathsep):
176 if dp_eff.startswith(pathsep):
177 dp_eff = dp_eff[lpathsep:]
177 dp_eff = dp_eff[lpathsep:]
178 # The output path must be anchored at the out_base marker
178 # The output path must be anchored at the out_base marker
179 out_path = pjoin(out_base,dp_eff)
179 out_path = pjoin(out_base,dp_eff)
180 # Now we can generate the final filenames. Since os.walk only produces
180 # Now we can generate the final filenames. Since os.walk only produces
181 # filenames, we must join back with the dirpath to get full valid file
181 # filenames, we must join back with the dirpath to get full valid file
182 # paths:
182 # paths:
183 pfiles = [pjoin(dirpath,f) for f in filenames]
183 pfiles = [pjoin(dirpath,f) for f in filenames]
184 # Finally, generate the entry we need, which is a triple of (tag,output
184 # Finally, generate the entry we need, which is a triple of (tag,output
185 # path, files) for use as a data_files parameter in install_data.
185 # path, files) for use as a data_files parameter in install_data.
186 out.append((tag,out_path,pfiles))
186 out.append((tag,out_path,pfiles))
187
187
188 return out
188 return out
189
189
190
190
191 def find_data_files():
191 def find_data_files():
192 """
192 """
193 Find IPython's data_files.
193 Find IPython's data_files.
194
194
195 Most of these are docs.
195 Most of these are docs.
196 """
196 """
197
197
198 docdirbase = pjoin('share', 'doc', 'ipython')
198 docdirbase = pjoin('share', 'doc', 'ipython')
199 manpagebase = pjoin('share', 'man', 'man1')
199 manpagebase = pjoin('share', 'man', 'man1')
200
200
201 # Simple file lists can be made by hand
201 # Simple file lists can be made by hand
202 manpages = filter(isfile, glob(pjoin('docs','man','*.1.gz')))
202 manpages = filter(isfile, glob(pjoin('docs','man','*.1.gz')))
203 igridhelpfiles = filter(isfile, glob(pjoin('IPython','extensions','igrid_help.*')))
203 igridhelpfiles = filter(isfile, glob(pjoin('IPython','extensions','igrid_help.*')))
204
204
205 # For nested structures, use the utility above
205 # For nested structures, use the utility above
206 example_files = make_dir_struct(
206 example_files = make_dir_struct(
207 'data',
207 'data',
208 pjoin('docs','examples'),
208 pjoin('docs','examples'),
209 pjoin(docdirbase,'examples')
209 pjoin(docdirbase,'examples')
210 )
210 )
211 manual_files = make_dir_struct(
211 manual_files = make_dir_struct(
212 'data',
212 'data',
213 pjoin('docs','dist'),
213 pjoin('docs','dist'),
214 pjoin(docdirbase,'manual')
214 pjoin(docdirbase,'manual')
215 )
215 )
216
216
217 # And assemble the entire output list
217 # And assemble the entire output list
218 data_files = [ ('data',manpagebase, manpages),
218 data_files = [ ('data',manpagebase, manpages),
219 ('data',pjoin(docdirbase,'extensions'),igridhelpfiles),
219 ('data',pjoin(docdirbase,'extensions'),igridhelpfiles),
220 ] + manual_files + example_files
220 ] + manual_files + example_files
221
221
222 ## import pprint # dbg
222 ## import pprint # dbg
223 ## print '*'*80
223 ## print '*'*80
224 ## print 'data files'
224 ## print 'data files'
225 ## pprint.pprint(data_files)
225 ## pprint.pprint(data_files)
226 ## print '*'*80
226 ## print '*'*80
227
227
228 return data_files
228 return data_files
229
229
230
230
231 def make_man_update_target(manpage):
231 def make_man_update_target(manpage):
232 """Return a target_update-compliant tuple for the given manpage.
232 """Return a target_update-compliant tuple for the given manpage.
233
233
234 Parameters
234 Parameters
235 ----------
235 ----------
236 manpage : string
236 manpage : string
237 Name of the manpage, must include the section number (trailing number).
237 Name of the manpage, must include the section number (trailing number).
238
238
239 Example
239 Example
240 -------
240 -------
241
241
242 >>> make_man_update_target('ipython.1') #doctest: +NORMALIZE_WHITESPACE
242 >>> make_man_update_target('ipython.1') #doctest: +NORMALIZE_WHITESPACE
243 ('docs/man/ipython.1.gz',
243 ('docs/man/ipython.1.gz',
244 ['docs/man/ipython.1'],
244 ['docs/man/ipython.1'],
245 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz')
245 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz')
246 """
246 """
247 man_dir = pjoin('docs', 'man')
247 man_dir = pjoin('docs', 'man')
248 manpage_gz = manpage + '.gz'
248 manpage_gz = manpage + '.gz'
249 manpath = pjoin(man_dir, manpage)
249 manpath = pjoin(man_dir, manpage)
250 manpath_gz = pjoin(man_dir, manpage_gz)
250 manpath_gz = pjoin(man_dir, manpage_gz)
251 gz_cmd = ( "cd %(man_dir)s && gzip -9c %(manpage)s > %(manpage_gz)s" %
251 gz_cmd = ( "cd %(man_dir)s && gzip -9c %(manpage)s > %(manpage_gz)s" %
252 locals() )
252 locals() )
253 return (manpath_gz, [manpath], gz_cmd)
253 return (manpath_gz, [manpath], gz_cmd)
254
254
255 #---------------------------------------------------------------------------
255 #---------------------------------------------------------------------------
256 # Find scripts
256 # Find scripts
257 #---------------------------------------------------------------------------
257 #---------------------------------------------------------------------------
258
258
259 def find_scripts():
259 def find_scripts():
260 """
260 """
261 Find IPython's scripts.
261 Find IPython's scripts.
262 """
262 """
263 kernel_scripts = pjoin('IPython','kernel','scripts')
263 kernel_scripts = pjoin('IPython','kernel','scripts')
264 main_scripts = pjoin('IPython','scripts')
264 main_scripts = pjoin('IPython','scripts')
265 scripts = [pjoin(kernel_scripts, 'ipengine'),
265 scripts = [pjoin(kernel_scripts, 'ipengine'),
266 pjoin(kernel_scripts, 'ipcontroller'),
266 pjoin(kernel_scripts, 'ipcontroller'),
267 pjoin(kernel_scripts, 'ipcluster'),
267 pjoin(kernel_scripts, 'ipcluster'),
268 pjoin(main_scripts, 'ipython'),
268 pjoin(main_scripts, 'ipython'),
269 pjoin(main_scripts, 'ipythonx'),
269 pjoin(main_scripts, 'ipythonx'),
270 pjoin(main_scripts, 'ipython-wx'),
270 pjoin(main_scripts, 'ipython-wx'),
271 pjoin(main_scripts, 'pycolor'),
271 pjoin(main_scripts, 'pycolor'),
272 pjoin(main_scripts, 'irunner'),
272 pjoin(main_scripts, 'irunner'),
273 pjoin(main_scripts, 'iptest')
273 pjoin(main_scripts, 'iptest')
274 ]
274 ]
275
275
276 # Script to be run by the windows binary installer after the default setup
276 # Script to be run by the windows binary installer after the default setup
277 # routine, to add shortcuts and similar windows-only things. Windows
277 # routine, to add shortcuts and similar windows-only things. Windows
278 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
278 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
279 # doesn't find them.
279 # doesn't find them.
280 if 'bdist_wininst' in sys.argv:
280 if 'bdist_wininst' in sys.argv:
281 if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
281 if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
282 print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting."
282 print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting."
283 sys.exit(1)
283 sys.exit(1)
284 scripts.append(pjoin('scripts','ipython_win_post_install.py'))
284 scripts.append(pjoin('scripts','ipython_win_post_install.py'))
285
285
286 return scripts
286 return scripts
287
287
288 #---------------------------------------------------------------------------
288 #---------------------------------------------------------------------------
289 # Verify all dependencies
289 # Verify all dependencies
290 #---------------------------------------------------------------------------
290 #---------------------------------------------------------------------------
291
291
292 def check_for_dependencies():
292 def check_for_dependencies():
293 """Check for IPython's dependencies.
293 """Check for IPython's dependencies.
294
294
295 This function should NOT be called if running under setuptools!
295 This function should NOT be called if running under setuptools!
296 """
296 """
297 from setupext.setupext import (
297 from setupext.setupext import (
298 print_line, print_raw, print_status, print_message,
298 print_line, print_raw, print_status, print_message,
299 check_for_zopeinterface, check_for_twisted,
299 check_for_zopeinterface, check_for_twisted,
300 check_for_foolscap, check_for_pyopenssl,
300 check_for_foolscap, check_for_pyopenssl,
301 check_for_sphinx, check_for_pygments,
301 check_for_sphinx, check_for_pygments,
302 check_for_nose, check_for_pexpect
302 check_for_nose, check_for_pexpect
303 )
303 )
304 print_line()
304 print_line()
305 print_raw("BUILDING IPYTHON")
305 print_raw("BUILDING IPYTHON")
306 print_status('python', sys.version)
306 print_status('python', sys.version)
307 print_status('platform', sys.platform)
307 print_status('platform', sys.platform)
308 if sys.platform == 'win32':
308 if sys.platform == 'win32':
309 print_status('Windows version', sys.getwindowsversion())
309 print_status('Windows version', sys.getwindowsversion())
310
310
311 print_raw("")
311 print_raw("")
312 print_raw("OPTIONAL DEPENDENCIES")
312 print_raw("OPTIONAL DEPENDENCIES")
313
313
314 check_for_zopeinterface()
314 check_for_zopeinterface()
315 check_for_twisted()
315 check_for_twisted()
316 check_for_foolscap()
316 check_for_foolscap()
317 check_for_pyopenssl()
317 check_for_pyopenssl()
318 check_for_sphinx()
318 check_for_sphinx()
319 check_for_pygments()
319 check_for_pygments()
320 check_for_nose()
320 check_for_nose()
321 check_for_pexpect()
321 check_for_pexpect()
@@ -1,107 +1,107 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','core','release.py'))
46 execfile(pjoin('IPython','core','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','config','core','deathrow','lib',
68 'pyreadline','config','core','deathrow','lib',
69 'scripts','testing','utils'],
69 'scripts','testing','utils'],
70 'excludes' : ["Tkconstants","Tkinter","tcl",'IPython.igrid','wx',
70 'excludes' : ["Tkconstants","Tkinter","tcl",'IPython.igrid','wx',
71 'wxPython','igrid', 'PyQt4', 'zope', 'Zope', 'Zope2',
71 'wxPython','igrid', 'PyQt4', 'zope', 'Zope', 'Zope2',
72 '_curses','enthought.traits','gtk','qt', 'pydb','idlelib',
72 '_curses','enthought.traits','gtk','qt', 'pydb','idlelib',
73 ]
73 ]
74
74
75 }
75 }
76 },
76 },
77 version = version,
77 version = version,
78 description = description,
78 description = description,
79 long_description = long_description,
79 long_description = long_description,
80 author = authors['Fernando'][0],
80 author = authors['Fernando'][0],
81 author_email = authors['Fernando'][1],
81 author_email = authors['Fernando'][1],
82 url = url,
82 url = url,
83 download_url = download_url,
83 download_url = download_url,
84 license = license,
84 license = license,
85 platforms = platforms,
85 platforms = platforms,
86 keywords = keywords,
86 keywords = keywords,
87 console = ['ipykit.py'],
87 console = ['ipykit.py'],
88
88
89 # extra params needed for eggs
89 # extra params needed for eggs
90 **egg_extra_kwds
90 **egg_extra_kwds
91 )
91 )
92
92
93 minimal_conf = """
93 minimal_conf = """
94 import IPython.ipapi
94 import IPython.ipapi
95 ip = IPython.ipapi.get()
95 ip = IPython.ipapi.get()
96
96
97 ip.load('ipy_kitcfg')
97 ip.load('ipy_kitcfg')
98 import ipy_profile_sh
98 import ipy_profile_sh
99 """
99 """
100
100
101 if not os.path.isdir("dist/_ipython"):
101 if not os.path.isdir("dist/_ipython"):
102 print "Creating simple _ipython dir"
102 print "Creating simple _ipython dir"
103 os.mkdir("dist/_ipython")
103 os.mkdir("dist/_ipython")
104 open("dist/_ipython/ipythonrc.ini","w").write("# intentionally blank\n")
104 open("dist/_ipython/ipythonrc.ini","w").write("# intentionally blank\n")
105 open("dist/_ipython/ipy_user_conf.py","w").write(minimal_conf)
105 open("dist/_ipython/ipy_user_conf.py","w").write(minimal_conf)
106 if os.path.isdir('bin'):
106 if os.path.isdir('bin'):
107 dir_util.copy_tree('bin','dist/bin')
107 dir_util.copy_tree('bin','dist/bin')
@@ -1,20 +1,19 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 """Call the compile script to check that all code we ship compiles correctly.
2 """Script to check that all code in a directory compiles correctly.
3 """
4
3
5 import os
4 Usage:
6 import sys
7
5
6 compile.py
8
7
9 vstr = '.'.join(map(str,sys.version_info[:2]))
8 This script verifies that all Python files in the directory where run, and all
9 of its subdirectories, compile correctly.
10
10
11 stat = os.system('python %s/lib/python%s/compileall.py .' % (sys.prefix,vstr))
11 Before a release, call this script from the top-level directory.
12 """
13
14 import sys
12
15
13 print
16 from toollib import compile_tree
14 if stat:
15 print '*** THERE WAS AN ERROR! ***'
16 print 'See messages above for the actual file that produced it.'
17 else:
18 print 'OK'
19
17
20 sys.exit(stat)
18 if __name__ == '__main__':
19 compile_tree()
@@ -1,36 +1,23 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 """Simple script to create a tarball with proper bzr version info.
2 """Simple script to create a tarball with proper bzr version info.
3 """
3 """
4
4
5 import os,sys,shutil
5 import os
6 import sys
7 import shutil
6
8
7 basever = '0.9.0'
9 from toollib import *
8
10
9 def oscmd(c):
11 c('python update_revnum.py')
10 print ">",c
11 s = os.system(c)
12 if s:
13 print "Error",s
14 sys.exit(s)
15
12
16 def verinfo():
13 execfile('../IPython/core/release.py') # defines version_base
17
18 out = os.popen('bzr version-info')
19 pairs = (l.split(':',1) for l in out)
20 d = dict(((k,v.strip()) for (k,v) in pairs))
21 return d
22
23 basename = 'ipython'
24
25 #tarname = '%s.r%s.tgz' % (basename, ver)
26 oscmd('python update_revnum.py')
27
14
28 ver = verinfo()
15 ver = version_info()
29
16
30 if ver['branch-nick'] == 'ipython':
17 if ver['branch-nick'] == 'ipython':
31 tarname = 'ipython-%s.bzr.r%s.tgz' % (basever, ver['revno'])
18 tarname = 'ipython-%s.bzr.r%s.tgz' % (version_base, ver['revno'])
32 else:
19 else:
33 tarname = 'ipython-%s.bzr.r%s.%s.tgz' % (basever, ver['revno'],
20 tarname = 'ipython-%s.bzr.r%s.%s.tgz' % (version_base, ver['revno'],
34 ver['branch-nick'])
21 ver['branch-nick'])
35
22
36 oscmd('bzr export ' + tarname)
23 c('bzr export ' + tarname)
@@ -1,48 +1,42 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 """IPython release script
2 """IPython release build script.
3
4 Create ipykit and exe installer
5
6 requires py2exe
7 """
3 """
4 from toollib import *
8
5
9 import os
6 # Get main ipython dir, this will raise if it doesn't pass some checks
10 import distutils.dir_util
7 ipdir = get_ipdir()
11 import sys
8 cd(ipdir)
12
13 execfile('../IPython/Release.py')
14
15 def c(cmd):
16 print ">",cmd
17 os.system(cmd)
18
9
19 ipykit_name = "ipykit-%s" % version
10 # Load release info
11 execfile(pjoin('IPython','core','release.py'))
20
12
21 os.chdir('..')
13 # Check that everything compiles
22 if os.path.isdir('dist'):
14 compile_tree()
23 distutils.dir_util.remove_tree('dist')
24 if os.path.isdir(ipykit_name):
25 distutils.dir_util.remove_tree(ipykit_name)
26
15
27 if sys.platform == 'win32':
16 # Cleanup
28 c("python exesetup.py py2exe")
17 for d in ['build','dist',pjoin('docs','build'),pjoin('docs','dist')]:
29
18 if os.path.isdir(d):
30 os.rename('dist',ipykit_name)
19 remove_tree(d)
31
32 c("zip -r %s.zip %s" % (ipykit_name, ipykit_name))
33
20
34 # Build source and binary distros
21 # Build source and binary distros
35 c('./setup.py sdist --formats=gztar')
22 c('./setup.py sdist --formats=gztar')
36
23
37 c("python2.4 ./setup.py bdist_rpm --binary-only --release=py24 --python=/usr/bin/python2.4")
24 # Build version-specific RPMs, where we must use the --python option to ensure
38 c("python2.5 ./setup.py bdist_rpm --binary-only --release=py25 --python=/usr/bin/python2.5")
25 # that the resulting RPM is really built with the requested python version (so
26 # things go to lib/python2.X/...)
27 c("python2.5 ./setup.py bdist_rpm --binary-only --release=py25 "
28 "--python=/usr/bin/python2.5")
29 c("python2.6 ./setup.py bdist_rpm --binary-only --release=py26 "
30 "--python=/usr/bin/python2.6")
39
31
40 # Build eggs
32 # Build eggs
41 c('python2.4 ./eggsetup.py bdist_egg')
42 c('python2.5 ./eggsetup.py bdist_egg')
33 c('python2.5 ./eggsetup.py bdist_egg')
34 c('python2.6 ./eggsetup.py bdist_egg')
43
35
36 # Call the windows build separately, so that the extra Windows scripts don't
37 # get pulled into Unix builds (setup.py has code which checks for
38 # bdist_wininst)
44 c("python setup.py bdist_wininst --install-script=ipython_win_post_install.py")
39 c("python setup.py bdist_wininst --install-script=ipython_win_post_install.py")
45
40
46 os.chdir('tools')
41 # Change name so retarded Vista runs the installer correctly
47 c('python make_tarball.py')
42 c("rename 's/win32/win32-setup/' dist/*.exe")
48
@@ -1,35 +1,43 b''
1 #!/bin/bash
1 #!/usr/bin/env python
2 # IPython release script
2 """IPython release script.
3
3
4 PYVER=`python -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $1$2}' `
4 This should only be run at real release time.
5 version=`ipython -Version`
5 """
6 ipdir=~/ipython/ipython
7 ipbackupdir=~/ipython/backup
8
6
9 echo
7 from toollib import *
10 echo "Releasing IPython version $version"
8
11 echo "=================================="
9 # Get main ipython dir, this will raise if it doesn't pass some checks
10 ipdir = get_ipdir()
11 cd(ipdir)
12
13 # Load release info
14 execfile(pjoin('IPython','core','release.py'))
15
16 # Where I keep static backups of each release
17 ipbackupdir = os.path.expanduser('~/ipython/backup')
18
19 print
20 print "Releasing IPython version $version"
21 print "=================================="
12
22
13 # Perform local backup
23 # Perform local backup
14 cd $ipdir/tools
24 c('./make_tarball.py')
15 ./make_tarball.py
25 c('mv ipython-*.tgz %s' % ipbackupdir)
16 mv ipython-*.tgz $ipbackupdir
17
26
18 # Build release files
27 # Build release files
19 ./testrel $ipdir
28 c('./mkrel.py %s' % ipdir)
20
29
21 # Register with the Python Package Index (PyPI)
30 # Register with the Python Package Index (PyPI)
22 echo "Registering with PyPI..."
31 print "Registering with PyPI..."
23 cd $ipdir
32 c('./setup.py register')
24 ./setup.py register
25
33
26 # Upload all files
34 # Upload all files
27 cd $ipdir/dist
35 cd('dist')
28 echo "Uploading distribution files..."
36 print "Uploading distribution files..."
29 scp * ipython@ipython.scipy.org:www/dist/
37 c('scp * ipython@ipython.scipy.org:www/dist/')
30
38
31 echo "Uploading backup files..."
39 print "Uploading backup files..."
32 cd $ipbackupdir
40 cd(ipbackupdir)
33 scp `ls -1tr *tgz | tail -1` ipython@ipython.scipy.org:www/backup/
41 c('scp `ls -1tr *tgz | tail -1` ipython@ipython.scipy.org:www/backup/')
34
42
35 echo "Done!"
43 print "Done!"
@@ -1,16 +1,22 b''
1 """XXX - What exactly is the use of this script?
2
3 I (fperez) tried it quickly and it doesn't work in its current form. Either it
4 needs to be fixed and documented or removed.
5 """
6
1 import cProfile as profile
7 import cProfile as profile
2 import sys
8 import sys
3 #import profile
9 #import profile
4
10
5 def main():
11 def main():
6 import IPython.ipapi
12 import IPython.ipapi
7 print "Entering ipython for profiling. Type 'Exit' for profiler report"
13 print "Entering ipython for profiling. Type 'Exit' for profiler report"
8 IPython.ipapi.launch_new_instance()
14 IPython.ipapi.launch_new_instance()
9
15
10 if len(sys.argv) == 1:
16 if len(sys.argv) == 1:
11 profile.run('main()', 'ipython_profiler_results')
17 profile.run('main()', 'ipython_profiler_results')
12
18
13 import pstats
19 import pstats
14 p = pstats.Stats(len(sys.argv) >1 and sys.argv[1] or 'ipython_profiler_results')
20 p = pstats.Stats(len(sys.argv) >1 and sys.argv[1] or 'ipython_profiler_results')
15 p.sort_stats('time').print_stats(30)
21 p.sort_stats('time').print_stats(30)
16
22
@@ -1,6 +1,6 b''
1 #!/bin/sh
1 #!/bin/sh
2
2 # Simple upload script to push up into the testing directory a local build
3 ipdir=$PWD/..
3 ipdir=$PWD/..
4
4
5 cd $ipdir/dist
5 cd $ipdir/dist
6 scp * ipython@ipython.scipy.org:www/dist/testing/
6 scp * ipython@ipython.scipy.org:www/dist/testing/
@@ -1,23 +1,32 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 """ Change the revision number in Release.py """
2 """Change the revision number in release.py
3
4 This edits in-place release.py to update the revision number from bzr info.
5
6 Usage:
7
8 ./update_revnum.py"""
3
9
4 import os
10 import os
5 import re,pprint
11 import pprint
12 import re
6
13
7 def verinfo():
14 from toollib import *
8
9 out = os.popen('bzr version-info')
10 pairs = (l.split(':',1) for l in out)
11 d = dict(((k,v.strip()) for (k,v) in pairs))
12 return d
13
15
14 ver = verinfo()
16 if __name__ == '__main__':
17 ver = version_info()
15
18
16 pprint.pprint(ver)
19 pprint.pprint(ver)
17
20
18 rfile = open('../IPython/core/release.py','rb').read()
21 rfile = open('../IPython/core/release.py','rb').read()
19 newcont = re.sub(r'revision\s*=.*', "revision = '%s'" % ver['revno'], rfile)
22 newcont = re.sub(r'revision\s*=.*',
23 "revision = '%s'" % ver['revno'],
24 rfile)
20
25
21 newcont = re.sub(r'^branch\s*=[^=].*', "branch = '%s'" % ver['branch-nick'], newcont )
26 newcont = re.sub(r'^branch\s*=[^=].*',
27 "branch = '%s'" % ver['branch-nick'],
28 newcont)
22
29
23 open('../IPython/core/release.py','wb').write(newcont)
30 f = open('../IPython/core/release.py','wb')
31 f.write(newcont)
32 f.close()
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now