##// END OF EJS Templates
disable install from master...
Min RK -
Show More
@@ -1,342 +1,360 b''
1 1 #!/usr/bin/env python
2 2 # -*- coding: utf-8 -*-
3 3 """Setup script for IPython.
4 4
5 5 Under Posix environments it works like a typical setup.py script.
6 6 Under Windows, the command sdist is not supported, since IPython
7 7 requires utilities which are not available under Windows."""
8 8
9 9 #-----------------------------------------------------------------------------
10 10 # Copyright (c) 2008-2011, IPython Development Team.
11 11 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
12 12 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
13 13 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
14 14 #
15 15 # Distributed under the terms of the Modified BSD License.
16 16 #
17 17 # The full license is in the file COPYING.rst, distributed with this software.
18 18 #-----------------------------------------------------------------------------
19 19
20 20 #-----------------------------------------------------------------------------
21 21 # Minimal Python version sanity check
22 22 #-----------------------------------------------------------------------------
23 23 from __future__ import print_function
24 24
25 25 import sys
26 26
27 27 # This check is also made in IPython/__init__, don't forget to update both when
28 28 # changing Python version requirements.
29 29 v = sys.version_info
30 30 if v[:2] < (2,7) or (v[0] >= 3 and v[:2] < (3,3)):
31 31 error = "ERROR: IPython requires Python version 2.7 or 3.3 or above."
32 32 print(error, file=sys.stderr)
33 33 sys.exit(1)
34 34
35 35 PY3 = (sys.version_info[0] >= 3)
36 36
37 37 # At least we're on the python version we need, move on.
38 38
39 39 #-------------------------------------------------------------------------------
40 40 # Imports
41 41 #-------------------------------------------------------------------------------
42 42
43 43 # Stdlib imports
44 44 import os
45 45 import shutil
46 46
47 47 from glob import glob
48 48
49 49 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
50 50 # update it when the contents of directories change.
51 51 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
52 52
53 53 from distutils.core import setup
54 54
55 55 # Our own imports
56 56 from setupbase import target_update
57 57
58 58 from setupbase import (
59 59 setup_args,
60 60 find_packages,
61 61 find_package_data,
62 62 check_package_data_first,
63 63 find_entry_points,
64 64 build_scripts_entrypt,
65 65 find_data_files,
66 66 check_for_readline,
67 67 git_prebuild,
68 68 check_submodule_status,
69 69 update_submodules,
70 70 require_submodules,
71 71 UpdateSubmodules,
72 72 get_bdist_wheel,
73 73 CompileCSS,
74 74 JavascriptVersion,
75 75 css_js_prerelease,
76 76 install_symlinked,
77 77 install_lib_symlink,
78 78 install_scripts_for_symlink,
79 79 unsymlink,
80 80 )
81 81
82 82 isfile = os.path.isfile
83 83 pjoin = os.path.join
84 84
85 85 #-------------------------------------------------------------------------------
86 86 # Handle OS specific things
87 87 #-------------------------------------------------------------------------------
88 88
89 89 if os.name in ('nt','dos'):
90 90 os_name = 'windows'
91 91 else:
92 92 os_name = os.name
93 93
94 94 # Under Windows, 'sdist' has not been supported. Now that the docs build with
95 95 # Sphinx it might work, but let's not turn it on until someone confirms that it
96 96 # actually works.
97 97 if os_name == 'windows' and 'sdist' in sys.argv:
98 98 print('The sdist command is not available under Windows. Exiting.')
99 99 sys.exit(1)
100 100
101 101 #-------------------------------------------------------------------------------
102 102 # Make sure we aren't trying to run without submodules
103 103 #-------------------------------------------------------------------------------
104 104 here = os.path.abspath(os.path.dirname(__file__))
105 105
106 106 def require_clean_submodules():
107 107 """Check on git submodules before distutils can do anything
108 108
109 109 Since distutils cannot be trusted to update the tree
110 110 after everything has been set in motion,
111 111 this is not a distutils command.
112 112 """
113 113 # PACKAGERS: Add a return here to skip checks for git submodules
114 114
115 115 # don't do anything if nothing is actually supposed to happen
116 116 for do_nothing in ('-h', '--help', '--help-commands', 'clean', 'submodule'):
117 117 if do_nothing in sys.argv:
118 118 return
119 119
120 120 status = check_submodule_status(here)
121 121
122 122 if status == "missing":
123 123 print("checking out submodules for the first time")
124 124 update_submodules(here)
125 125 elif status == "unclean":
126 126 print('\n'.join([
127 127 "Cannot build / install IPython with unclean submodules",
128 128 "Please update submodules with",
129 129 " python setup.py submodule",
130 130 "or",
131 131 " git submodule update",
132 132 "or commit any submodule changes you have made."
133 133 ]))
134 134 sys.exit(1)
135 135
136 136 require_clean_submodules()
137 137
138 138 #-------------------------------------------------------------------------------
139 139 # Things related to the IPython documentation
140 140 #-------------------------------------------------------------------------------
141 141
142 142 # update the manuals when building a source dist
143 143 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
144 144
145 145 # List of things to be updated. Each entry is a triplet of args for
146 146 # target_update()
147 147 to_update = [
148 148 # FIXME - Disabled for now: we need to redo an automatic way
149 149 # of generating the magic info inside the rst.
150 150 #('docs/magic.tex',
151 151 #['IPython/Magic.py'],
152 152 #"cd doc && ./update_magic.sh" ),
153 153
154 154 ('docs/man/ipcluster.1.gz',
155 155 ['docs/man/ipcluster.1'],
156 156 'cd docs/man && gzip -9c ipcluster.1 > ipcluster.1.gz'),
157 157
158 158 ('docs/man/ipcontroller.1.gz',
159 159 ['docs/man/ipcontroller.1'],
160 160 'cd docs/man && gzip -9c ipcontroller.1 > ipcontroller.1.gz'),
161 161
162 162 ('docs/man/ipengine.1.gz',
163 163 ['docs/man/ipengine.1'],
164 164 'cd docs/man && gzip -9c ipengine.1 > ipengine.1.gz'),
165 165
166 166 ('docs/man/ipython.1.gz',
167 167 ['docs/man/ipython.1'],
168 168 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
169 169
170 170 ]
171 171
172 172
173 173 [ target_update(*t) for t in to_update ]
174 174
175 175 #---------------------------------------------------------------------------
176 176 # Find all the packages, package data, and data_files
177 177 #---------------------------------------------------------------------------
178 178
179 179 packages = find_packages()
180 180 package_data = find_package_data()
181 181
182 182 data_files = find_data_files()
183 183
184 184 setup_args['packages'] = packages
185 185 setup_args['package_data'] = package_data
186 186 setup_args['data_files'] = data_files
187 187
188 188 #---------------------------------------------------------------------------
189 189 # custom distutils commands
190 190 #---------------------------------------------------------------------------
191 191 # imports here, so they are after setuptools import if there was one
192 192 from distutils.command.sdist import sdist
193 193 from distutils.command.upload import upload
194 194
195 195 class UploadWindowsInstallers(upload):
196 196
197 197 description = "Upload Windows installers to PyPI (only used from tools/release_windows.py)"
198 198 user_options = upload.user_options + [
199 199 ('files=', 'f', 'exe file (or glob) to upload')
200 200 ]
201 201 def initialize_options(self):
202 202 upload.initialize_options(self)
203 203 meta = self.distribution.metadata
204 204 base = '{name}-{version}'.format(
205 205 name=meta.get_name(),
206 206 version=meta.get_version()
207 207 )
208 208 self.files = os.path.join('dist', '%s.*.exe' % base)
209 209
210 210 def run(self):
211 211 for dist_file in glob(self.files):
212 212 self.upload_file('bdist_wininst', 'any', dist_file)
213 213
214 214 setup_args['cmdclass'] = {
215 215 'build_py': css_js_prerelease(
216 216 check_package_data_first(git_prebuild('IPython'))),
217 217 'sdist' : css_js_prerelease(git_prebuild('IPython', sdist)),
218 218 'upload_wininst' : UploadWindowsInstallers,
219 219 'submodule' : UpdateSubmodules,
220 220 'css' : CompileCSS,
221 221 'symlink': install_symlinked,
222 222 'install_lib_symlink': install_lib_symlink,
223 223 'install_scripts_sym': install_scripts_for_symlink,
224 224 'unsymlink': unsymlink,
225 225 'jsversion' : JavascriptVersion,
226 226 }
227 227
228 ### Temporarily disable install while it's broken during the big split
229 from textwrap import dedent
230 from distutils.command.install import install
231
232 class DisabledInstall(install):
233 def run(self):
234 msg = dedent("""
235 While we are in the midst of The Big Split,
236 IPython cannot be installed from master.
237 You can use `pip install -e .` for an editable install,
238 which still works.
239 """)
240 print(msg, file=sys.stderr)
241 raise SystemExit(1)
242
243 setup_args['cmdclass']['install'] = DisabledInstall
244
245
228 246 #---------------------------------------------------------------------------
229 247 # Handle scripts, dependencies, and setuptools specific things
230 248 #---------------------------------------------------------------------------
231 249
232 250 # For some commands, use setuptools. Note that we do NOT list install here!
233 251 # If you want a setuptools-enhanced install, just run 'setupegg.py install'
234 252 needs_setuptools = set(('develop', 'release', 'bdist_egg', 'bdist_rpm',
235 253 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel',
236 254 'egg_info', 'easy_install', 'upload', 'install_egg_info',
237 255 ))
238 256
239 257 if len(needs_setuptools.intersection(sys.argv)) > 0:
240 258 import setuptools
241 259
242 260 # This dict is used for passing extra arguments that are setuptools
243 261 # specific to setup
244 262 setuptools_extra_args = {}
245 263
246 264 # setuptools requirements
247 265
248 266 pyzmq = 'pyzmq>=13'
249 267
250 268 extras_require = dict(
251 269 parallel = [pyzmq],
252 270 qtconsole = [pyzmq, 'pygments'],
253 271 doc = ['Sphinx>=1.1', 'numpydoc'],
254 272 test = ['nose>=0.10.1', 'requests'],
255 273 terminal = [],
256 274 nbformat = ['jsonschema>=2.0'],
257 275 notebook = ['tornado>=4.0', pyzmq, 'jinja2', 'pygments', 'mistune>=0.5'],
258 276 nbconvert = ['pygments', 'jinja2', 'mistune>=0.3.1']
259 277 )
260 278
261 279 if not sys.platform.startswith('win'):
262 280 extras_require['notebook'].append('terminado>=0.3.3')
263 281
264 282 if sys.version_info < (3, 3):
265 283 extras_require['test'].append('mock')
266 284
267 285 extras_require['notebook'].extend(extras_require['nbformat'])
268 286 extras_require['nbconvert'].extend(extras_require['nbformat'])
269 287
270 288 install_requires = [
271 289 'decorator',
272 290 'pickleshare',
273 291 'simplegeneric>0.8',
274 292 ]
275 293
276 294 # add platform-specific dependencies
277 295 if sys.platform == 'darwin':
278 296 install_requires.append('appnope')
279 297 if 'bdist_wheel' in sys.argv[1:] or not check_for_readline():
280 298 install_requires.append('gnureadline')
281 299
282 300 if sys.platform.startswith('win'):
283 301 extras_require['terminal'].append('pyreadline>=2.0')
284 302 else:
285 303 install_requires.append('pexpect')
286 304
287 305 everything = set()
288 306 for deps in extras_require.values():
289 307 everything.update(deps)
290 308 extras_require['all'] = everything
291 309
292 310 if 'setuptools' in sys.modules:
293 311 # setup.py develop should check for submodules
294 312 from setuptools.command.develop import develop
295 313 setup_args['cmdclass']['develop'] = require_submodules(develop)
296 314 setup_args['cmdclass']['bdist_wheel'] = css_js_prerelease(get_bdist_wheel())
297 315
298 316 setuptools_extra_args['zip_safe'] = False
299 317 setuptools_extra_args['entry_points'] = {
300 318 'console_scripts': find_entry_points(),
301 319 'pygments.lexers': [
302 320 'ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer',
303 321 'ipython = IPython.lib.lexers:IPythonLexer',
304 322 'ipython3 = IPython.lib.lexers:IPython3Lexer',
305 323 ],
306 324 }
307 325 setup_args['extras_require'] = extras_require
308 326 requires = setup_args['install_requires'] = install_requires
309 327
310 328 # Script to be run by the windows binary installer after the default setup
311 329 # routine, to add shortcuts and similar windows-only things. Windows
312 330 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
313 331 # doesn't find them.
314 332 if 'bdist_wininst' in sys.argv:
315 333 if len(sys.argv) > 2 and \
316 334 ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
317 335 print("ERROR: bdist_wininst must be run alone. Exiting.", file=sys.stderr)
318 336 sys.exit(1)
319 337 setup_args['data_files'].append(
320 338 ['Scripts', ('scripts/ipython.ico', 'scripts/ipython_nb.ico')])
321 339 setup_args['scripts'] = [pjoin('scripts','ipython_win_post_install.py')]
322 340 setup_args['options'] = {"bdist_wininst":
323 341 {"install_script":
324 342 "ipython_win_post_install.py"}}
325 343
326 344 else:
327 345 # scripts has to be a non-empty list, or install_scripts isn't called
328 346 setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()]
329 347
330 348 setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt
331 349
332 350 #---------------------------------------------------------------------------
333 351 # Do the actual setup now
334 352 #---------------------------------------------------------------------------
335 353
336 354 setup_args.update(setuptools_extra_args)
337 355
338 356 def main():
339 357 setup(**setup_args)
340 358
341 359 if __name__ == '__main__':
342 360 main()
General Comments 0
You need to be logged in to leave comments. Login now