##// END OF EJS Templates
Install IPython using setup.py
Matthias Bussonnier -
Show More
@@ -1,46 +1,47 b''
1 1 build: false
2 2
3 3 environment:
4 4 matrix:
5 5 - PYTHON: "C:\\Python33"
6 6 PYTHON_VERSION: "3.3.x"
7 7 PYTHON_ARCH: "32"
8 8
9 9 - PYTHON: "C:\\Python34"
10 10 PYTHON_VERSION: "3.4.x"
11 11 PYTHON_ARCH: "32"
12 12
13 13 - PYTHON: "C:\\Python35"
14 14 PYTHON_VERSION: "3.5.x"
15 15 PYTHON_ARCH: "32"
16 16
17 17 - PYTHON: "C:\\Python36"
18 18 PYTHON_VERSION: "3.6.x"
19 19 PYTHON_ARCH: "32"
20 20
21 21 - PYTHON: "C:\\Python33-x64"
22 22 PYTHON_VERSION: "3.3.x"
23 23 PYTHON_ARCH: "64"
24 24
25 25 - PYTHON: "C:\\Python34-x64"
26 26 PYTHON_VERSION: "3.4.x"
27 27 PYTHON_ARCH: "64"
28 28
29 29 - PYTHON: "C:\\Python35-x64"
30 30 PYTHON_VERSION: "3.5.x"
31 31 PYTHON_ARCH: "64"
32 32
33 33 - PYTHON: "C:\\Python36-x64"
34 34 PYTHON_VERSION: "3.6.x"
35 35 PYTHON_ARCH: "64"
36 36
37 37 init:
38 38 - "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%"
39 39
40 40 install:
41 - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
41 42 - "%CMD_IN_ENV% pip install setuptools>=18.5 --upgrade"
42 - "%CMD_IN_ENV% pip install nose coverage"
43 - "%CMD_IN_ENV% pip install -r ipython\requires.txt"
43 - "%CMD_IN_ENV% pip install nose coverage ipython[test] --upgrade"
44 - "%CMD_IN_ENV% python setup.py install"
44 45 test_script:
45 - "%PYTHON%/Scripts/nosetests"
46 No newline at end of file
46 - "%PYTHON%/Scripts/iptest"
47
@@ -1,292 +1,294 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 if sys.version_info < (3,3):
30 30 error = """
31 31 IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.
32 32 When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
33 33 Beginning with IPython 6.0, Python 3.3 and above is required.
34 34
35 35 See IPython `README.rst` file for more information:
36 36
37 37 https://github.com/ipython/ipython/blob/master/README.rst
38 38
39 """
39 Python {} detected.
40
41 """.format(sys.version_info)
40 42
41 43 print(error, file=sys.stderr)
42 44 sys.exit(1)
43 45
44 46 # At least we're on the python version we need, move on.
45 47
46 48 #-------------------------------------------------------------------------------
47 49 # Imports
48 50 #-------------------------------------------------------------------------------
49 51
50 52 # Stdlib imports
51 53 import os
52 54
53 55 from glob import glob
54 56
55 57 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
56 58 # update it when the contents of directories change.
57 59 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
58 60
59 61 from distutils.core import setup
60 62
61 63 # Our own imports
62 64 from setupbase import target_update
63 65
64 66 from setupbase import (
65 67 setup_args,
66 68 find_packages,
67 69 find_package_data,
68 70 check_package_data_first,
69 71 find_entry_points,
70 72 build_scripts_entrypt,
71 73 find_data_files,
72 74 git_prebuild,
73 75 install_symlinked,
74 76 install_lib_symlink,
75 77 install_scripts_for_symlink,
76 78 unsymlink,
77 79 )
78 80
79 81 isfile = os.path.isfile
80 82 pjoin = os.path.join
81 83
82 84 #-------------------------------------------------------------------------------
83 85 # Handle OS specific things
84 86 #-------------------------------------------------------------------------------
85 87
86 88 if os.name in ('nt','dos'):
87 89 os_name = 'windows'
88 90 else:
89 91 os_name = os.name
90 92
91 93 # Under Windows, 'sdist' has not been supported. Now that the docs build with
92 94 # Sphinx it might work, but let's not turn it on until someone confirms that it
93 95 # actually works.
94 96 if os_name == 'windows' and 'sdist' in sys.argv:
95 97 print('The sdist command is not available under Windows. Exiting.')
96 98 sys.exit(1)
97 99
98 100
99 101 #-------------------------------------------------------------------------------
100 102 # Things related to the IPython documentation
101 103 #-------------------------------------------------------------------------------
102 104
103 105 # update the manuals when building a source dist
104 106 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
105 107
106 108 # List of things to be updated. Each entry is a triplet of args for
107 109 # target_update()
108 110 to_update = [
109 111 ('docs/man/ipython.1.gz',
110 112 ['docs/man/ipython.1'],
111 113 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
112 114 ]
113 115
114 116
115 117 [ target_update(*t) for t in to_update ]
116 118
117 119 #---------------------------------------------------------------------------
118 120 # Find all the packages, package data, and data_files
119 121 #---------------------------------------------------------------------------
120 122
121 123 packages = find_packages()
122 124 package_data = find_package_data()
123 125
124 126 data_files = find_data_files()
125 127
126 128 setup_args['packages'] = packages
127 129 setup_args['package_data'] = package_data
128 130 setup_args['data_files'] = data_files
129 131
130 132 #---------------------------------------------------------------------------
131 133 # custom distutils commands
132 134 #---------------------------------------------------------------------------
133 135 # imports here, so they are after setuptools import if there was one
134 136 from distutils.command.sdist import sdist
135 137 from distutils.command.upload import upload
136 138
137 139 class UploadWindowsInstallers(upload):
138 140
139 141 description = "Upload Windows installers to PyPI (only used from tools/release_windows.py)"
140 142 user_options = upload.user_options + [
141 143 ('files=', 'f', 'exe file (or glob) to upload')
142 144 ]
143 145 def initialize_options(self):
144 146 upload.initialize_options(self)
145 147 meta = self.distribution.metadata
146 148 base = '{name}-{version}'.format(
147 149 name=meta.get_name(),
148 150 version=meta.get_version()
149 151 )
150 152 self.files = os.path.join('dist', '%s.*.exe' % base)
151 153
152 154 def run(self):
153 155 for dist_file in glob(self.files):
154 156 self.upload_file('bdist_wininst', 'any', dist_file)
155 157
156 158 setup_args['cmdclass'] = {
157 159 'build_py': \
158 160 check_package_data_first(git_prebuild('IPython')),
159 161 'sdist' : git_prebuild('IPython', sdist),
160 162 'upload_wininst' : UploadWindowsInstallers,
161 163 'symlink': install_symlinked,
162 164 'install_lib_symlink': install_lib_symlink,
163 165 'install_scripts_sym': install_scripts_for_symlink,
164 166 'unsymlink': unsymlink,
165 167 }
166 168
167 169
168 170 #---------------------------------------------------------------------------
169 171 # Handle scripts, dependencies, and setuptools specific things
170 172 #---------------------------------------------------------------------------
171 173
172 174 # For some commands, use setuptools. Note that we do NOT list install here!
173 175 # If you want a setuptools-enhanced install, just run 'setupegg.py install'
174 176 needs_setuptools = set(('develop', 'release', 'bdist_egg', 'bdist_rpm',
175 177 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel',
176 178 'egg_info', 'easy_install', 'upload', 'install_egg_info',
177 179 ))
178 180
179 181 if len(needs_setuptools.intersection(sys.argv)) > 0:
180 182 import setuptools
181 183
182 184 # This dict is used for passing extra arguments that are setuptools
183 185 # specific to setup
184 186 setuptools_extra_args = {}
185 187
186 188 # setuptools requirements
187 189
188 190 extras_require = dict(
189 191 parallel = ['ipyparallel'],
190 192 qtconsole = ['qtconsole'],
191 193 doc = ['Sphinx>=1.3'],
192 194 test = ['nose>=0.10.1', 'requests', 'testpath', 'pygments', 'nbformat', 'ipykernel', 'numpy'],
193 195 terminal = [],
194 196 kernel = ['ipykernel'],
195 197 nbformat = ['nbformat'],
196 198 notebook = ['notebook', 'ipywidgets'],
197 199 nbconvert = ['nbconvert'],
198 200 )
199 201
200 202 install_requires = [
201 203 'setuptools>=18.5',
202 204 'decorator',
203 205 'pickleshare',
204 206 'simplegeneric>0.8',
205 207 'traitlets>=4.2',
206 208 'prompt_toolkit>=1.0.3,<2.0.0',
207 209 'pygments',
208 210 ]
209 211
210 212 # Platform-specific dependencies:
211 213 # This is the correct way to specify these,
212 214 # but requires pip >= 6. pip < 6 ignores these.
213 215
214 216 extras_require.update({
215 217 ':python_version == "3.3"': ['pathlib2'],
216 218 ':sys_platform != "win32"': ['pexpect'],
217 219 ':sys_platform == "darwin"': ['appnope'],
218 220 ':sys_platform == "win32"': ['colorama'],
219 221 ':sys_platform == "win32" and python_version < "3.6"': ['win_unicode_console>=0.5'],
220 222 })
221 223 # FIXME: re-specify above platform dependencies for pip < 6
222 224 # These would result in non-portable bdists.
223 225 if not any(arg.startswith('bdist') for arg in sys.argv):
224 226 if sys.platform == 'darwin':
225 227 install_requires.extend(['appnope'])
226 228
227 229 if not sys.platform.startswith('win'):
228 230 install_requires.append('pexpect')
229 231
230 232 # workaround pypa/setuptools#147, where setuptools misspells
231 233 # platform_python_implementation as python_implementation
232 234 if 'setuptools' in sys.modules:
233 235 for key in list(extras_require):
234 236 if 'platform_python_implementation' in key:
235 237 new_key = key.replace('platform_python_implementation', 'python_implementation')
236 238 extras_require[new_key] = extras_require.pop(key)
237 239
238 240 everything = set()
239 241 for key, deps in extras_require.items():
240 242 if ':' not in key:
241 243 everything.update(deps)
242 244 extras_require['all'] = everything
243 245
244 246 if 'setuptools' in sys.modules:
245 247 setuptools_extra_args['python_requires'] = '>=3.3'
246 248 setuptools_extra_args['zip_safe'] = False
247 249 setuptools_extra_args['entry_points'] = {
248 250 'console_scripts': find_entry_points(),
249 251 'pygments.lexers': [
250 252 'ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer',
251 253 'ipython = IPython.lib.lexers:IPythonLexer',
252 254 'ipython3 = IPython.lib.lexers:IPython3Lexer',
253 255 ],
254 256 }
255 257 setup_args['extras_require'] = extras_require
256 258 requires = setup_args['install_requires'] = install_requires
257 259
258 260 # Script to be run by the windows binary installer after the default setup
259 261 # routine, to add shortcuts and similar windows-only things. Windows
260 262 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
261 263 # doesn't find them.
262 264 if 'bdist_wininst' in sys.argv:
263 265 if len(sys.argv) > 2 and \
264 266 ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
265 267 print("ERROR: bdist_wininst must be run alone. Exiting.", file=sys.stderr)
266 268 sys.exit(1)
267 269 setup_args['data_files'].append(
268 270 ['Scripts', ('scripts/ipython.ico', 'scripts/ipython_nb.ico')])
269 271 setup_args['scripts'] = [pjoin('scripts','ipython_win_post_install.py')]
270 272 setup_args['options'] = {"bdist_wininst":
271 273 {"install_script":
272 274 "ipython_win_post_install.py"}}
273 275
274 276 else:
275 277 # scripts has to be a non-empty list, or install_scripts isn't called
276 278 setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()]
277 279
278 280 setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt
279 281
280 282 #---------------------------------------------------------------------------
281 283 # Do the actual setup now
282 284 #---------------------------------------------------------------------------
283 285
284 286 setup_args.update(setuptools_extra_args)
285 287
286 288
287 289
288 290 def main():
289 291 setup(**setup_args)
290 292
291 293 if __name__ == '__main__':
292 294 main()
General Comments 0
You need to be logged in to leave comments. Login now