##// END OF EJS Templates
don't build sphinx docs for sdist
MinRK -
Show More
@@ -1,35 +1,36 b''
1 include ipython.py
1 include ipython.py
2 include setup2.py
2 include setup2.py
3 include setup3.py
3 include setup3.py
4 include setupbase.py
4 include setupbase.py
5 include setupegg.py
5 include setupegg.py
6
6
7 graft setupext
7 graft setupext
8
8
9 graft scripts
9 graft scripts
10
10
11 # Load main dir but exclude things we don't want in the distro
11 # Load main dir but exclude things we don't want in the distro
12 graft IPython
12 graft IPython
13 prune IPython/deathrow
13 prune IPython/deathrow
14 prune IPython/frontend/html/notebook/static/mathjax
14 prune IPython/frontend/html/notebook/static/mathjax
15
15
16 # Include some specific files and data resources we need
16 # Include some specific files and data resources we need
17 include IPython/.git_commit_info.ini
17 include IPython/.git_commit_info.ini
18 include IPython/frontend/qt/console/resources/icon/IPythonConsole.svg
18 include IPython/frontend/qt/console/resources/icon/IPythonConsole.svg
19
19
20 # Documentation
20 # Documentation
21 graft docs
21 graft docs
22 exclude docs/\#*
22 exclude docs/\#*
23 exclude docs/man/*.1
23 exclude docs/man/*.1
24
24
25 # docs subdirs we want to skip
25 # docs subdirs we want to skip
26 prune docs/attic
26 prune docs/attic
27 prune docs/build
27 prune docs/build
28 prune docs/gh-pages
28 prune docs/gh-pages
29 prune docs/dist
29
30
30 # Patterns to exclude from any directory
31 # Patterns to exclude from any directory
31 global-exclude *~
32 global-exclude *~
32 global-exclude *.flc
33 global-exclude *.flc
33 global-exclude *.pyc
34 global-exclude *.pyc
34 global-exclude *.pyo
35 global-exclude *.pyo
35 global-exclude .dircopy.log
36 global-exclude .dircopy.log
@@ -1,287 +1,258 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.txt, distributed with this software.
17 # The full license is in the file COPYING.txt, 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 #~ if sys.version[0:3] < '2.6':
29 #~ if sys.version[0:3] < '2.6':
30 #~ error = """\
30 #~ error = """\
31 #~ ERROR: 'IPython requires Python Version 2.6 or above.'
31 #~ ERROR: 'IPython requires Python Version 2.6 or above.'
32 #~ Exiting."""
32 #~ Exiting."""
33 #~ print >> sys.stderr, error
33 #~ print >> sys.stderr, error
34 #~ sys.exit(1)
34 #~ sys.exit(1)
35
35
36 PY3 = (sys.version_info[0] >= 3)
36 PY3 = (sys.version_info[0] >= 3)
37
37
38 # At least we're on the python version we need, move on.
38 # At least we're on the python version we need, move on.
39
39
40 #-------------------------------------------------------------------------------
40 #-------------------------------------------------------------------------------
41 # Imports
41 # Imports
42 #-------------------------------------------------------------------------------
42 #-------------------------------------------------------------------------------
43
43
44 # Stdlib imports
44 # Stdlib imports
45 import os
45 import os
46 import shutil
46 import shutil
47
47
48 from glob import glob
48 from glob import glob
49
49
50 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
50 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
51 # update it when the contents of directories change.
51 # update it when the contents of directories change.
52 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
52 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
53
53
54 from distutils.core import setup
54 from distutils.core import setup
55
55
56 # On Python 3, we need distribute (new setuptools) to do the 2to3 conversion
56 # On Python 3, we need distribute (new setuptools) to do the 2to3 conversion
57 if PY3:
57 if PY3:
58 import setuptools
58 import setuptools
59
59
60 # Our own imports
60 # Our own imports
61 from setupbase import target_update
61 from setupbase import target_update
62
62
63 from setupbase import (
63 from setupbase import (
64 setup_args,
64 setup_args,
65 find_packages,
65 find_packages,
66 find_package_data,
66 find_package_data,
67 find_scripts,
67 find_scripts,
68 find_data_files,
68 find_data_files,
69 check_for_dependencies,
69 check_for_dependencies,
70 record_commit_info,
70 record_commit_info,
71 )
71 )
72 from setupext import setupext
72 from setupext import setupext
73
73
74 isfile = os.path.isfile
74 isfile = os.path.isfile
75 pjoin = os.path.join
75 pjoin = os.path.join
76
76
77 #-----------------------------------------------------------------------------
77 #-----------------------------------------------------------------------------
78 # Function definitions
78 # Function definitions
79 #-----------------------------------------------------------------------------
79 #-----------------------------------------------------------------------------
80
80
81 def cleanup():
81 def cleanup():
82 """Clean up the junk left around by the build process"""
82 """Clean up the junk left around by the build process"""
83 if "develop" not in sys.argv:
83 if "develop" not in sys.argv:
84 try:
84 try:
85 shutil.rmtree('ipython.egg-info')
85 shutil.rmtree('ipython.egg-info')
86 except:
86 except:
87 try:
87 try:
88 os.unlink('ipython.egg-info')
88 os.unlink('ipython.egg-info')
89 except:
89 except:
90 pass
90 pass
91
91
92 #-------------------------------------------------------------------------------
92 #-------------------------------------------------------------------------------
93 # Handle OS specific things
93 # Handle OS specific things
94 #-------------------------------------------------------------------------------
94 #-------------------------------------------------------------------------------
95
95
96 if os.name == 'posix':
96 if os.name == 'posix':
97 os_name = 'posix'
97 os_name = 'posix'
98 elif os.name in ['nt','dos']:
98 elif os.name in ['nt','dos']:
99 os_name = 'windows'
99 os_name = 'windows'
100 else:
100 else:
101 print('Unsupported operating system:',os.name)
101 print('Unsupported operating system:',os.name)
102 sys.exit(1)
102 sys.exit(1)
103
103
104 # Under Windows, 'sdist' has not been supported. Now that the docs build with
104 # Under Windows, 'sdist' has not been supported. Now that the docs build with
105 # Sphinx it might work, but let's not turn it on until someone confirms that it
105 # Sphinx it might work, but let's not turn it on until someone confirms that it
106 # actually works.
106 # actually works.
107 if os_name == 'windows' and 'sdist' in sys.argv:
107 if os_name == 'windows' and 'sdist' in sys.argv:
108 print('The sdist command is not available under Windows. Exiting.')
108 print('The sdist command is not available under Windows. Exiting.')
109 sys.exit(1)
109 sys.exit(1)
110
110
111 #-------------------------------------------------------------------------------
111 #-------------------------------------------------------------------------------
112 # Things related to the IPython documentation
112 # Things related to the IPython documentation
113 #-------------------------------------------------------------------------------
113 #-------------------------------------------------------------------------------
114
114
115 # update the manuals when building a source dist
115 # update the manuals when building a source dist
116 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
116 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
117 import textwrap
117 import textwrap
118
118
119 # List of things to be updated. Each entry is a triplet of args for
119 # List of things to be updated. Each entry is a triplet of args for
120 # target_update()
120 # target_update()
121 to_update = [
121 to_update = [
122 # FIXME - Disabled for now: we need to redo an automatic way
122 # FIXME - Disabled for now: we need to redo an automatic way
123 # of generating the magic info inside the rst.
123 # of generating the magic info inside the rst.
124 #('docs/magic.tex',
124 #('docs/magic.tex',
125 #['IPython/Magic.py'],
125 #['IPython/Magic.py'],
126 #"cd doc && ./update_magic.sh" ),
126 #"cd doc && ./update_magic.sh" ),
127
127
128 ('docs/man/ipcluster.1.gz',
128 ('docs/man/ipcluster.1.gz',
129 ['docs/man/ipcluster.1'],
129 ['docs/man/ipcluster.1'],
130 'cd docs/man && gzip -9c ipcluster.1 > ipcluster.1.gz'),
130 'cd docs/man && gzip -9c ipcluster.1 > ipcluster.1.gz'),
131
131
132 ('docs/man/ipcontroller.1.gz',
132 ('docs/man/ipcontroller.1.gz',
133 ['docs/man/ipcontroller.1'],
133 ['docs/man/ipcontroller.1'],
134 'cd docs/man && gzip -9c ipcontroller.1 > ipcontroller.1.gz'),
134 'cd docs/man && gzip -9c ipcontroller.1 > ipcontroller.1.gz'),
135
135
136 ('docs/man/ipengine.1.gz',
136 ('docs/man/ipengine.1.gz',
137 ['docs/man/ipengine.1'],
137 ['docs/man/ipengine.1'],
138 'cd docs/man && gzip -9c ipengine.1 > ipengine.1.gz'),
138 'cd docs/man && gzip -9c ipengine.1 > ipengine.1.gz'),
139
139
140 ('docs/man/iplogger.1.gz',
140 ('docs/man/iplogger.1.gz',
141 ['docs/man/iplogger.1'],
141 ['docs/man/iplogger.1'],
142 'cd docs/man && gzip -9c iplogger.1 > iplogger.1.gz'),
142 'cd docs/man && gzip -9c iplogger.1 > iplogger.1.gz'),
143
143
144 ('docs/man/ipython.1.gz',
144 ('docs/man/ipython.1.gz',
145 ['docs/man/ipython.1'],
145 ['docs/man/ipython.1'],
146 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
146 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
147
147
148 ('docs/man/irunner.1.gz',
148 ('docs/man/irunner.1.gz',
149 ['docs/man/irunner.1'],
149 ['docs/man/irunner.1'],
150 'cd docs/man && gzip -9c irunner.1 > irunner.1.gz'),
150 'cd docs/man && gzip -9c irunner.1 > irunner.1.gz'),
151
151
152 ('docs/man/pycolor.1.gz',
152 ('docs/man/pycolor.1.gz',
153 ['docs/man/pycolor.1'],
153 ['docs/man/pycolor.1'],
154 'cd docs/man && gzip -9c pycolor.1 > pycolor.1.gz'),
154 'cd docs/man && gzip -9c pycolor.1 > pycolor.1.gz'),
155 ]
155 ]
156
156
157 # Only build the docs if sphinx is present
158 try:
159 import sphinx
160 except ImportError:
161 pass
162 else:
163 # The Makefile calls the do_sphinx scripts to build html and pdf, so
164 # just one target is enough to cover all manual generation
165
166 # First, compute all the dependencies that can force us to rebuild the
167 # docs. Start with the main release file that contains metadata
168 docdeps = ['IPython/core/release.py']
169 # Inculde all the reST sources
170 pjoin = os.path.join
171 for dirpath,dirnames,filenames in os.walk('docs/source'):
172 if dirpath in ['_static','_templates']:
173 continue
174 docdeps += [ pjoin(dirpath,f) for f in filenames
175 if f.endswith('.txt') ]
176 # and the examples
177 for dirpath,dirnames,filenames in os.walk('docs/example'):
178 docdeps += [ pjoin(dirpath,f) for f in filenames
179 if not f.endswith('~') ]
180 # then, make them all dependencies for the main html docs
181 to_update.append(
182 ('docs/dist/index.html',
183 docdeps,
184 "cd docs && make dist")
185 )
186
157
187 [ target_update(*t) for t in to_update ]
158 [ target_update(*t) for t in to_update ]
188
159
189 #---------------------------------------------------------------------------
160 #---------------------------------------------------------------------------
190 # Find all the packages, package data, and data_files
161 # Find all the packages, package data, and data_files
191 #---------------------------------------------------------------------------
162 #---------------------------------------------------------------------------
192
163
193 packages = find_packages()
164 packages = find_packages()
194 package_data = find_package_data()
165 package_data = find_package_data()
195 data_files = find_data_files()
166 data_files = find_data_files()
196
167
197 setup_args['cmdclass'] = {'build_py': record_commit_info('IPython')}
168 setup_args['cmdclass'] = {'build_py': record_commit_info('IPython')}
198 setup_args['packages'] = packages
169 setup_args['packages'] = packages
199 setup_args['package_data'] = package_data
170 setup_args['package_data'] = package_data
200 setup_args['data_files'] = data_files
171 setup_args['data_files'] = data_files
201
172
202 #---------------------------------------------------------------------------
173 #---------------------------------------------------------------------------
203 # Handle scripts, dependencies, and setuptools specific things
174 # Handle scripts, dependencies, and setuptools specific things
204 #---------------------------------------------------------------------------
175 #---------------------------------------------------------------------------
205
176
206 # For some commands, use setuptools. Note that we do NOT list install here!
177 # For some commands, use setuptools. Note that we do NOT list install here!
207 # If you want a setuptools-enhanced install, just run 'setupegg.py install'
178 # If you want a setuptools-enhanced install, just run 'setupegg.py install'
208 needs_setuptools = set(('develop', 'release', 'bdist_egg', 'bdist_rpm',
179 needs_setuptools = set(('develop', 'release', 'bdist_egg', 'bdist_rpm',
209 'bdist', 'bdist_dumb', 'bdist_wininst', 'install_egg_info',
180 'bdist', 'bdist_dumb', 'bdist_wininst', 'install_egg_info',
210 'egg_info', 'easy_install', 'upload',
181 'egg_info', 'easy_install', 'upload',
211 ))
182 ))
212 if sys.platform == 'win32':
183 if sys.platform == 'win32':
213 # Depend on setuptools for install on *Windows only*
184 # Depend on setuptools for install on *Windows only*
214 # If we get script-installation working without setuptools,
185 # If we get script-installation working without setuptools,
215 # then we can back off, but until then use it.
186 # then we can back off, but until then use it.
216 # See Issue #369 on GitHub for more
187 # See Issue #369 on GitHub for more
217 needs_setuptools.add('install')
188 needs_setuptools.add('install')
218
189
219 if len(needs_setuptools.intersection(sys.argv)) > 0:
190 if len(needs_setuptools.intersection(sys.argv)) > 0:
220 import setuptools
191 import setuptools
221
192
222 # This dict is used for passing extra arguments that are setuptools
193 # This dict is used for passing extra arguments that are setuptools
223 # specific to setup
194 # specific to setup
224 setuptools_extra_args = {}
195 setuptools_extra_args = {}
225
196
226 if 'setuptools' in sys.modules:
197 if 'setuptools' in sys.modules:
227 setuptools_extra_args['zip_safe'] = False
198 setuptools_extra_args['zip_safe'] = False
228 setuptools_extra_args['entry_points'] = find_scripts(True)
199 setuptools_extra_args['entry_points'] = find_scripts(True)
229 setup_args['extras_require'] = dict(
200 setup_args['extras_require'] = dict(
230 parallel = 'pyzmq>=2.1.4',
201 parallel = 'pyzmq>=2.1.4',
231 zmq = 'pyzmq>=2.1.4',
202 zmq = 'pyzmq>=2.1.4',
232 doc = 'Sphinx>=0.3',
203 doc = 'Sphinx>=0.3',
233 test = 'nose>=0.10.1',
204 test = 'nose>=0.10.1',
234 notebook = 'tornado>=2.0'
205 notebook = 'tornado>=2.0'
235 )
206 )
236 requires = setup_args.setdefault('install_requires', [])
207 requires = setup_args.setdefault('install_requires', [])
237 setupext.display_status = False
208 setupext.display_status = False
238 if not setupext.check_for_readline():
209 if not setupext.check_for_readline():
239 if sys.platform == 'darwin':
210 if sys.platform == 'darwin':
240 requires.append('readline')
211 requires.append('readline')
241 elif sys.platform.startswith('win'):
212 elif sys.platform.startswith('win'):
242 # Pyreadline 64 bit windows issue solved in versions >=1.7.1
213 # Pyreadline 64 bit windows issue solved in versions >=1.7.1
243 # Also solves issues with some older versions of pyreadline that
214 # Also solves issues with some older versions of pyreadline that
244 # satisfy the unconstrained depdendency.
215 # satisfy the unconstrained depdendency.
245 requires.append('pyreadline>=1.7.1')
216 requires.append('pyreadline>=1.7.1')
246 else:
217 else:
247 pass
218 pass
248 # do we want to install readline here?
219 # do we want to install readline here?
249
220
250 # Script to be run by the windows binary installer after the default setup
221 # Script to be run by the windows binary installer after the default setup
251 # routine, to add shortcuts and similar windows-only things. Windows
222 # routine, to add shortcuts and similar windows-only things. Windows
252 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
223 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
253 # doesn't find them.
224 # doesn't find them.
254 if 'bdist_wininst' in sys.argv:
225 if 'bdist_wininst' in sys.argv:
255 if len(sys.argv) > 2 and \
226 if len(sys.argv) > 2 and \
256 ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
227 ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
257 print >> sys.stderr, "ERROR: bdist_wininst must be run alone. Exiting."
228 print >> sys.stderr, "ERROR: bdist_wininst must be run alone. Exiting."
258 sys.exit(1)
229 sys.exit(1)
259 setup_args['scripts'] = [pjoin('scripts','ipython_win_post_install.py')]
230 setup_args['scripts'] = [pjoin('scripts','ipython_win_post_install.py')]
260 setup_args['options'] = {"bdist_wininst":
231 setup_args['options'] = {"bdist_wininst":
261 {"install_script":
232 {"install_script":
262 "ipython_win_post_install.py"}}
233 "ipython_win_post_install.py"}}
263
234
264 if PY3:
235 if PY3:
265 setuptools_extra_args['use_2to3'] = True
236 setuptools_extra_args['use_2to3'] = True
266 from setuptools.command.build_py import build_py
237 from setuptools.command.build_py import build_py
267 setup_args['cmdclass'] = {'build_py': record_commit_info('IPython', build_cmd=build_py)}
238 setup_args['cmdclass'] = {'build_py': record_commit_info('IPython', build_cmd=build_py)}
268 setuptools_extra_args['entry_points'] = find_scripts(True, suffix='3')
239 setuptools_extra_args['entry_points'] = find_scripts(True, suffix='3')
269 else:
240 else:
270 # If we are running without setuptools, call this function which will
241 # If we are running without setuptools, call this function which will
271 # check for dependencies an inform the user what is needed. This is
242 # check for dependencies an inform the user what is needed. This is
272 # just to make life easy for users.
243 # just to make life easy for users.
273 check_for_dependencies()
244 check_for_dependencies()
274 setup_args['scripts'] = find_scripts(False)
245 setup_args['scripts'] = find_scripts(False)
275
246
276 #---------------------------------------------------------------------------
247 #---------------------------------------------------------------------------
277 # Do the actual setup now
248 # Do the actual setup now
278 #---------------------------------------------------------------------------
249 #---------------------------------------------------------------------------
279
250
280 setup_args.update(setuptools_extra_args)
251 setup_args.update(setuptools_extra_args)
281
252
282 def main():
253 def main():
283 setup(**setup_args)
254 setup(**setup_args)
284 cleanup()
255 cleanup()
285
256
286 if __name__ == '__main__':
257 if __name__ == '__main__':
287 main()
258 main()
General Comments 0
You need to be logged in to leave comments. Login now