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