##// END OF EJS Templates
remove strict requirement for less,invoke in wheel/sdist...
Min RK -
Show More
@@ -1,333 +1,333 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
2 # -*- coding: utf-8 -*-
3 """Setup script for IPython.
3 """Setup script for IPython.
4
4
5 Under Posix environments it works like a typical setup.py script.
5 Under Posix environments it works like a typical setup.py script.
6 Under Windows, the command sdist is not supported, since IPython
6 Under Windows, the command sdist is not supported, since IPython
7 requires utilities which are not available under Windows."""
7 requires utilities which are not available under Windows."""
8
8
9 #-----------------------------------------------------------------------------
9 #-----------------------------------------------------------------------------
10 # Copyright (c) 2008-2011, IPython Development Team.
10 # Copyright (c) 2008-2011, IPython Development Team.
11 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
11 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
12 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
12 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
13 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
13 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
14 #
14 #
15 # Distributed under the terms of the Modified BSD License.
15 # Distributed under the terms of the Modified BSD License.
16 #
16 #
17 # The full license is in the file COPYING.rst, distributed with this software.
17 # The full license is in the file COPYING.rst, distributed with this software.
18 #-----------------------------------------------------------------------------
18 #-----------------------------------------------------------------------------
19
19
20 #-----------------------------------------------------------------------------
20 #-----------------------------------------------------------------------------
21 # Minimal Python version sanity check
21 # Minimal Python version sanity check
22 #-----------------------------------------------------------------------------
22 #-----------------------------------------------------------------------------
23 from __future__ import print_function
23 from __future__ import print_function
24
24
25 import sys
25 import sys
26
26
27 # This check is also made in IPython/__init__, don't forget to update both when
27 # This check is also made in IPython/__init__, don't forget to update both when
28 # changing Python version requirements.
28 # changing Python version requirements.
29 v = sys.version_info
29 v = sys.version_info
30 if v[:2] < (2,7) or (v[0] >= 3 and v[:2] < (3,3)):
30 if v[:2] < (2,7) or (v[0] >= 3 and v[:2] < (3,3)):
31 error = "ERROR: IPython requires Python version 2.7 or 3.3 or above."
31 error = "ERROR: IPython requires Python version 2.7 or 3.3 or above."
32 print(error, file=sys.stderr)
32 print(error, file=sys.stderr)
33 sys.exit(1)
33 sys.exit(1)
34
34
35 PY3 = (sys.version_info[0] >= 3)
35 PY3 = (sys.version_info[0] >= 3)
36
36
37 # At least we're on the python version we need, move on.
37 # At least we're on the python version we need, move on.
38
38
39 #-------------------------------------------------------------------------------
39 #-------------------------------------------------------------------------------
40 # Imports
40 # Imports
41 #-------------------------------------------------------------------------------
41 #-------------------------------------------------------------------------------
42
42
43 # Stdlib imports
43 # Stdlib imports
44 import os
44 import os
45 import shutil
45 import shutil
46
46
47 from glob import glob
47 from glob import glob
48
48
49 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
49 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
50 # update it when the contents of directories change.
50 # update it when the contents of directories change.
51 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
51 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
52
52
53 from distutils.core import setup
53 from distutils.core import setup
54
54
55 # Our own imports
55 # Our own imports
56 from setupbase import target_update
56 from setupbase import target_update
57
57
58 from setupbase import (
58 from setupbase import (
59 setup_args,
59 setup_args,
60 find_packages,
60 find_packages,
61 find_package_data,
61 find_package_data,
62 check_package_data_first,
62 check_package_data_first,
63 find_entry_points,
63 find_entry_points,
64 build_scripts_entrypt,
64 build_scripts_entrypt,
65 find_data_files,
65 find_data_files,
66 check_for_dependencies,
66 check_for_dependencies,
67 git_prebuild,
67 git_prebuild,
68 check_submodule_status,
68 check_submodule_status,
69 update_submodules,
69 update_submodules,
70 require_submodules,
70 require_submodules,
71 UpdateSubmodules,
71 UpdateSubmodules,
72 get_bdist_wheel,
72 get_bdist_wheel,
73 CompileCSS,
73 CompileCSS,
74 JavascriptVersion,
74 JavascriptVersion,
75 css_js_prerelease,
75 css_js_prerelease,
76 install_symlinked,
76 install_symlinked,
77 install_lib_symlink,
77 install_lib_symlink,
78 install_scripts_for_symlink,
78 install_scripts_for_symlink,
79 unsymlink,
79 unsymlink,
80 )
80 )
81 from setupext import setupext
81 from setupext import setupext
82
82
83 isfile = os.path.isfile
83 isfile = os.path.isfile
84 pjoin = os.path.join
84 pjoin = os.path.join
85
85
86 #-------------------------------------------------------------------------------
86 #-------------------------------------------------------------------------------
87 # Handle OS specific things
87 # Handle OS specific things
88 #-------------------------------------------------------------------------------
88 #-------------------------------------------------------------------------------
89
89
90 if os.name in ('nt','dos'):
90 if os.name in ('nt','dos'):
91 os_name = 'windows'
91 os_name = 'windows'
92 else:
92 else:
93 os_name = os.name
93 os_name = os.name
94
94
95 # Under Windows, 'sdist' has not been supported. Now that the docs build with
95 # Under Windows, 'sdist' has not been supported. Now that the docs build with
96 # Sphinx it might work, but let's not turn it on until someone confirms that it
96 # Sphinx it might work, but let's not turn it on until someone confirms that it
97 # actually works.
97 # actually works.
98 if os_name == 'windows' and 'sdist' in sys.argv:
98 if os_name == 'windows' and 'sdist' in sys.argv:
99 print('The sdist command is not available under Windows. Exiting.')
99 print('The sdist command is not available under Windows. Exiting.')
100 sys.exit(1)
100 sys.exit(1)
101
101
102 #-------------------------------------------------------------------------------
102 #-------------------------------------------------------------------------------
103 # Make sure we aren't trying to run without submodules
103 # Make sure we aren't trying to run without submodules
104 #-------------------------------------------------------------------------------
104 #-------------------------------------------------------------------------------
105 here = os.path.abspath(os.path.dirname(__file__))
105 here = os.path.abspath(os.path.dirname(__file__))
106
106
107 def require_clean_submodules():
107 def require_clean_submodules():
108 """Check on git submodules before distutils can do anything
108 """Check on git submodules before distutils can do anything
109
109
110 Since distutils cannot be trusted to update the tree
110 Since distutils cannot be trusted to update the tree
111 after everything has been set in motion,
111 after everything has been set in motion,
112 this is not a distutils command.
112 this is not a distutils command.
113 """
113 """
114 # PACKAGERS: Add a return here to skip checks for git submodules
114 # PACKAGERS: Add a return here to skip checks for git submodules
115
115
116 # don't do anything if nothing is actually supposed to happen
116 # don't do anything if nothing is actually supposed to happen
117 for do_nothing in ('-h', '--help', '--help-commands', 'clean', 'submodule'):
117 for do_nothing in ('-h', '--help', '--help-commands', 'clean', 'submodule'):
118 if do_nothing in sys.argv:
118 if do_nothing in sys.argv:
119 return
119 return
120
120
121 status = check_submodule_status(here)
121 status = check_submodule_status(here)
122
122
123 if status == "missing":
123 if status == "missing":
124 print("checking out submodules for the first time")
124 print("checking out submodules for the first time")
125 update_submodules(here)
125 update_submodules(here)
126 elif status == "unclean":
126 elif status == "unclean":
127 print('\n'.join([
127 print('\n'.join([
128 "Cannot build / install IPython with unclean submodules",
128 "Cannot build / install IPython with unclean submodules",
129 "Please update submodules with",
129 "Please update submodules with",
130 " python setup.py submodule",
130 " python setup.py submodule",
131 "or",
131 "or",
132 " git submodule update",
132 " git submodule update",
133 "or commit any submodule changes you have made."
133 "or commit any submodule changes you have made."
134 ]))
134 ]))
135 sys.exit(1)
135 sys.exit(1)
136
136
137 require_clean_submodules()
137 require_clean_submodules()
138
138
139 #-------------------------------------------------------------------------------
139 #-------------------------------------------------------------------------------
140 # Things related to the IPython documentation
140 # Things related to the IPython documentation
141 #-------------------------------------------------------------------------------
141 #-------------------------------------------------------------------------------
142
142
143 # update the manuals when building a source dist
143 # update the manuals when building a source dist
144 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
144 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
145
145
146 # List of things to be updated. Each entry is a triplet of args for
146 # List of things to be updated. Each entry is a triplet of args for
147 # target_update()
147 # target_update()
148 to_update = [
148 to_update = [
149 # FIXME - Disabled for now: we need to redo an automatic way
149 # FIXME - Disabled for now: we need to redo an automatic way
150 # of generating the magic info inside the rst.
150 # of generating the magic info inside the rst.
151 #('docs/magic.tex',
151 #('docs/magic.tex',
152 #['IPython/Magic.py'],
152 #['IPython/Magic.py'],
153 #"cd doc && ./update_magic.sh" ),
153 #"cd doc && ./update_magic.sh" ),
154
154
155 ('docs/man/ipcluster.1.gz',
155 ('docs/man/ipcluster.1.gz',
156 ['docs/man/ipcluster.1'],
156 ['docs/man/ipcluster.1'],
157 'cd docs/man && gzip -9c ipcluster.1 > ipcluster.1.gz'),
157 'cd docs/man && gzip -9c ipcluster.1 > ipcluster.1.gz'),
158
158
159 ('docs/man/ipcontroller.1.gz',
159 ('docs/man/ipcontroller.1.gz',
160 ['docs/man/ipcontroller.1'],
160 ['docs/man/ipcontroller.1'],
161 'cd docs/man && gzip -9c ipcontroller.1 > ipcontroller.1.gz'),
161 'cd docs/man && gzip -9c ipcontroller.1 > ipcontroller.1.gz'),
162
162
163 ('docs/man/ipengine.1.gz',
163 ('docs/man/ipengine.1.gz',
164 ['docs/man/ipengine.1'],
164 ['docs/man/ipengine.1'],
165 'cd docs/man && gzip -9c ipengine.1 > ipengine.1.gz'),
165 'cd docs/man && gzip -9c ipengine.1 > ipengine.1.gz'),
166
166
167 ('docs/man/ipython.1.gz',
167 ('docs/man/ipython.1.gz',
168 ['docs/man/ipython.1'],
168 ['docs/man/ipython.1'],
169 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
169 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
170
170
171 ]
171 ]
172
172
173
173
174 [ target_update(*t) for t in to_update ]
174 [ target_update(*t) for t in to_update ]
175
175
176 #---------------------------------------------------------------------------
176 #---------------------------------------------------------------------------
177 # Find all the packages, package data, and data_files
177 # Find all the packages, package data, and data_files
178 #---------------------------------------------------------------------------
178 #---------------------------------------------------------------------------
179
179
180 packages = find_packages()
180 packages = find_packages()
181 package_data = find_package_data()
181 package_data = find_package_data()
182
182
183 data_files = find_data_files()
183 data_files = find_data_files()
184
184
185 setup_args['packages'] = packages
185 setup_args['packages'] = packages
186 setup_args['package_data'] = package_data
186 setup_args['package_data'] = package_data
187 setup_args['data_files'] = data_files
187 setup_args['data_files'] = data_files
188
188
189 #---------------------------------------------------------------------------
189 #---------------------------------------------------------------------------
190 # custom distutils commands
190 # custom distutils commands
191 #---------------------------------------------------------------------------
191 #---------------------------------------------------------------------------
192 # imports here, so they are after setuptools import if there was one
192 # imports here, so they are after setuptools import if there was one
193 from distutils.command.sdist import sdist
193 from distutils.command.sdist import sdist
194 from distutils.command.upload import upload
194 from distutils.command.upload import upload
195
195
196 class UploadWindowsInstallers(upload):
196 class UploadWindowsInstallers(upload):
197
197
198 description = "Upload Windows installers to PyPI (only used from tools/release_windows.py)"
198 description = "Upload Windows installers to PyPI (only used from tools/release_windows.py)"
199 user_options = upload.user_options + [
199 user_options = upload.user_options + [
200 ('files=', 'f', 'exe file (or glob) to upload')
200 ('files=', 'f', 'exe file (or glob) to upload')
201 ]
201 ]
202 def initialize_options(self):
202 def initialize_options(self):
203 upload.initialize_options(self)
203 upload.initialize_options(self)
204 meta = self.distribution.metadata
204 meta = self.distribution.metadata
205 base = '{name}-{version}'.format(
205 base = '{name}-{version}'.format(
206 name=meta.get_name(),
206 name=meta.get_name(),
207 version=meta.get_version()
207 version=meta.get_version()
208 )
208 )
209 self.files = os.path.join('dist', '%s.*.exe' % base)
209 self.files = os.path.join('dist', '%s.*.exe' % base)
210
210
211 def run(self):
211 def run(self):
212 for dist_file in glob(self.files):
212 for dist_file in glob(self.files):
213 self.upload_file('bdist_wininst', 'any', dist_file)
213 self.upload_file('bdist_wininst', 'any', dist_file)
214
214
215 setup_args['cmdclass'] = {
215 setup_args['cmdclass'] = {
216 'build_py': css_js_prerelease(
216 'build_py': css_js_prerelease(
217 check_package_data_first(git_prebuild('IPython')),
217 check_package_data_first(git_prebuild('IPython')),
218 strict=False),
218 strict=False),
219 'sdist' : css_js_prerelease(git_prebuild('IPython', sdist)),
219 'sdist' : css_js_prerelease(git_prebuild('IPython', sdist), strict=False),
220 'upload_wininst' : UploadWindowsInstallers,
220 'upload_wininst' : UploadWindowsInstallers,
221 'submodule' : UpdateSubmodules,
221 'submodule' : UpdateSubmodules,
222 'css' : CompileCSS,
222 'css' : CompileCSS,
223 'symlink': install_symlinked,
223 'symlink': install_symlinked,
224 'install_lib_symlink': install_lib_symlink,
224 'install_lib_symlink': install_lib_symlink,
225 'install_scripts_sym': install_scripts_for_symlink,
225 'install_scripts_sym': install_scripts_for_symlink,
226 'unsymlink': unsymlink,
226 'unsymlink': unsymlink,
227 'jsversion' : JavascriptVersion,
227 'jsversion' : JavascriptVersion,
228 }
228 }
229
229
230 #---------------------------------------------------------------------------
230 #---------------------------------------------------------------------------
231 # Handle scripts, dependencies, and setuptools specific things
231 # Handle scripts, dependencies, and setuptools specific things
232 #---------------------------------------------------------------------------
232 #---------------------------------------------------------------------------
233
233
234 # For some commands, use setuptools. Note that we do NOT list install here!
234 # For some commands, use setuptools. Note that we do NOT list install here!
235 # If you want a setuptools-enhanced install, just run 'setupegg.py install'
235 # If you want a setuptools-enhanced install, just run 'setupegg.py install'
236 needs_setuptools = set(('develop', 'release', 'bdist_egg', 'bdist_rpm',
236 needs_setuptools = set(('develop', 'release', 'bdist_egg', 'bdist_rpm',
237 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel',
237 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel',
238 'egg_info', 'easy_install', 'upload', 'install_egg_info',
238 'egg_info', 'easy_install', 'upload', 'install_egg_info',
239 ))
239 ))
240
240
241 if len(needs_setuptools.intersection(sys.argv)) > 0:
241 if len(needs_setuptools.intersection(sys.argv)) > 0:
242 import setuptools
242 import setuptools
243
243
244 # This dict is used for passing extra arguments that are setuptools
244 # This dict is used for passing extra arguments that are setuptools
245 # specific to setup
245 # specific to setup
246 setuptools_extra_args = {}
246 setuptools_extra_args = {}
247
247
248 # setuptools requirements
248 # setuptools requirements
249
249
250 extras_require = dict(
250 extras_require = dict(
251 parallel = ['pyzmq>=2.1.11'],
251 parallel = ['pyzmq>=2.1.11'],
252 qtconsole = ['pyzmq>=2.1.11', 'pygments'],
252 qtconsole = ['pyzmq>=2.1.11', 'pygments'],
253 zmq = ['pyzmq>=2.1.11'],
253 zmq = ['pyzmq>=2.1.11'],
254 doc = ['Sphinx>=1.1', 'numpydoc'],
254 doc = ['Sphinx>=1.1', 'numpydoc'],
255 test = ['nose>=0.10.1', 'requests'],
255 test = ['nose>=0.10.1', 'requests'],
256 terminal = [],
256 terminal = [],
257 nbformat = ['jsonschema>=2.0'],
257 nbformat = ['jsonschema>=2.0'],
258 notebook = ['tornado>=4.0', 'pyzmq>=2.1.11', 'jinja2', 'pygments', 'mistune>=0.5'],
258 notebook = ['tornado>=4.0', 'pyzmq>=2.1.11', 'jinja2', 'pygments', 'mistune>=0.5'],
259 nbconvert = ['pygments', 'jinja2', 'mistune>=0.3.1']
259 nbconvert = ['pygments', 'jinja2', 'mistune>=0.3.1']
260 )
260 )
261
261
262 if sys.version_info < (3, 3):
262 if sys.version_info < (3, 3):
263 extras_require['test'].append('mock')
263 extras_require['test'].append('mock')
264
264
265 extras_require['notebook'].extend(extras_require['nbformat'])
265 extras_require['notebook'].extend(extras_require['nbformat'])
266 extras_require['nbconvert'].extend(extras_require['nbformat'])
266 extras_require['nbconvert'].extend(extras_require['nbformat'])
267
267
268 everything = set()
268 everything = set()
269 for deps in extras_require.values():
269 for deps in extras_require.values():
270 everything.update(deps)
270 everything.update(deps)
271 extras_require['all'] = everything
271 extras_require['all'] = everything
272
272
273 install_requires = []
273 install_requires = []
274
274
275 # add readline
275 # add readline
276 if sys.platform == 'darwin':
276 if sys.platform == 'darwin':
277 if 'bdist_wheel' in sys.argv[1:] or not setupext.check_for_readline():
277 if 'bdist_wheel' in sys.argv[1:] or not setupext.check_for_readline():
278 install_requires.append('gnureadline')
278 install_requires.append('gnureadline')
279 elif sys.platform.startswith('win'):
279 elif sys.platform.startswith('win'):
280 extras_require['terminal'].append('pyreadline>=2.0')
280 extras_require['terminal'].append('pyreadline>=2.0')
281
281
282
282
283 if 'setuptools' in sys.modules:
283 if 'setuptools' in sys.modules:
284 # setup.py develop should check for submodules
284 # setup.py develop should check for submodules
285 from setuptools.command.develop import develop
285 from setuptools.command.develop import develop
286 setup_args['cmdclass']['develop'] = require_submodules(develop)
286 setup_args['cmdclass']['develop'] = require_submodules(develop)
287 setup_args['cmdclass']['bdist_wheel'] = css_js_prerelease(get_bdist_wheel())
287 setup_args['cmdclass']['bdist_wheel'] = css_js_prerelease(get_bdist_wheel(), strict=False)
288
288
289 setuptools_extra_args['zip_safe'] = False
289 setuptools_extra_args['zip_safe'] = False
290 setuptools_extra_args['entry_points'] = {'console_scripts':find_entry_points()}
290 setuptools_extra_args['entry_points'] = {'console_scripts':find_entry_points()}
291 setup_args['extras_require'] = extras_require
291 setup_args['extras_require'] = extras_require
292 requires = setup_args['install_requires'] = install_requires
292 requires = setup_args['install_requires'] = install_requires
293
293
294 # Script to be run by the windows binary installer after the default setup
294 # Script to be run by the windows binary installer after the default setup
295 # routine, to add shortcuts and similar windows-only things. Windows
295 # routine, to add shortcuts and similar windows-only things. Windows
296 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
296 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
297 # doesn't find them.
297 # doesn't find them.
298 if 'bdist_wininst' in sys.argv:
298 if 'bdist_wininst' in sys.argv:
299 if len(sys.argv) > 2 and \
299 if len(sys.argv) > 2 and \
300 ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
300 ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
301 print("ERROR: bdist_wininst must be run alone. Exiting.", file=sys.stderr)
301 print("ERROR: bdist_wininst must be run alone. Exiting.", file=sys.stderr)
302 sys.exit(1)
302 sys.exit(1)
303 setup_args['data_files'].append(
303 setup_args['data_files'].append(
304 ['Scripts', ('scripts/ipython.ico', 'scripts/ipython_nb.ico')])
304 ['Scripts', ('scripts/ipython.ico', 'scripts/ipython_nb.ico')])
305 setup_args['scripts'] = [pjoin('scripts','ipython_win_post_install.py')]
305 setup_args['scripts'] = [pjoin('scripts','ipython_win_post_install.py')]
306 setup_args['options'] = {"bdist_wininst":
306 setup_args['options'] = {"bdist_wininst":
307 {"install_script":
307 {"install_script":
308 "ipython_win_post_install.py"}}
308 "ipython_win_post_install.py"}}
309
309
310 else:
310 else:
311 # If we are installing without setuptools, call this function which will
311 # If we are installing without setuptools, call this function which will
312 # check for dependencies an inform the user what is needed. This is
312 # check for dependencies an inform the user what is needed. This is
313 # just to make life easy for users.
313 # just to make life easy for users.
314 for install_cmd in ('install', 'symlink'):
314 for install_cmd in ('install', 'symlink'):
315 if install_cmd in sys.argv:
315 if install_cmd in sys.argv:
316 check_for_dependencies()
316 check_for_dependencies()
317 break
317 break
318 # scripts has to be a non-empty list, or install_scripts isn't called
318 # scripts has to be a non-empty list, or install_scripts isn't called
319 setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()]
319 setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()]
320
320
321 setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt
321 setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt
322
322
323 #---------------------------------------------------------------------------
323 #---------------------------------------------------------------------------
324 # Do the actual setup now
324 # Do the actual setup now
325 #---------------------------------------------------------------------------
325 #---------------------------------------------------------------------------
326
326
327 setup_args.update(setuptools_extra_args)
327 setup_args.update(setuptools_extra_args)
328
328
329 def main():
329 def main():
330 setup(**setup_args)
330 setup(**setup_args)
331
331
332 if __name__ == '__main__':
332 if __name__ == '__main__':
333 main()
333 main()
@@ -1,79 +1,81 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 """IPython release script.
2 """IPython release script.
3
3
4 This should ONLY be run at real release time.
4 This should ONLY be run at real release time.
5 """
5 """
6 from __future__ import print_function
6 from __future__ import print_function
7
7
8 from toollib import *
8 from toollib import *
9 from gh_api import post_download
9 from gh_api import post_download
10
10
11 # Get main ipython dir, this will raise if it doesn't pass some checks
11 # Get main ipython dir, this will raise if it doesn't pass some checks
12 ipdir = get_ipdir()
12 ipdir = get_ipdir()
13 tooldir = pjoin(ipdir, 'tools')
13 tooldir = pjoin(ipdir, 'tools')
14 distdir = pjoin(ipdir, 'dist')
14 distdir = pjoin(ipdir, 'dist')
15
15
16 # Where I keep static backups of each release
16 # Where I keep static backups of each release
17 ipbackupdir = os.path.expanduser('~/ipython/backup')
17 ipbackupdir = os.path.expanduser('~/ipython/backup')
18 if not os.path.exists(ipbackupdir):
18 if not os.path.exists(ipbackupdir):
19 os.makedirs(ipbackupdir)
19 os.makedirs(ipbackupdir)
20
20
21 # Start in main IPython dir
21 # Start in main IPython dir
22 cd(ipdir)
22 cd(ipdir)
23
23
24 # Load release info
24 # Load release info
25 execfile(pjoin('IPython','core','release.py'))
25 execfile(pjoin('IPython','core','release.py'), globals())
26 # ensure js version is in sync
26 # ensure js version is in sync
27 sh('./setup.py jsversion')
27 sh('./setup.py jsversion')
28 # build minified css and sourcemaps
29 sh('./setup.py css -x -f')
28
30
29 # Build site addresses for file uploads
31 # Build site addresses for file uploads
30 release_site = '%s/release/%s' % (archive, version)
32 release_site = '%s/release/%s' % (archive, version)
31 backup_site = '%s/backup/' % archive
33 backup_site = '%s/backup/' % archive
32
34
33 # Start actual release process
35 # Start actual release process
34 print()
36 print()
35 print('Releasing IPython')
37 print('Releasing IPython')
36 print('=================')
38 print('=================')
37 print()
39 print()
38 print('Version:', version)
40 print('Version:', version)
39 print()
41 print()
40 print('Source IPython directory:', ipdir)
42 print('Source IPython directory:', ipdir)
41 print()
43 print()
42
44
43 # Perform local backup, go to tools dir to run it.
45 # Perform local backup, go to tools dir to run it.
44 cd(tooldir)
46 cd(tooldir)
45 sh('./make_tarball.py')
47 sh('./make_tarball.py')
46 sh('mv ipython-*.tgz %s' % ipbackupdir)
48 sh('mv ipython-*.tgz %s' % ipbackupdir)
47
49
48 # Build release files
50 # Build release files
49 sh('./build_release %s' % ipdir)
51 sh('./build_release %s' % ipdir)
50
52
51 # Register with the Python Package Index (PyPI)
53 # Register with the Python Package Index (PyPI)
52 print( 'Registering with PyPI...')
54 print( 'Registering with PyPI...')
53 cd(ipdir)
55 cd(ipdir)
54 sh('./setup.py register')
56 sh('./setup.py register')
55
57
56 # Upload all files
58 # Upload all files
57 sh(sdists + ' upload')
59 sh(sdists + ' upload')
58 for py in ('2.7', '3.4'):
60 for py in ('2.7', '3.4'):
59 sh('python%s setupegg.py bdist_wheel upload' % py)
61 sh('python%s setupegg.py bdist_wheel upload' % py)
60
62
61 cd(distdir)
63 cd(distdir)
62 print( 'Uploading distribution files...')
64 print( 'Uploading distribution files...')
63
65
64 for fname in os.listdir('.'):
66 for fname in os.listdir('.'):
65 # TODO: update to GitHub releases API
67 # TODO: update to GitHub releases API
66 continue
68 continue
67 print('uploading %s to GitHub' % fname)
69 print('uploading %s to GitHub' % fname)
68 desc = "IPython %s source distribution" % version
70 desc = "IPython %s source distribution" % version
69 post_download("ipython/ipython", fname, description=desc)
71 post_download("ipython/ipython", fname, description=desc)
70
72
71 # Make target dir if it doesn't exist
73 # Make target dir if it doesn't exist
72 sh('ssh %s "mkdir -p %s/release/%s" ' % (archive_user, archive_dir, version))
74 sh('ssh %s "mkdir -p %s/release/%s" ' % (archive_user, archive_dir, version))
73 sh('scp * %s' % release_site)
75 sh('scp * %s' % release_site)
74
76
75 print( 'Uploading backup files...')
77 print( 'Uploading backup files...')
76 cd(ipbackupdir)
78 cd(ipbackupdir)
77 sh('scp `ls -1tr *tgz | tail -1` %s' % backup_site)
79 sh('scp `ls -1tr *tgz | tail -1` %s' % backup_site)
78
80
79 print('Done!')
81 print('Done!')
@@ -1,61 +1,68 b''
1 """Various utilities common to IPython release and maintenance tools.
1 """Various utilities common to IPython release and maintenance tools.
2 """
2 """
3 from __future__ import print_function
3 from __future__ import print_function
4
4
5 # Library imports
5 # Library imports
6 import os
6 import os
7 import sys
7 import sys
8
8
9 # Useful shorthands
9 # Useful shorthands
10 pjoin = os.path.join
10 pjoin = os.path.join
11 cd = os.chdir
11 cd = os.chdir
12
12
13 # Constants
13 # Constants
14
14
15 # SSH root address of the archive site
15 # SSH root address of the archive site
16 archive_user = 'ipython@archive.ipython.org'
16 archive_user = 'ipython@archive.ipython.org'
17 archive_dir = 'archive.ipython.org'
17 archive_dir = 'archive.ipython.org'
18 archive = '%s:%s' % (archive_user, archive_dir)
18 archive = '%s:%s' % (archive_user, archive_dir)
19
19
20 # Build commands
20 # Build commands
21 # Source dists
21 # Source dists
22 sdists = './setup.py sdist --formats=gztar,zip'
22 sdists = './setup.py sdist --formats=gztar,zip'
23 # Binary dists
23 # Binary dists
24 wheels = './setupegg.py bdist_wheel'
24 wheels = './setupegg.py bdist_wheel'
25
25
26 # Utility functions
26 # Utility functions
27 def sh(cmd):
27 def sh(cmd):
28 """Run system command in shell, raise SystemExit if it returns an error."""
28 """Run system command in shell, raise SystemExit if it returns an error."""
29 print("$", cmd)
29 print("$", cmd)
30 stat = os.system(cmd)
30 stat = os.system(cmd)
31 #stat = 0 # Uncomment this and comment previous to run in debug mode
31 #stat = 0 # Uncomment this and comment previous to run in debug mode
32 if stat:
32 if stat:
33 raise SystemExit("Command %s failed with code: %s" % (cmd, stat))
33 raise SystemExit("Command %s failed with code: %s" % (cmd, stat))
34
34
35 # Backwards compatibility
35 # Backwards compatibility
36 c = sh
36 c = sh
37
37
38 def get_ipdir():
38 def get_ipdir():
39 """Get IPython directory from command line, or assume it's the one above."""
39 """Get IPython directory from command line, or assume it's the one above."""
40
40
41 # Initialize arguments and check location
41 # Initialize arguments and check location
42 try:
42 try:
43 ipdir = sys.argv[1]
43 ipdir = sys.argv[1]
44 except IndexError:
44 except IndexError:
45 ipdir = pjoin(os.path.dirname(__file__), os.pardir)
45 ipdir = pjoin(os.path.dirname(__file__), os.pardir)
46
46
47 ipdir = os.path.abspath(ipdir)
47 ipdir = os.path.abspath(ipdir)
48
48
49 cd(ipdir)
49 cd(ipdir)
50 if not os.path.isdir('IPython') and os.path.isfile('setup.py'):
50 if not os.path.isdir('IPython') and os.path.isfile('setup.py'):
51 raise SystemExit('Invalid ipython directory: %s' % ipdir)
51 raise SystemExit('Invalid ipython directory: %s' % ipdir)
52 return ipdir
52 return ipdir
53
53
54
54
55 def compile_tree():
55 def compile_tree():
56 """Compile all Python files below current directory."""
56 """Compile all Python files below current directory."""
57 stat = os.system('python -m compileall .')
57 stat = os.system('python -m compileall .')
58 if stat:
58 if stat:
59 msg = '*** ERROR: Some Python files in tree do NOT compile! ***\n'
59 msg = '*** ERROR: Some Python files in tree do NOT compile! ***\n'
60 msg += 'See messages above for the actual file that produced it.\n'
60 msg += 'See messages above for the actual file that produced it.\n'
61 raise SystemExit(msg)
61 raise SystemExit(msg)
62
63 try:
64 execfile
65 except NameError:
66 def execfile(fname, globs, locs=None):
67 locs = locs or globs
68 exec(compile(open(fname).read(), fname, "exec"), globs, locs)
General Comments 0
You need to be logged in to leave comments. Login now