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