##// END OF EJS Templates
Suppress message about pip if we do find a new enough pip
Thomas Kluyver -
Show More
@@ -1,262 +1,265 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 from __future__ import print_function
20 from __future__ import print_function
21
21
22 import os
22 import os
23 import sys
23 import sys
24
24
25 # **Python version check**
25 # **Python version check**
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 if sys.version_info < (3, 3):
29 if sys.version_info < (3, 3):
30 pip_message = 'This may be due to an out of date pip. Make sure you have pip >= 9.0.1.'
30 pip_message = 'This may be due to an out of date pip. Make sure you have pip >= 9.0.1.'
31 try:
31 try:
32 import pip
32 import pip
33 pip_version = tuple([int(x) for x in pip.__version__.split('.')[:3]])
33 pip_version = tuple([int(x) for x in pip.__version__.split('.')[:3]])
34 if pip_version < (9, 0, 1) :
34 if pip_version < (9, 0, 1) :
35 pip_message = 'Your pip version is out of date, please install pip >= 9.0.1. '\
35 pip_message = 'Your pip version is out of date, please install pip >= 9.0.1. '\
36 'pip {} detected.'.format(pip.__version__)
36 'pip {} detected.'.format(pip.__version__)
37 else:
38 # pip is new enough - it must be something else
39 pip_message = ''
37 except Exception:
40 except Exception:
38 pass
41 pass
39
42
40
43
41 error = """
44 error = """
42 IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.
45 IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.
43 When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
46 When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
44 Beginning with IPython 6.0, Python 3.3 and above is required.
47 Beginning with IPython 6.0, Python 3.3 and above is required.
45
48
46 See IPython `README.rst` file for more information:
49 See IPython `README.rst` file for more information:
47
50
48 https://github.com/ipython/ipython/blob/master/README.rst
51 https://github.com/ipython/ipython/blob/master/README.rst
49
52
50 Python {py} detected.
53 Python {py} detected.
51 {pip}
54 {pip}
52 """.format(py=sys.version_info, pip=pip_message )
55 """.format(py=sys.version_info, pip=pip_message )
53
56
54 print(error, file=sys.stderr)
57 print(error, file=sys.stderr)
55 sys.exit(1)
58 sys.exit(1)
56
59
57 # At least we're on the python version we need, move on.
60 # At least we're on the python version we need, move on.
58
61
59 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
62 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
60 # update it when the contents of directories change.
63 # update it when the contents of directories change.
61 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
64 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
62
65
63 from distutils.core import setup
66 from distutils.core import setup
64
67
65 # Our own imports
68 # Our own imports
66 from setupbase import target_update
69 from setupbase import target_update
67
70
68 from setupbase import (
71 from setupbase import (
69 setup_args,
72 setup_args,
70 find_packages,
73 find_packages,
71 find_package_data,
74 find_package_data,
72 check_package_data_first,
75 check_package_data_first,
73 find_entry_points,
76 find_entry_points,
74 build_scripts_entrypt,
77 build_scripts_entrypt,
75 find_data_files,
78 find_data_files,
76 git_prebuild,
79 git_prebuild,
77 install_symlinked,
80 install_symlinked,
78 install_lib_symlink,
81 install_lib_symlink,
79 install_scripts_for_symlink,
82 install_scripts_for_symlink,
80 unsymlink,
83 unsymlink,
81 )
84 )
82
85
83 isfile = os.path.isfile
86 isfile = os.path.isfile
84 pjoin = os.path.join
87 pjoin = os.path.join
85
88
86 #-------------------------------------------------------------------------------
89 #-------------------------------------------------------------------------------
87 # Handle OS specific things
90 # Handle OS specific things
88 #-------------------------------------------------------------------------------
91 #-------------------------------------------------------------------------------
89
92
90 if os.name in ('nt','dos'):
93 if os.name in ('nt','dos'):
91 os_name = 'windows'
94 os_name = 'windows'
92 else:
95 else:
93 os_name = os.name
96 os_name = os.name
94
97
95 # Under Windows, 'sdist' has not been supported. Now that the docs build with
98 # 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
99 # Sphinx it might work, but let's not turn it on until someone confirms that it
97 # actually works.
100 # actually works.
98 if os_name == 'windows' and 'sdist' in sys.argv:
101 if os_name == 'windows' and 'sdist' in sys.argv:
99 print('The sdist command is not available under Windows. Exiting.')
102 print('The sdist command is not available under Windows. Exiting.')
100 sys.exit(1)
103 sys.exit(1)
101
104
102
105
103 #-------------------------------------------------------------------------------
106 #-------------------------------------------------------------------------------
104 # Things related to the IPython documentation
107 # Things related to the IPython documentation
105 #-------------------------------------------------------------------------------
108 #-------------------------------------------------------------------------------
106
109
107 # update the manuals when building a source dist
110 # update the manuals when building a source dist
108 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
111 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
109
112
110 # List of things to be updated. Each entry is a triplet of args for
113 # List of things to be updated. Each entry is a triplet of args for
111 # target_update()
114 # target_update()
112 to_update = [
115 to_update = [
113 ('docs/man/ipython.1.gz',
116 ('docs/man/ipython.1.gz',
114 ['docs/man/ipython.1'],
117 ['docs/man/ipython.1'],
115 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
118 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
116 ]
119 ]
117
120
118
121
119 [ target_update(*t) for t in to_update ]
122 [ target_update(*t) for t in to_update ]
120
123
121 #---------------------------------------------------------------------------
124 #---------------------------------------------------------------------------
122 # Find all the packages, package data, and data_files
125 # Find all the packages, package data, and data_files
123 #---------------------------------------------------------------------------
126 #---------------------------------------------------------------------------
124
127
125 packages = find_packages()
128 packages = find_packages()
126 package_data = find_package_data()
129 package_data = find_package_data()
127
130
128 data_files = find_data_files()
131 data_files = find_data_files()
129
132
130 setup_args['packages'] = packages
133 setup_args['packages'] = packages
131 setup_args['package_data'] = package_data
134 setup_args['package_data'] = package_data
132 setup_args['data_files'] = data_files
135 setup_args['data_files'] = data_files
133
136
134 #---------------------------------------------------------------------------
137 #---------------------------------------------------------------------------
135 # custom distutils commands
138 # custom distutils commands
136 #---------------------------------------------------------------------------
139 #---------------------------------------------------------------------------
137 # imports here, so they are after setuptools import if there was one
140 # imports here, so they are after setuptools import if there was one
138 from distutils.command.sdist import sdist
141 from distutils.command.sdist import sdist
139
142
140 setup_args['cmdclass'] = {
143 setup_args['cmdclass'] = {
141 'build_py': \
144 'build_py': \
142 check_package_data_first(git_prebuild('IPython')),
145 check_package_data_first(git_prebuild('IPython')),
143 'sdist' : git_prebuild('IPython', sdist),
146 'sdist' : git_prebuild('IPython', sdist),
144 'symlink': install_symlinked,
147 'symlink': install_symlinked,
145 'install_lib_symlink': install_lib_symlink,
148 'install_lib_symlink': install_lib_symlink,
146 'install_scripts_sym': install_scripts_for_symlink,
149 'install_scripts_sym': install_scripts_for_symlink,
147 'unsymlink': unsymlink,
150 'unsymlink': unsymlink,
148 }
151 }
149
152
150
153
151 #---------------------------------------------------------------------------
154 #---------------------------------------------------------------------------
152 # Handle scripts, dependencies, and setuptools specific things
155 # Handle scripts, dependencies, and setuptools specific things
153 #---------------------------------------------------------------------------
156 #---------------------------------------------------------------------------
154
157
155 # For some commands, use setuptools. Note that we do NOT list install here!
158 # For some commands, use setuptools. Note that we do NOT list install here!
156 # If you want a setuptools-enhanced install, just run 'setupegg.py install'
159 # If you want a setuptools-enhanced install, just run 'setupegg.py install'
157 needs_setuptools = {'develop', 'release', 'bdist_egg', 'bdist_rpm',
160 needs_setuptools = {'develop', 'release', 'bdist_egg', 'bdist_rpm',
158 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel',
161 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel',
159 'egg_info', 'easy_install', 'upload', 'install_egg_info',
162 'egg_info', 'easy_install', 'upload', 'install_egg_info',
160 }
163 }
161
164
162 if len(needs_setuptools.intersection(sys.argv)) > 0:
165 if len(needs_setuptools.intersection(sys.argv)) > 0:
163 import setuptools
166 import setuptools
164
167
165 # This dict is used for passing extra arguments that are setuptools
168 # This dict is used for passing extra arguments that are setuptools
166 # specific to setup
169 # specific to setup
167 setuptools_extra_args = {}
170 setuptools_extra_args = {}
168
171
169 # setuptools requirements
172 # setuptools requirements
170
173
171 extras_require = dict(
174 extras_require = dict(
172 parallel = ['ipyparallel'],
175 parallel = ['ipyparallel'],
173 qtconsole = ['qtconsole'],
176 qtconsole = ['qtconsole'],
174 doc = ['Sphinx>=1.3'],
177 doc = ['Sphinx>=1.3'],
175 test = ['nose>=0.10.1', 'requests', 'testpath', 'pygments', 'nbformat', 'ipykernel'],
178 test = ['nose>=0.10.1', 'requests', 'testpath', 'pygments', 'nbformat', 'ipykernel'],
176 terminal = [],
179 terminal = [],
177 kernel = ['ipykernel'],
180 kernel = ['ipykernel'],
178 nbformat = ['nbformat'],
181 nbformat = ['nbformat'],
179 notebook = ['notebook', 'ipywidgets'],
182 notebook = ['notebook', 'ipywidgets'],
180 nbconvert = ['nbconvert'],
183 nbconvert = ['nbconvert'],
181 )
184 )
182
185
183 install_requires = [
186 install_requires = [
184 'setuptools>=18.5',
187 'setuptools>=18.5',
185 'jedi>=0.10',
188 'jedi>=0.10',
186 'decorator',
189 'decorator',
187 'pickleshare',
190 'pickleshare',
188 'simplegeneric>0.8',
191 'simplegeneric>0.8',
189 'traitlets>=4.2',
192 'traitlets>=4.2',
190 'prompt_toolkit>=1.0.4,<2.0.0',
193 'prompt_toolkit>=1.0.4,<2.0.0',
191 'pygments',
194 'pygments',
192 ]
195 ]
193
196
194 # Platform-specific dependencies:
197 # Platform-specific dependencies:
195 # This is the correct way to specify these,
198 # This is the correct way to specify these,
196 # but requires pip >= 6. pip < 6 ignores these.
199 # but requires pip >= 6. pip < 6 ignores these.
197
200
198 extras_require.update({
201 extras_require.update({
199 'test:python_version >= "3.4"': ['numpy'],
202 'test:python_version >= "3.4"': ['numpy'],
200 ':python_version == "3.3"': ['pathlib2'],
203 ':python_version == "3.3"': ['pathlib2'],
201 ':python_version <= "3.4"': ['typing'],
204 ':python_version <= "3.4"': ['typing'],
202 ':sys_platform != "win32"': ['pexpect'],
205 ':sys_platform != "win32"': ['pexpect'],
203 ':sys_platform == "darwin"': ['appnope'],
206 ':sys_platform == "darwin"': ['appnope'],
204 ':sys_platform == "win32"': ['colorama'],
207 ':sys_platform == "win32"': ['colorama'],
205 ':sys_platform == "win32" and python_version < "3.6"': ['win_unicode_console>=0.5'],
208 ':sys_platform == "win32" and python_version < "3.6"': ['win_unicode_console>=0.5'],
206 })
209 })
207 # FIXME: re-specify above platform dependencies for pip < 6
210 # FIXME: re-specify above platform dependencies for pip < 6
208 # These would result in non-portable bdists.
211 # These would result in non-portable bdists.
209 if not any(arg.startswith('bdist') for arg in sys.argv):
212 if not any(arg.startswith('bdist') for arg in sys.argv):
210 if sys.platform == 'darwin':
213 if sys.platform == 'darwin':
211 install_requires.extend(['appnope'])
214 install_requires.extend(['appnope'])
212
215
213 if not sys.platform.startswith('win'):
216 if not sys.platform.startswith('win'):
214 install_requires.append('pexpect')
217 install_requires.append('pexpect')
215
218
216 # workaround pypa/setuptools#147, where setuptools misspells
219 # workaround pypa/setuptools#147, where setuptools misspells
217 # platform_python_implementation as python_implementation
220 # platform_python_implementation as python_implementation
218 if 'setuptools' in sys.modules:
221 if 'setuptools' in sys.modules:
219 for key in list(extras_require):
222 for key in list(extras_require):
220 if 'platform_python_implementation' in key:
223 if 'platform_python_implementation' in key:
221 new_key = key.replace('platform_python_implementation', 'python_implementation')
224 new_key = key.replace('platform_python_implementation', 'python_implementation')
222 extras_require[new_key] = extras_require.pop(key)
225 extras_require[new_key] = extras_require.pop(key)
223
226
224 everything = set()
227 everything = set()
225 for key, deps in extras_require.items():
228 for key, deps in extras_require.items():
226 if ':' not in key:
229 if ':' not in key:
227 everything.update(deps)
230 everything.update(deps)
228 extras_require['all'] = everything
231 extras_require['all'] = everything
229
232
230 if 'setuptools' in sys.modules:
233 if 'setuptools' in sys.modules:
231 setuptools_extra_args['python_requires'] = '>=3.3'
234 setuptools_extra_args['python_requires'] = '>=3.3'
232 setuptools_extra_args['zip_safe'] = False
235 setuptools_extra_args['zip_safe'] = False
233 setuptools_extra_args['entry_points'] = {
236 setuptools_extra_args['entry_points'] = {
234 'console_scripts': find_entry_points(),
237 'console_scripts': find_entry_points(),
235 'pygments.lexers': [
238 'pygments.lexers': [
236 'ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer',
239 'ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer',
237 'ipython = IPython.lib.lexers:IPythonLexer',
240 'ipython = IPython.lib.lexers:IPythonLexer',
238 'ipython3 = IPython.lib.lexers:IPython3Lexer',
241 'ipython3 = IPython.lib.lexers:IPython3Lexer',
239 ],
242 ],
240 }
243 }
241 setup_args['extras_require'] = extras_require
244 setup_args['extras_require'] = extras_require
242 setup_args['install_requires'] = install_requires
245 setup_args['install_requires'] = install_requires
243
246
244 else:
247 else:
245 # scripts has to be a non-empty list, or install_scripts isn't called
248 # scripts has to be a non-empty list, or install_scripts isn't called
246 setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()]
249 setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()]
247
250
248 setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt
251 setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt
249
252
250 #---------------------------------------------------------------------------
253 #---------------------------------------------------------------------------
251 # Do the actual setup now
254 # Do the actual setup now
252 #---------------------------------------------------------------------------
255 #---------------------------------------------------------------------------
253
256
254 setup_args.update(setuptools_extra_args)
257 setup_args.update(setuptools_extra_args)
255
258
256
259
257
260
258 def main():
261 def main():
259 setup(**setup_args)
262 setup(**setup_args)
260
263
261 if __name__ == '__main__':
264 if __name__ == '__main__':
262 main()
265 main()
General Comments 0
You need to be logged in to leave comments. Login now