##// END OF EJS Templates
s/COPYING.txt/COPYING.rst
Jonathan Frederic -
Show More
@@ -1,38 +1,38 b''
1 1 include README.rst
2 include COPYING.txt
2 include COPYING.rst
3 3 include setupbase.py
4 4 include setupegg.py
5 5
6 6 graft setupext
7 7
8 8 graft scripts
9 9
10 10 # Load main dir but exclude things we don't want in the distro
11 11 graft IPython
12 12 prune IPython/html/static/mathjax
13 13
14 14 # Include some specific files and data resources we need
15 15 include IPython/.git_commit_info.ini
16 16 include IPython/qt/console/resources/icon/IPythonConsole.svg
17 17
18 18 # Documentation
19 19 graft docs
20 20 exclude docs/\#*
21 21 exclude docs/man/*.1.gz
22 22
23 23 # Examples
24 24 graft examples
25 25
26 26 # docs subdirs we want to skip
27 27 prune docs/build
28 28 prune docs/gh-pages
29 29 prune docs/dist
30 30
31 31 # Patterns to exclude from any directory
32 32 global-exclude *~
33 33 global-exclude *.flc
34 34 global-exclude *.pyc
35 35 global-exclude *.pyo
36 36 global-exclude .dircopy.log
37 37 global-exclude .git
38 38 global-exclude .ipynb_checkpoints
@@ -1,343 +1,343 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 # The full license is in the file COPYING.txt, 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 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[:2] < (2,7):
30 30 error = "ERROR: IPython requires Python Version 2.7 or above."
31 31 print(error, file=sys.stderr)
32 32 sys.exit(1)
33 33
34 34 PY3 = (sys.version_info[0] >= 3)
35 35
36 36 # At least we're on the python version we need, move on.
37 37
38 38 #-------------------------------------------------------------------------------
39 39 # Imports
40 40 #-------------------------------------------------------------------------------
41 41
42 42 # Stdlib imports
43 43 import os
44 44 import shutil
45 45
46 46 from glob import glob
47 47
48 48 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
49 49 # update it when the contents of directories change.
50 50 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
51 51
52 52 from distutils.core import setup
53 53
54 54 # Our own imports
55 55 from setupbase import target_update
56 56
57 57 from setupbase import (
58 58 setup_args,
59 59 find_packages,
60 60 find_package_data,
61 61 check_package_data_first,
62 62 find_entry_points,
63 63 build_scripts_entrypt,
64 64 find_data_files,
65 65 check_for_dependencies,
66 66 git_prebuild,
67 67 check_submodule_status,
68 68 update_submodules,
69 69 require_submodules,
70 70 UpdateSubmodules,
71 71 get_bdist_wheel,
72 72 CompileCSS,
73 73 JavascriptVersion,
74 74 install_symlinked,
75 75 install_lib_symlink,
76 76 install_scripts_for_symlink,
77 77 unsymlink,
78 78 )
79 79 from setupext import setupext
80 80
81 81 isfile = os.path.isfile
82 82 pjoin = os.path.join
83 83
84 84 #-----------------------------------------------------------------------------
85 85 # Function definitions
86 86 #-----------------------------------------------------------------------------
87 87
88 88 def cleanup():
89 89 """Clean up the junk left around by the build process"""
90 90 if "develop" not in sys.argv and "egg_info" not in sys.argv:
91 91 try:
92 92 shutil.rmtree('ipython.egg-info')
93 93 except:
94 94 try:
95 95 os.unlink('ipython.egg-info')
96 96 except:
97 97 pass
98 98
99 99 #-------------------------------------------------------------------------------
100 100 # Handle OS specific things
101 101 #-------------------------------------------------------------------------------
102 102
103 103 if os.name in ('nt','dos'):
104 104 os_name = 'windows'
105 105 else:
106 106 os_name = os.name
107 107
108 108 # Under Windows, 'sdist' has not been supported. Now that the docs build with
109 109 # Sphinx it might work, but let's not turn it on until someone confirms that it
110 110 # actually works.
111 111 if os_name == 'windows' and 'sdist' in sys.argv:
112 112 print('The sdist command is not available under Windows. Exiting.')
113 113 sys.exit(1)
114 114
115 115 #-------------------------------------------------------------------------------
116 116 # Make sure we aren't trying to run without submodules
117 117 #-------------------------------------------------------------------------------
118 118 here = os.path.abspath(os.path.dirname(__file__))
119 119
120 120 def require_clean_submodules():
121 121 """Check on git submodules before distutils can do anything
122 122
123 123 Since distutils cannot be trusted to update the tree
124 124 after everything has been set in motion,
125 125 this is not a distutils command.
126 126 """
127 127 # PACKAGERS: Add a return here to skip checks for git submodules
128 128
129 129 # don't do anything if nothing is actually supposed to happen
130 130 for do_nothing in ('-h', '--help', '--help-commands', 'clean', 'submodule'):
131 131 if do_nothing in sys.argv:
132 132 return
133 133
134 134 status = check_submodule_status(here)
135 135
136 136 if status == "missing":
137 137 print("checking out submodules for the first time")
138 138 update_submodules(here)
139 139 elif status == "unclean":
140 140 print('\n'.join([
141 141 "Cannot build / install IPython with unclean submodules",
142 142 "Please update submodules with",
143 143 " python setup.py submodule",
144 144 "or",
145 145 " git submodule update",
146 146 "or commit any submodule changes you have made."
147 147 ]))
148 148 sys.exit(1)
149 149
150 150 require_clean_submodules()
151 151
152 152 #-------------------------------------------------------------------------------
153 153 # Things related to the IPython documentation
154 154 #-------------------------------------------------------------------------------
155 155
156 156 # update the manuals when building a source dist
157 157 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
158 158
159 159 # List of things to be updated. Each entry is a triplet of args for
160 160 # target_update()
161 161 to_update = [
162 162 # FIXME - Disabled for now: we need to redo an automatic way
163 163 # of generating the magic info inside the rst.
164 164 #('docs/magic.tex',
165 165 #['IPython/Magic.py'],
166 166 #"cd doc && ./update_magic.sh" ),
167 167
168 168 ('docs/man/ipcluster.1.gz',
169 169 ['docs/man/ipcluster.1'],
170 170 'cd docs/man && gzip -9c ipcluster.1 > ipcluster.1.gz'),
171 171
172 172 ('docs/man/ipcontroller.1.gz',
173 173 ['docs/man/ipcontroller.1'],
174 174 'cd docs/man && gzip -9c ipcontroller.1 > ipcontroller.1.gz'),
175 175
176 176 ('docs/man/ipengine.1.gz',
177 177 ['docs/man/ipengine.1'],
178 178 'cd docs/man && gzip -9c ipengine.1 > ipengine.1.gz'),
179 179
180 180 ('docs/man/ipython.1.gz',
181 181 ['docs/man/ipython.1'],
182 182 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
183 183
184 184 ]
185 185
186 186
187 187 [ target_update(*t) for t in to_update ]
188 188
189 189 #---------------------------------------------------------------------------
190 190 # Find all the packages, package data, and data_files
191 191 #---------------------------------------------------------------------------
192 192
193 193 packages = find_packages()
194 194 package_data = find_package_data()
195 195
196 196 data_files = find_data_files()
197 197
198 198 setup_args['packages'] = packages
199 199 setup_args['package_data'] = package_data
200 200 setup_args['data_files'] = data_files
201 201
202 202 #---------------------------------------------------------------------------
203 203 # custom distutils commands
204 204 #---------------------------------------------------------------------------
205 205 # imports here, so they are after setuptools import if there was one
206 206 from distutils.command.sdist import sdist
207 207 from distutils.command.upload import upload
208 208
209 209 class UploadWindowsInstallers(upload):
210 210
211 211 description = "Upload Windows installers to PyPI (only used from tools/release_windows.py)"
212 212 user_options = upload.user_options + [
213 213 ('files=', 'f', 'exe file (or glob) to upload')
214 214 ]
215 215 def initialize_options(self):
216 216 upload.initialize_options(self)
217 217 meta = self.distribution.metadata
218 218 base = '{name}-{version}'.format(
219 219 name=meta.get_name(),
220 220 version=meta.get_version()
221 221 )
222 222 self.files = os.path.join('dist', '%s.*.exe' % base)
223 223
224 224 def run(self):
225 225 for dist_file in glob(self.files):
226 226 self.upload_file('bdist_wininst', 'any', dist_file)
227 227
228 228 setup_args['cmdclass'] = {
229 229 'build_py': check_package_data_first(git_prebuild('IPython')),
230 230 'sdist' : git_prebuild('IPython', sdist),
231 231 'upload_wininst' : UploadWindowsInstallers,
232 232 'submodule' : UpdateSubmodules,
233 233 'css' : CompileCSS,
234 234 'symlink': install_symlinked,
235 235 'install_lib_symlink': install_lib_symlink,
236 236 'install_scripts_sym': install_scripts_for_symlink,
237 237 'unsymlink': unsymlink,
238 238 'jsversion' : JavascriptVersion,
239 239 }
240 240
241 241 #---------------------------------------------------------------------------
242 242 # Handle scripts, dependencies, and setuptools specific things
243 243 #---------------------------------------------------------------------------
244 244
245 245 # For some commands, use setuptools. Note that we do NOT list install here!
246 246 # If you want a setuptools-enhanced install, just run 'setupegg.py install'
247 247 needs_setuptools = set(('develop', 'release', 'bdist_egg', 'bdist_rpm',
248 248 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel',
249 249 'egg_info', 'easy_install', 'upload', 'install_egg_info',
250 250 ))
251 251 if sys.platform == 'win32':
252 252 # Depend on setuptools for install on *Windows only*
253 253 # If we get script-installation working without setuptools,
254 254 # then we can back off, but until then use it.
255 255 # See Issue #369 on GitHub for more
256 256 needs_setuptools.add('install')
257 257
258 258 if len(needs_setuptools.intersection(sys.argv)) > 0:
259 259 import setuptools
260 260
261 261 # This dict is used for passing extra arguments that are setuptools
262 262 # specific to setup
263 263 setuptools_extra_args = {}
264 264
265 265 # setuptools requirements
266 266
267 267 extras_require = dict(
268 268 parallel = ['pyzmq>=2.1.11'],
269 269 qtconsole = ['pyzmq>=2.1.11', 'pygments'],
270 270 zmq = ['pyzmq>=2.1.11'],
271 271 doc = ['Sphinx>=1.1', 'numpydoc'],
272 272 test = ['nose>=0.10.1'],
273 273 notebook = ['tornado>=3.1', 'pyzmq>=2.1.11', 'jinja2'],
274 274 nbconvert = ['pygments', 'jinja2', 'Sphinx>=0.3']
275 275 )
276 276 if sys.version_info < (3, 3):
277 277 extras_require['test'].append('mock')
278 278
279 279 everything = set()
280 280 for deps in extras_require.values():
281 281 everything.update(deps)
282 282 extras_require['all'] = everything
283 283
284 284 install_requires = []
285 285 if sys.platform == 'darwin':
286 286 if any(arg.startswith('bdist') for arg in sys.argv) or not setupext.check_for_readline():
287 287 install_requires.append('gnureadline')
288 288 elif sys.platform.startswith('win'):
289 289 # Pyreadline has unicode and Python 3 fixes in 2.0
290 290 install_requires.append('pyreadline>=2.0')
291 291
292 292 if 'setuptools' in sys.modules:
293 293 # setup.py develop should check for submodules
294 294 from setuptools.command.develop import develop
295 295 setup_args['cmdclass']['develop'] = require_submodules(develop)
296 296 setup_args['cmdclass']['bdist_wheel'] = get_bdist_wheel()
297 297
298 298 setuptools_extra_args['zip_safe'] = False
299 299 setuptools_extra_args['entry_points'] = {'console_scripts':find_entry_points()}
300 300 setup_args['extras_require'] = extras_require
301 301 requires = setup_args['install_requires'] = install_requires
302 302
303 303 # Script to be run by the windows binary installer after the default setup
304 304 # routine, to add shortcuts and similar windows-only things. Windows
305 305 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
306 306 # doesn't find them.
307 307 if 'bdist_wininst' in sys.argv:
308 308 if len(sys.argv) > 2 and \
309 309 ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
310 310 print >> sys.stderr, "ERROR: bdist_wininst must be run alone. Exiting."
311 311 sys.exit(1)
312 312 setup_args['data_files'].append(
313 313 ['Scripts', ('scripts/ipython.ico', 'scripts/ipython_nb.ico')])
314 314 setup_args['scripts'] = [pjoin('scripts','ipython_win_post_install.py')]
315 315 setup_args['options'] = {"bdist_wininst":
316 316 {"install_script":
317 317 "ipython_win_post_install.py"}}
318 318
319 319 else:
320 320 # If we are installing without setuptools, call this function which will
321 321 # check for dependencies an inform the user what is needed. This is
322 322 # just to make life easy for users.
323 323 for install_cmd in ('install', 'symlink'):
324 324 if install_cmd in sys.argv:
325 325 check_for_dependencies()
326 326 break
327 327 # scripts has to be a non-empty list, or install_scripts isn't called
328 328 setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()]
329 329
330 330 setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt
331 331
332 332 #---------------------------------------------------------------------------
333 333 # Do the actual setup now
334 334 #---------------------------------------------------------------------------
335 335
336 336 setup_args.update(setuptools_extra_args)
337 337
338 338 def main():
339 339 setup(**setup_args)
340 340 cleanup()
341 341
342 342 if __name__ == '__main__':
343 343 main()
General Comments 0
You need to be logged in to leave comments. Login now