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 | 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 | def make_man_update_target(manpage): |
|
232 | 232 | """Return a target_update-compliant tuple for the given manpage. |
|
233 | 233 | |
|
234 | 234 | Parameters |
|
235 | 235 | ---------- |
|
236 | 236 | manpage : string |
|
237 | 237 | Name of the manpage, must include the section number (trailing number). |
|
238 | 238 | |
|
239 | 239 | Example |
|
240 | 240 | ------- |
|
241 | 241 | |
|
242 | 242 | >>> make_man_update_target('ipython.1') #doctest: +NORMALIZE_WHITESPACE |
|
243 | 243 | ('docs/man/ipython.1.gz', |
|
244 | 244 | ['docs/man/ipython.1'], |
|
245 | 245 | 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz') |
|
246 | 246 | """ |
|
247 | 247 | man_dir = pjoin('docs', 'man') |
|
248 | 248 | manpage_gz = manpage + '.gz' |
|
249 | 249 | manpath = pjoin(man_dir, manpage) |
|
250 | 250 | manpath_gz = pjoin(man_dir, manpage_gz) |
|
251 | 251 | gz_cmd = ( "cd %(man_dir)s && gzip -9c %(manpage)s > %(manpage_gz)s" % |
|
252 | 252 | locals() ) |
|
253 | 253 | return (manpath_gz, [manpath], gz_cmd) |
|
254 | 254 | |
|
255 | 255 | #--------------------------------------------------------------------------- |
|
256 | 256 | # Find scripts |
|
257 | 257 | #--------------------------------------------------------------------------- |
|
258 | 258 | |
|
259 | 259 | def find_scripts(): |
|
260 | 260 | """ |
|
261 | 261 | Find IPython's scripts. |
|
262 | 262 | """ |
|
263 | 263 | kernel_scripts = pjoin('IPython','kernel','scripts') |
|
264 | 264 | main_scripts = pjoin('IPython','scripts') |
|
265 | 265 | scripts = [pjoin(kernel_scripts, 'ipengine'), |
|
266 | 266 | pjoin(kernel_scripts, 'ipcontroller'), |
|
267 | 267 | pjoin(kernel_scripts, 'ipcluster'), |
|
268 | 268 | pjoin(main_scripts, 'ipython'), |
|
269 | 269 | pjoin(main_scripts, 'ipythonx'), |
|
270 | 270 | pjoin(main_scripts, 'ipython-wx'), |
|
271 | 271 | pjoin(main_scripts, 'pycolor'), |
|
272 | 272 | pjoin(main_scripts, 'irunner'), |
|
273 | 273 | pjoin(main_scripts, 'iptest') |
|
274 | 274 | ] |
|
275 | 275 | |
|
276 | 276 | # Script to be run by the windows binary installer after the default setup |
|
277 | 277 | # routine, to add shortcuts and similar windows-only things. Windows |
|
278 | 278 | # post-install scripts MUST reside in the scripts/ dir, otherwise distutils |
|
279 | 279 | # doesn't find them. |
|
280 | 280 | if 'bdist_wininst' in sys.argv: |
|
281 | 281 | if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): |
|
282 | 282 | print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting." |
|
283 | 283 | sys.exit(1) |
|
284 | 284 | scripts.append(pjoin('scripts','ipython_win_post_install.py')) |
|
285 | 285 | |
|
286 | 286 | return scripts |
|
287 | 287 | |
|
288 | 288 | #--------------------------------------------------------------------------- |
|
289 | 289 | # Verify all dependencies |
|
290 | 290 | #--------------------------------------------------------------------------- |
|
291 | 291 | |
|
292 | 292 | def check_for_dependencies(): |
|
293 | 293 | """Check for IPython's dependencies. |
|
294 | 294 | |
|
295 | 295 | This function should NOT be called if running under setuptools! |
|
296 | 296 | """ |
|
297 | 297 | from setupext.setupext import ( |
|
298 | 298 | print_line, print_raw, print_status, print_message, |
|
299 | 299 | check_for_zopeinterface, check_for_twisted, |
|
300 | 300 | check_for_foolscap, check_for_pyopenssl, |
|
301 | 301 | check_for_sphinx, check_for_pygments, |
|
302 | 302 | check_for_nose, check_for_pexpect |
|
303 | 303 | ) |
|
304 | 304 | print_line() |
|
305 | 305 | print_raw("BUILDING IPYTHON") |
|
306 | 306 | print_status('python', sys.version) |
|
307 | 307 | print_status('platform', sys.platform) |
|
308 | 308 | if sys.platform == 'win32': |
|
309 | 309 | print_status('Windows version', sys.getwindowsversion()) |
|
310 | 310 | |
|
311 | 311 | print_raw("") |
|
312 | 312 | print_raw("OPTIONAL DEPENDENCIES") |
|
313 | 313 | |
|
314 | 314 | check_for_zopeinterface() |
|
315 | 315 | check_for_twisted() |
|
316 | 316 | check_for_foolscap() |
|
317 | 317 | check_for_pyopenssl() |
|
318 | 318 | check_for_sphinx() |
|
319 | 319 | check_for_pygments() |
|
320 | 320 | check_for_nose() |
|
321 | 321 | check_for_pexpect() |
@@ -1,107 +1,107 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | # -*- coding: utf-8 -*- |
|
3 | 3 | r"""Setup script for exe distribution of IPython (does not require python). |
|
4 | 4 | |
|
5 | 5 | - Requires py2exe |
|
6 | 6 | |
|
7 | 7 | - install pyreadline *package dir* in ipython root directory by running: |
|
8 | 8 | |
|
9 | 9 | svn co http://ipython.scipy.org/svn/ipython/pyreadline/branches/maintenance_1.3/pyreadline/ |
|
10 | 10 | wget http://ipython.scipy.org/svn/ipython/pyreadline/branches/maintenance_1.3/readline.py |
|
11 | 11 | |
|
12 | 12 | OR (if you want the latest trunk): |
|
13 | 13 | |
|
14 | 14 | svn co http://ipython.scipy.org/svn/ipython/pyreadline/trunk/pyreadline |
|
15 | 15 | |
|
16 | 16 | - Create the distribution in 'dist' by running "python exesetup.py py2exe" |
|
17 | 17 | |
|
18 | 18 | - Run ipython.exe to go. |
|
19 | 19 | |
|
20 | 20 | """ |
|
21 | 21 | |
|
22 | 22 | #***************************************************************************** |
|
23 | 23 | # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu> |
|
24 | 24 | # |
|
25 | 25 | # Distributed under the terms of the BSD License. The full license is in |
|
26 | 26 | # the file COPYING, distributed as part of this software. |
|
27 | 27 | #***************************************************************************** |
|
28 | 28 | |
|
29 | 29 | # Stdlib imports |
|
30 | 30 | import os |
|
31 | 31 | import sys |
|
32 | 32 | |
|
33 | 33 | from glob import glob |
|
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 | from distutils.core import setup |
|
41 | 41 | from distutils import dir_util |
|
42 | 42 | import py2exe |
|
43 | 43 | |
|
44 | 44 | # update the manuals when building a source dist |
|
45 |
# |
|
|
45 | # release.py contains version, authors, license, url, keywords, etc. | |
|
46 | 46 | execfile(pjoin('IPython','core','release.py')) |
|
47 | 47 | |
|
48 | 48 | # A little utility we'll need below, since glob() does NOT allow you to do |
|
49 | 49 | # exclusion on multiple endings! |
|
50 | 50 | def file_doesnt_endwith(test,endings): |
|
51 | 51 | """Return true if test is a file and its name does NOT end with any |
|
52 | 52 | of the strings listed in endings.""" |
|
53 | 53 | if not isfile(test): |
|
54 | 54 | return False |
|
55 | 55 | for e in endings: |
|
56 | 56 | if test.endswith(e): |
|
57 | 57 | return False |
|
58 | 58 | return True |
|
59 | 59 | |
|
60 | 60 | |
|
61 | 61 | egg_extra_kwds = {} |
|
62 | 62 | |
|
63 | 63 | # Call the setup() routine which does most of the work |
|
64 | 64 | setup(name = name, |
|
65 | 65 | options = { |
|
66 | 66 | 'py2exe': { |
|
67 | 67 | 'packages' : ['IPython', 'IPython.extensions', 'IPython.external', |
|
68 | 68 | 'pyreadline','config','core','deathrow','lib', |
|
69 | 69 | 'scripts','testing','utils'], |
|
70 | 70 | 'excludes' : ["Tkconstants","Tkinter","tcl",'IPython.igrid','wx', |
|
71 | 71 | 'wxPython','igrid', 'PyQt4', 'zope', 'Zope', 'Zope2', |
|
72 | 72 | '_curses','enthought.traits','gtk','qt', 'pydb','idlelib', |
|
73 | 73 | ] |
|
74 | 74 | |
|
75 | 75 | } |
|
76 | 76 | }, |
|
77 | 77 | version = version, |
|
78 | 78 | description = description, |
|
79 | 79 | long_description = long_description, |
|
80 | 80 | author = authors['Fernando'][0], |
|
81 | 81 | author_email = authors['Fernando'][1], |
|
82 | 82 | url = url, |
|
83 | 83 | download_url = download_url, |
|
84 | 84 | license = license, |
|
85 | 85 | platforms = platforms, |
|
86 | 86 | keywords = keywords, |
|
87 | 87 | console = ['ipykit.py'], |
|
88 | 88 | |
|
89 | 89 | # extra params needed for eggs |
|
90 | 90 | **egg_extra_kwds |
|
91 | 91 | ) |
|
92 | 92 | |
|
93 | 93 | minimal_conf = """ |
|
94 | 94 | import IPython.ipapi |
|
95 | 95 | ip = IPython.ipapi.get() |
|
96 | 96 | |
|
97 | 97 | ip.load('ipy_kitcfg') |
|
98 | 98 | import ipy_profile_sh |
|
99 | 99 | """ |
|
100 | 100 | |
|
101 | 101 | if not os.path.isdir("dist/_ipython"): |
|
102 | 102 | print "Creating simple _ipython dir" |
|
103 | 103 | os.mkdir("dist/_ipython") |
|
104 | 104 | open("dist/_ipython/ipythonrc.ini","w").write("# intentionally blank\n") |
|
105 | 105 | open("dist/_ipython/ipy_user_conf.py","w").write(minimal_conf) |
|
106 | 106 | if os.path.isdir('bin'): |
|
107 | 107 | dir_util.copy_tree('bin','dist/bin') |
@@ -1,20 +1,19 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 |
""" |
|
|
3 | """ | |
|
2 | """Script to check that all code in a directory compiles correctly. | |
|
4 | 3 |
|
|
5 | import os | |
|
6 | import sys | |
|
4 | Usage: | |
|
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 | ||
|
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' | |
|
16 | from toollib import compile_tree | |
|
19 | 17 | |
|
20 | sys.exit(stat) | |
|
18 | if __name__ == '__main__': | |
|
19 | compile_tree() |
@@ -1,36 +1,23 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | """Simple script to create a tarball with proper bzr version info. |
|
3 | 3 | """ |
|
4 | 4 | |
|
5 |
import os |
|
|
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): | |
|
10 | print ">",c | |
|
11 | s = os.system(c) | |
|
12 | if s: | |
|
13 | print "Error",s | |
|
14 | sys.exit(s) | |
|
11 | c('python update_revnum.py') | |
|
15 | 12 | |
|
16 | def verinfo(): | |
|
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') | |
|
13 | execfile('../IPython/core/release.py') # defines version_base | |
|
27 | 14 | |
|
28 | ver = verinfo() | |
|
15 | ver = version_info() | |
|
29 | 16 | |
|
30 | 17 | if ver['branch-nick'] == 'ipython': |
|
31 |
tarname = 'ipython-%s.bzr.r%s.tgz' % (base |
|
|
18 | tarname = 'ipython-%s.bzr.r%s.tgz' % (version_base, ver['revno']) | |
|
32 | 19 | else: |
|
33 |
tarname = 'ipython-%s.bzr.r%s.%s.tgz' % (base |
|
|
20 | tarname = 'ipython-%s.bzr.r%s.%s.tgz' % (version_base, ver['revno'], | |
|
34 | 21 | ver['branch-nick']) |
|
35 | 22 | |
|
36 |
|
|
|
23 | c('bzr export ' + tarname) |
@@ -1,48 +1,42 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | """IPython release script | |
|
3 | ||
|
4 | Create ipykit and exe installer | |
|
5 | ||
|
6 | requires py2exe | |
|
2 | """IPython release build script. | |
|
7 | 3 | """ |
|
4 | from toollib import * | |
|
8 | 5 | |
|
9 | import os | |
|
10 | import distutils.dir_util | |
|
11 | import sys | |
|
12 | ||
|
13 | execfile('../IPython/Release.py') | |
|
14 | ||
|
15 | def c(cmd): | |
|
16 | print ">",cmd | |
|
17 | os.system(cmd) | |
|
6 | # Get main ipython dir, this will raise if it doesn't pass some checks | |
|
7 | ipdir = get_ipdir() | |
|
8 | cd(ipdir) | |
|
18 | 9 | |
|
19 | ipykit_name = "ipykit-%s" % version | |
|
10 | # Load release info | |
|
11 | execfile(pjoin('IPython','core','release.py')) | |
|
20 | 12 | |
|
21 | os.chdir('..') | |
|
22 | if os.path.isdir('dist'): | |
|
23 | distutils.dir_util.remove_tree('dist') | |
|
24 | if os.path.isdir(ipykit_name): | |
|
25 | distutils.dir_util.remove_tree(ipykit_name) | |
|
13 | # Check that everything compiles | |
|
14 | compile_tree() | |
|
26 | 15 | |
|
27 | if sys.platform == 'win32': | |
|
28 | c("python exesetup.py py2exe") | |
|
29 | ||
|
30 | os.rename('dist',ipykit_name) | |
|
31 | ||
|
32 | c("zip -r %s.zip %s" % (ipykit_name, ipykit_name)) | |
|
16 | # Cleanup | |
|
17 | for d in ['build','dist',pjoin('docs','build'),pjoin('docs','dist')]: | |
|
18 | if os.path.isdir(d): | |
|
19 | remove_tree(d) | |
|
33 | 20 | |
|
34 | 21 | # Build source and binary distros |
|
35 | 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") | |
|
38 | c("python2.5 ./setup.py bdist_rpm --binary-only --release=py25 --python=/usr/bin/python2.5") | |
|
24 | # Build version-specific RPMs, where we must use the --python option to ensure | |
|
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 | 32 | # Build eggs |
|
41 | c('python2.4 ./eggsetup.py bdist_egg') | |
|
42 | 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 | 39 | c("python setup.py bdist_wininst --install-script=ipython_win_post_install.py") |
|
45 | 40 | |
|
46 | os.chdir('tools') | |
|
47 | c('python make_tarball.py') | |
|
48 | ||
|
41 | # Change name so retarded Vista runs the installer correctly | |
|
42 | c("rename 's/win32/win32-setup/' dist/*.exe") |
@@ -1,35 +1,43 b'' | |||
|
1 | #!/bin/bash | |
|
2 |
|
|
|
1 | #!/usr/bin/env python | |
|
2 | """IPython release script. | |
|
3 | 3 | |
|
4 | PYVER=`python -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $1$2}' ` | |
|
5 | version=`ipython -Version` | |
|
6 | ipdir=~/ipython/ipython | |
|
7 | ipbackupdir=~/ipython/backup | |
|
4 | This should only be run at real release time. | |
|
5 | """ | |
|
8 | 6 | |
|
9 | echo | |
|
10 | echo "Releasing IPython version $version" | |
|
11 | echo "==================================" | |
|
7 | from toollib import * | |
|
8 | ||
|
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 | ||
|
20 | print "Releasing IPython version $version" | |
|
21 | print "==================================" | |
|
12 | 22 | |
|
13 | 23 | # Perform local backup |
|
14 | cd $ipdir/tools | |
|
15 | ./make_tarball.py | |
|
16 | mv ipython-*.tgz $ipbackupdir | |
|
24 | c('./make_tarball.py') | |
|
25 | c('mv ipython-*.tgz %s' % ipbackupdir) | |
|
17 | 26 | |
|
18 | 27 | # Build release files |
|
19 | ./testrel $ipdir | |
|
28 | c('./mkrel.py %s' % ipdir) | |
|
20 | 29 | |
|
21 | 30 | # Register with the Python Package Index (PyPI) |
|
22 |
|
|
|
23 | cd $ipdir | |
|
24 | ./setup.py register | |
|
31 | print "Registering with PyPI..." | |
|
32 | c('./setup.py register') | |
|
25 | 33 | |
|
26 | 34 | # Upload all files |
|
27 | cd $ipdir/dist | |
|
28 |
|
|
|
29 | scp * ipython@ipython.scipy.org:www/dist/ | |
|
35 | cd('dist') | |
|
36 | print "Uploading distribution files..." | |
|
37 | c('scp * ipython@ipython.scipy.org:www/dist/') | |
|
30 | 38 | |
|
31 |
|
|
|
32 |
cd |
|
|
33 | scp `ls -1tr *tgz | tail -1` ipython@ipython.scipy.org:www/backup/ | |
|
39 | print "Uploading backup files..." | |
|
40 | cd(ipbackupdir) | |
|
41 | c('scp `ls -1tr *tgz | tail -1` ipython@ipython.scipy.org:www/backup/') | |
|
34 | 42 | |
|
35 |
|
|
|
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 | 7 | import cProfile as profile |
|
2 | 8 | import sys |
|
3 | 9 | #import profile |
|
4 | 10 | |
|
5 | 11 | def main(): |
|
6 | 12 | import IPython.ipapi |
|
7 | 13 | print "Entering ipython for profiling. Type 'Exit' for profiler report" |
|
8 | 14 | IPython.ipapi.launch_new_instance() |
|
9 | 15 | |
|
10 | 16 | if len(sys.argv) == 1: |
|
11 | 17 | profile.run('main()', 'ipython_profiler_results') |
|
12 | 18 | |
|
13 | 19 | import pstats |
|
14 | 20 | p = pstats.Stats(len(sys.argv) >1 and sys.argv[1] or 'ipython_profiler_results') |
|
15 | 21 | p.sort_stats('time').print_stats(30) |
|
16 | 22 |
@@ -1,6 +1,6 b'' | |||
|
1 | 1 | #!/bin/sh |
|
2 | ||
|
2 | # Simple upload script to push up into the testing directory a local build | |
|
3 | 3 | ipdir=$PWD/.. |
|
4 | 4 | |
|
5 | 5 | cd $ipdir/dist |
|
6 | 6 | scp * ipython@ipython.scipy.org:www/dist/testing/ |
@@ -1,23 +1,32 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 |
""" |
|
|
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 | 10 | import os |
|
5 |
import |
|
|
11 | import pprint | |
|
12 | import re | |
|
6 | 13 | |
|
7 | def verinfo(): | |
|
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 | |
|
14 | from toollib import * | |
|
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() | |
|
19 |
newcont = re.sub(r'revision\s*=.*', |
|
|
21 | rfile = open('../IPython/core/release.py','rb').read() | |
|
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') |
|
|
30 | f = open('../IPython/core/release.py','wb') | |
|
31 | f.write(newcont) | |
|
32 | f.close() |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now