Show More
@@ -1,243 +1,235 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 |
|
23 | |||
24 | import sys |
|
24 | import sys | |
25 |
|
25 | |||
26 | # This check is also made in IPython/__init__, don't forget to update both when |
|
26 | # This check is also made in IPython/__init__, don't forget to update both when | |
27 | # changing Python version requirements. |
|
27 | # changing Python version requirements. | |
28 | if sys.version[0:3] < '2.6': |
|
28 | if sys.version[0:3] < '2.6': | |
29 | error = """\ |
|
29 | error = """\ | |
30 | ERROR: 'IPython requires Python Version 2.6 or above.' |
|
30 | ERROR: 'IPython requires Python Version 2.6 or above.' | |
31 | Exiting.""" |
|
31 | Exiting.""" | |
32 | print >> sys.stderr, error |
|
32 | print >> sys.stderr, error | |
33 | sys.exit(1) |
|
33 | sys.exit(1) | |
34 |
|
34 | |||
35 | # At least we're on the python version we need, move on. |
|
35 | # At least we're on the python version we need, move on. | |
36 |
|
36 | |||
37 | #------------------------------------------------------------------------------- |
|
37 | #------------------------------------------------------------------------------- | |
38 | # Imports |
|
38 | # Imports | |
39 | #------------------------------------------------------------------------------- |
|
39 | #------------------------------------------------------------------------------- | |
40 |
|
40 | |||
41 | # Stdlib imports |
|
41 | # Stdlib imports | |
42 | import os |
|
42 | import os | |
43 | import shutil |
|
43 | import shutil | |
44 |
|
44 | |||
45 | from glob import glob |
|
45 | from glob import glob | |
46 |
|
46 | |||
47 | # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly |
|
47 | # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly | |
48 | # update it when the contents of directories change. |
|
48 | # update it when the contents of directories change. | |
49 | if os.path.exists('MANIFEST'): os.remove('MANIFEST') |
|
49 | if os.path.exists('MANIFEST'): os.remove('MANIFEST') | |
50 |
|
50 | |||
51 | from distutils.core import setup |
|
51 | from distutils.core import setup | |
52 |
|
52 | |||
53 | # Our own imports |
|
53 | # Our own imports | |
54 | from IPython.utils.path import target_update |
|
54 | from IPython.utils.path import target_update | |
55 |
|
55 | |||
56 | from setupbase import ( |
|
56 | from setupbase import ( | |
57 | setup_args, |
|
57 | setup_args, | |
58 | find_packages, |
|
58 | find_packages, | |
59 | find_package_data, |
|
59 | find_package_data, | |
60 | find_scripts, |
|
60 | find_scripts, | |
61 | find_data_files, |
|
61 | find_data_files, | |
62 | check_for_dependencies, |
|
62 | check_for_dependencies, | |
63 | record_commit_info, |
|
63 | record_commit_info, | |
|
64 | bdist_wininst_options, | |||
64 | ) |
|
65 | ) | |
65 | from setupext import setupext |
|
66 | from setupext import setupext | |
66 |
|
67 | |||
67 | isfile = os.path.isfile |
|
68 | isfile = os.path.isfile | |
68 | pjoin = os.path.join |
|
69 | pjoin = os.path.join | |
69 |
|
70 | |||
70 | #----------------------------------------------------------------------------- |
|
71 | #----------------------------------------------------------------------------- | |
71 | # Function definitions |
|
72 | # Function definitions | |
72 | #----------------------------------------------------------------------------- |
|
73 | #----------------------------------------------------------------------------- | |
73 |
|
74 | |||
74 | def cleanup(): |
|
75 | def cleanup(): | |
75 | """Clean up the junk left around by the build process""" |
|
76 | """Clean up the junk left around by the build process""" | |
76 | if "develop" not in sys.argv: |
|
77 | if "develop" not in sys.argv: | |
77 | try: |
|
78 | try: | |
78 | shutil.rmtree('ipython.egg-info') |
|
79 | shutil.rmtree('ipython.egg-info') | |
79 | except: |
|
80 | except: | |
80 | try: |
|
81 | try: | |
81 | os.unlink('ipython.egg-info') |
|
82 | os.unlink('ipython.egg-info') | |
82 | except: |
|
83 | except: | |
83 | pass |
|
84 | pass | |
84 |
|
85 | |||
85 | #------------------------------------------------------------------------------- |
|
86 | #------------------------------------------------------------------------------- | |
86 | # Handle OS specific things |
|
87 | # Handle OS specific things | |
87 | #------------------------------------------------------------------------------- |
|
88 | #------------------------------------------------------------------------------- | |
88 |
|
89 | |||
89 | if os.name == 'posix': |
|
90 | if os.name == 'posix': | |
90 | os_name = 'posix' |
|
91 | os_name = 'posix' | |
91 | elif os.name in ['nt','dos']: |
|
92 | elif os.name in ['nt','dos']: | |
92 | os_name = 'windows' |
|
93 | os_name = 'windows' | |
93 | else: |
|
94 | else: | |
94 | print 'Unsupported operating system:',os.name |
|
95 | print 'Unsupported operating system:',os.name | |
95 | sys.exit(1) |
|
96 | sys.exit(1) | |
96 |
|
97 | |||
97 | # Under Windows, 'sdist' has not been supported. Now that the docs build with |
|
98 | # Under Windows, 'sdist' has not been supported. Now that the docs build with | |
98 | # Sphinx it might work, but let's not turn it on until someone confirms that it |
|
99 | # Sphinx it might work, but let's not turn it on until someone confirms that it | |
99 | # actually works. |
|
100 | # actually works. | |
100 | if os_name == 'windows' and 'sdist' in sys.argv: |
|
101 | if os_name == 'windows' and 'sdist' in sys.argv: | |
101 | print 'The sdist command is not available under Windows. Exiting.' |
|
102 | print 'The sdist command is not available under Windows. Exiting.' | |
102 | sys.exit(1) |
|
103 | sys.exit(1) | |
103 |
|
104 | |||
104 | #------------------------------------------------------------------------------- |
|
105 | #------------------------------------------------------------------------------- | |
105 | # Things related to the IPython documentation |
|
106 | # Things related to the IPython documentation | |
106 | #------------------------------------------------------------------------------- |
|
107 | #------------------------------------------------------------------------------- | |
107 |
|
108 | |||
108 | # update the manuals when building a source dist |
|
109 | # update the manuals when building a source dist | |
109 | if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): |
|
110 | if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): | |
110 | import textwrap |
|
111 | import textwrap | |
111 |
|
112 | |||
112 | # List of things to be updated. Each entry is a triplet of args for |
|
113 | # List of things to be updated. Each entry is a triplet of args for | |
113 | # target_update() |
|
114 | # target_update() | |
114 | to_update = [ |
|
115 | to_update = [ | |
115 | # FIXME - Disabled for now: we need to redo an automatic way |
|
116 | # FIXME - Disabled for now: we need to redo an automatic way | |
116 | # of generating the magic info inside the rst. |
|
117 | # of generating the magic info inside the rst. | |
117 | #('docs/magic.tex', |
|
118 | #('docs/magic.tex', | |
118 | #['IPython/Magic.py'], |
|
119 | #['IPython/Magic.py'], | |
119 | #"cd doc && ./update_magic.sh" ), |
|
120 | #"cd doc && ./update_magic.sh" ), | |
120 |
|
121 | |||
121 | ('docs/man/ipcluster.1.gz', |
|
122 | ('docs/man/ipcluster.1.gz', | |
122 | ['docs/man/ipcluster.1'], |
|
123 | ['docs/man/ipcluster.1'], | |
123 | 'cd docs/man && gzip -9c ipcluster.1 > ipcluster.1.gz'), |
|
124 | 'cd docs/man && gzip -9c ipcluster.1 > ipcluster.1.gz'), | |
124 |
|
125 | |||
125 | ('docs/man/ipcontroller.1.gz', |
|
126 | ('docs/man/ipcontroller.1.gz', | |
126 | ['docs/man/ipcontroller.1'], |
|
127 | ['docs/man/ipcontroller.1'], | |
127 | 'cd docs/man && gzip -9c ipcontroller.1 > ipcontroller.1.gz'), |
|
128 | 'cd docs/man && gzip -9c ipcontroller.1 > ipcontroller.1.gz'), | |
128 |
|
129 | |||
129 | ('docs/man/ipengine.1.gz', |
|
130 | ('docs/man/ipengine.1.gz', | |
130 | ['docs/man/ipengine.1'], |
|
131 | ['docs/man/ipengine.1'], | |
131 | 'cd docs/man && gzip -9c ipengine.1 > ipengine.1.gz'), |
|
132 | 'cd docs/man && gzip -9c ipengine.1 > ipengine.1.gz'), | |
132 |
|
133 | |||
133 | ('docs/man/iplogger.1.gz', |
|
134 | ('docs/man/iplogger.1.gz', | |
134 | ['docs/man/iplogger.1'], |
|
135 | ['docs/man/iplogger.1'], | |
135 | 'cd docs/man && gzip -9c iplogger.1 > iplogger.1.gz'), |
|
136 | 'cd docs/man && gzip -9c iplogger.1 > iplogger.1.gz'), | |
136 |
|
137 | |||
137 | ('docs/man/ipython.1.gz', |
|
138 | ('docs/man/ipython.1.gz', | |
138 | ['docs/man/ipython.1'], |
|
139 | ['docs/man/ipython.1'], | |
139 | 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'), |
|
140 | 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'), | |
140 |
|
141 | |||
141 | ('docs/man/irunner.1.gz', |
|
142 | ('docs/man/irunner.1.gz', | |
142 | ['docs/man/irunner.1'], |
|
143 | ['docs/man/irunner.1'], | |
143 | 'cd docs/man && gzip -9c irunner.1 > irunner.1.gz'), |
|
144 | 'cd docs/man && gzip -9c irunner.1 > irunner.1.gz'), | |
144 |
|
145 | |||
145 | ('docs/man/pycolor.1.gz', |
|
146 | ('docs/man/pycolor.1.gz', | |
146 | ['docs/man/pycolor.1'], |
|
147 | ['docs/man/pycolor.1'], | |
147 | 'cd docs/man && gzip -9c pycolor.1 > pycolor.1.gz'), |
|
148 | 'cd docs/man && gzip -9c pycolor.1 > pycolor.1.gz'), | |
148 | ] |
|
149 | ] | |
149 |
|
150 | |||
150 |
|
151 | |||
151 | [ target_update(*t) for t in to_update ] |
|
152 | [ target_update(*t) for t in to_update ] | |
152 |
|
153 | |||
153 | #--------------------------------------------------------------------------- |
|
154 | #--------------------------------------------------------------------------- | |
154 | # Find all the packages, package data, and data_files |
|
155 | # Find all the packages, package data, and data_files | |
155 | #--------------------------------------------------------------------------- |
|
156 | #--------------------------------------------------------------------------- | |
156 |
|
157 | |||
157 | packages = find_packages() |
|
158 | packages = find_packages() | |
158 | package_data = find_package_data() |
|
159 | package_data = find_package_data() | |
159 | data_files = find_data_files() |
|
160 | data_files = find_data_files() | |
160 |
|
161 | |||
161 | #--------------------------------------------------------------------------- |
|
162 | #--------------------------------------------------------------------------- | |
162 | # Handle scripts, dependencies, and setuptools specific things |
|
163 | # Handle scripts, dependencies, and setuptools specific things | |
163 | #--------------------------------------------------------------------------- |
|
164 | #--------------------------------------------------------------------------- | |
164 |
|
165 | |||
165 | # For some commands, use setuptools. Note that we do NOT list install here! |
|
166 | # For some commands, use setuptools. Note that we do NOT list install here! | |
166 | # If you want a setuptools-enhanced install, just run 'setupegg.py install' |
|
167 | # If you want a setuptools-enhanced install, just run 'setupegg.py install' | |
167 | needs_setuptools = set(('develop', 'release', 'bdist_egg', 'bdist_rpm', |
|
168 | needs_setuptools = set(('develop', 'release', 'bdist_egg', 'bdist_rpm', | |
168 | 'bdist', 'bdist_dumb', 'bdist_wininst', 'install_egg_info', |
|
169 | 'bdist', 'bdist_dumb', 'bdist_wininst', 'install_egg_info', | |
169 | 'egg_info', 'easy_install', 'upload', |
|
170 | 'egg_info', 'easy_install', 'upload', | |
170 | )) |
|
171 | )) | |
171 | if sys.platform == 'win32': |
|
172 | if sys.platform == 'win32': | |
172 | # Depend on setuptools for install on *Windows only* |
|
173 | # Depend on setuptools for install on *Windows only* | |
173 | # If we get script-installation working without setuptools, |
|
174 | # If we get script-installation working without setuptools, | |
174 | # then we can back off, but until then use it. |
|
175 | # then we can back off, but until then use it. | |
175 | # See Issue #369 on GitHub for more |
|
176 | # See Issue #369 on GitHub for more | |
176 | needs_setuptools.add('install') |
|
177 | needs_setuptools.add('install') | |
177 |
|
178 | |||
178 | if len(needs_setuptools.intersection(sys.argv)) > 0: |
|
179 | if len(needs_setuptools.intersection(sys.argv)) > 0: | |
179 | import setuptools |
|
180 | import setuptools | |
180 |
|
181 | |||
181 | # This dict is used for passing extra arguments that are setuptools |
|
182 | # This dict is used for passing extra arguments that are setuptools | |
182 | # specific to setup |
|
183 | # specific to setup | |
183 | setuptools_extra_args = {} |
|
184 | setuptools_extra_args = {} | |
184 |
|
185 | |||
185 | if 'setuptools' in sys.modules: |
|
186 | if 'setuptools' in sys.modules: | |
186 | setuptools_extra_args['zip_safe'] = False |
|
187 | setuptools_extra_args['zip_safe'] = False | |
187 | setuptools_extra_args['entry_points'] = find_scripts(True) |
|
188 | setuptools_extra_args['entry_points'] = find_scripts(True) | |
188 | setup_args['extras_require'] = dict( |
|
189 | setup_args['extras_require'] = dict( | |
189 | parallel = 'pyzmq>=2.1.4', |
|
190 | parallel = 'pyzmq>=2.1.4', | |
190 | zmq = 'pyzmq>=2.1.4', |
|
191 | zmq = 'pyzmq>=2.1.4', | |
191 | doc = 'Sphinx>=0.3', |
|
192 | doc = 'Sphinx>=0.3', | |
192 | test = 'nose>=0.10.1', |
|
193 | test = 'nose>=0.10.1', | |
193 | notebook = 'tornado>=2.0' |
|
194 | notebook = 'tornado>=2.0' | |
194 | ) |
|
195 | ) | |
195 | requires = setup_args.setdefault('install_requires', []) |
|
196 | requires = setup_args.setdefault('install_requires', []) | |
196 | setupext.display_status = False |
|
197 | setupext.display_status = False | |
197 | if not setupext.check_for_readline(): |
|
198 | if not setupext.check_for_readline(): | |
198 | if sys.platform == 'darwin': |
|
199 | if sys.platform == 'darwin': | |
199 | requires.append('readline') |
|
200 | requires.append('readline') | |
200 |
elif sys.platform.startswith('win') and |
|
201 | elif sys.platform.startswith('win') and \ | |
201 | # only require pyreadline on 32b Windows, due to 64b bug in pyreadline: |
|
202 | not 'bdist_wininst' in sys.argv: | |
202 | # https://bugs.launchpad.net/pyreadline/+bug/787574 |
|
203 | # We must avoid listing pyreadline when *building* the binary windows | |
203 | requires.append('pyreadline') |
|
204 | # installers, because if we do so, then at runtime ipython will fail | |
|
205 | # to find a pyreadline that could have been installed without | |||
|
206 | # setuptools (such as the one from the binary pyreadline installer). | |||
|
207 | requires.append('pyreadline') | |||
204 | else: |
|
208 | else: | |
205 | pass |
|
209 | pass | |
206 | # do we want to install readline here? |
|
210 | setup_args.update(bdist_wininst_options()) | |
207 |
|
||||
208 | # Script to be run by the windows binary installer after the default setup |
|
|||
209 | # routine, to add shortcuts and similar windows-only things. Windows |
|
|||
210 | # post-install scripts MUST reside in the scripts/ dir, otherwise distutils |
|
|||
211 | # doesn't find them. |
|
|||
212 | if 'bdist_wininst' in sys.argv: |
|
|||
213 | if len(sys.argv) > 2 and \ |
|
|||
214 | ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): |
|
|||
215 | print >> sys.stderr, "ERROR: bdist_wininst must be run alone. Exiting." |
|
|||
216 | sys.exit(1) |
|
|||
217 | setup_args['scripts'] = [pjoin('scripts','ipython_win_post_install.py')] |
|
|||
218 | setup_args['options'] = {"bdist_wininst": |
|
|||
219 | {"install_script": |
|
|||
220 | "ipython_win_post_install.py"}} |
|
|||
221 | else: |
|
211 | else: | |
222 | # If we are running without setuptools, call this function which will |
|
212 | # If we are running without setuptools, call this function which will | |
223 | # check for dependencies an inform the user what is needed. This is |
|
213 | # check for dependencies an inform the user what is needed. This is | |
224 | # just to make life easy for users. |
|
214 | # just to make life easy for users. | |
225 | check_for_dependencies() |
|
215 | check_for_dependencies() | |
226 | setup_args['scripts'] = find_scripts(False) |
|
216 | setup_args['scripts'] = find_scripts(False) | |
227 |
|
217 | |||
228 | #--------------------------------------------------------------------------- |
|
218 | #--------------------------------------------------------------------------- | |
229 | # Do the actual setup now |
|
219 | # Do the actual setup now | |
230 | #--------------------------------------------------------------------------- |
|
220 | #--------------------------------------------------------------------------- | |
231 |
|
221 | |||
232 | setup_args['cmdclass'] = {'build_py': record_commit_info('IPython')} |
|
222 | setup_args['cmdclass'] = {'build_py': record_commit_info('IPython')} | |
233 | setup_args['packages'] = packages |
|
223 | setup_args['packages'] = packages | |
234 | setup_args['package_data'] = package_data |
|
224 | setup_args['package_data'] = package_data | |
235 | setup_args['data_files'] = data_files |
|
225 | setup_args['data_files'] = data_files | |
236 | setup_args.update(setuptools_extra_args) |
|
226 | setup_args.update(setuptools_extra_args) | |
237 |
|
227 | |||
|
228 | ||||
238 | def main(): |
|
229 | def main(): | |
239 | setup(**setup_args) |
|
230 | setup(**setup_args) | |
240 | cleanup() |
|
231 | cleanup() | |
241 |
|
232 | |||
|
233 | ||||
242 | if __name__ == '__main__': |
|
234 | if __name__ == '__main__': | |
243 | main() |
|
235 | main() |
@@ -1,36 +1,26 b'' | |||||
1 | import os.path |
|
1 | import os.path | |
2 | import sys |
|
2 | import sys | |
3 | from setuptools import setup |
|
3 | from setuptools import setup | |
4 | from setuptools.command.build_py import build_py |
|
4 | from setuptools.command.build_py import build_py | |
5 |
|
5 | |||
6 | from setupbase import (setup_args, |
|
6 | from setupbase import (setup_args, | |
7 | find_scripts, |
|
7 | find_scripts, | |
8 | find_packages, |
|
8 | find_packages, | |
9 | find_package_data, |
|
9 | find_package_data, | |
10 | record_commit_info, |
|
10 | record_commit_info, | |
|
11 | bdist_wininst_options, | |||
11 | ) |
|
12 | ) | |
12 |
|
13 | |||
13 | setup_args['entry_points'] = find_scripts(True, suffix='3') |
|
14 | setup_args['entry_points'] = find_scripts(True, suffix='3') | |
14 | setup_args['packages'] = find_packages() |
|
15 | setup_args['packages'] = find_packages() | |
15 | setup_args['package_data'] = find_package_data() |
|
16 | setup_args['package_data'] = find_package_data() | |
16 |
setup_args['cmdclass'] = {'build_py': |
|
17 | setup_args['cmdclass'] = {'build_py': | |
|
18 | record_commit_info('IPython', build_cmd=build_py)} | |||
17 |
|
19 | |||
18 | # Script to be run by the windows binary installer after the default setup |
|
20 | setup_args.update(bdist_wininst_options()) | |
19 | # routine, to add shortcuts and similar windows-only things. Windows |
|
|||
20 | # post-install scripts MUST reside in the scripts/ dir, otherwise distutils |
|
|||
21 | # doesn't find them. |
|
|||
22 | if 'bdist_wininst' in sys.argv: |
|
|||
23 | if len(sys.argv) > 2 and \ |
|
|||
24 | ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): |
|
|||
25 | print >> sys.stderr, "ERROR: bdist_wininst must be run alone. Exiting." |
|
|||
26 | sys.exit(1) |
|
|||
27 | setup_args['scripts'] = [os.path.join('scripts','ipython_win_post_install.py')] |
|
|||
28 | setup_args['options'] = {"bdist_wininst": |
|
|||
29 | {"install_script": |
|
|||
30 | "ipython_win_post_install.py"}} |
|
|||
31 |
|
21 | |||
32 | def main(): |
|
22 | def main(): | |
33 | setup(use_2to3 = True, **setup_args) |
|
23 | setup(use_2to3 = True, **setup_args) | |
34 |
|
24 | |||
35 | if __name__ == "__main__": |
|
25 | if __name__ == "__main__": | |
36 | main() |
|
26 | main() |
@@ -1,360 +1,389 b'' | |||||
1 | # encoding: utf-8 |
|
1 | # encoding: utf-8 | |
2 | """ |
|
2 | """ | |
3 | This module defines the things that are used in setup.py for building IPython |
|
3 | This module defines the things that are used in setup.py for building IPython | |
4 |
|
4 | |||
5 | This includes: |
|
5 | This includes: | |
6 |
|
6 | |||
7 | * The basic arguments to setup |
|
7 | * The basic arguments to setup | |
8 | * Functions for finding things like packages, package data, etc. |
|
8 | * Functions for finding things like packages, package data, etc. | |
9 | * A function for checking dependencies. |
|
9 | * A function for checking dependencies. | |
10 | """ |
|
10 | """ | |
11 | from __future__ import print_function |
|
11 | from __future__ import print_function | |
12 |
|
12 | |||
13 | #------------------------------------------------------------------------------- |
|
13 | #------------------------------------------------------------------------------- | |
14 | # Copyright (C) 2008 The IPython Development Team |
|
14 | # Copyright (C) 2008 The IPython Development Team | |
15 | # |
|
15 | # | |
16 | # Distributed under the terms of the BSD License. The full license is in |
|
16 | # Distributed under the terms of the BSD License. The full license is in | |
17 | # the file COPYING, distributed as part of this software. |
|
17 | # the file COPYING, distributed as part of this software. | |
18 | #------------------------------------------------------------------------------- |
|
18 | #------------------------------------------------------------------------------- | |
19 |
|
19 | |||
20 | #------------------------------------------------------------------------------- |
|
20 | #------------------------------------------------------------------------------- | |
21 | # Imports |
|
21 | # Imports | |
22 | #------------------------------------------------------------------------------- |
|
22 | #------------------------------------------------------------------------------- | |
23 | import os |
|
23 | import os | |
24 | import sys |
|
24 | import sys | |
25 |
|
25 | |||
26 | try: |
|
26 | try: | |
27 | from configparser import ConfigParser |
|
27 | from configparser import ConfigParser | |
28 | except: |
|
28 | except: | |
29 | from ConfigParser import ConfigParser |
|
29 | from ConfigParser import ConfigParser | |
30 | from distutils.command.build_py import build_py |
|
30 | from distutils.command.build_py import build_py | |
31 | from glob import glob |
|
31 | from glob import glob | |
32 |
|
32 | |||
33 | from setupext import install_data_ext |
|
33 | from setupext import install_data_ext | |
34 |
|
34 | |||
35 | #------------------------------------------------------------------------------- |
|
35 | #------------------------------------------------------------------------------- | |
36 | # Useful globals and utility functions |
|
36 | # Useful globals and utility functions | |
37 | #------------------------------------------------------------------------------- |
|
37 | #------------------------------------------------------------------------------- | |
38 |
|
38 | |||
39 | # A few handy globals |
|
39 | # A few handy globals | |
40 | isfile = os.path.isfile |
|
40 | isfile = os.path.isfile | |
41 | pjoin = os.path.join |
|
41 | pjoin = os.path.join | |
42 |
|
42 | |||
43 | def oscmd(s): |
|
43 | def oscmd(s): | |
44 | print(">", s) |
|
44 | print(">", s) | |
45 | os.system(s) |
|
45 | os.system(s) | |
46 |
|
46 | |||
47 | # Py3 compatibility hacks, without assuming IPython itself is installed with |
|
47 | # Py3 compatibility hacks, without assuming IPython itself is installed with | |
48 | # the full py3compat machinery. |
|
48 | # the full py3compat machinery. | |
49 |
|
49 | |||
50 | try: |
|
50 | try: | |
51 | execfile |
|
51 | execfile | |
52 | except NameError: |
|
52 | except NameError: | |
53 | def execfile(fname, globs, locs=None): |
|
53 | def execfile(fname, globs, locs=None): | |
54 | locs = locs or globs |
|
54 | locs = locs or globs | |
55 | exec(compile(open(fname).read(), fname, "exec"), globs, locs) |
|
55 | exec(compile(open(fname).read(), fname, "exec"), globs, locs) | |
56 |
|
56 | |||
57 | # A little utility we'll need below, since glob() does NOT allow you to do |
|
57 | # A little utility we'll need below, since glob() does NOT allow you to do | |
58 | # exclusion on multiple endings! |
|
58 | # exclusion on multiple endings! | |
59 | def file_doesnt_endwith(test,endings): |
|
59 | def file_doesnt_endwith(test,endings): | |
60 | """Return true if test is a file and its name does NOT end with any |
|
60 | """Return true if test is a file and its name does NOT end with any | |
61 | of the strings listed in endings.""" |
|
61 | of the strings listed in endings.""" | |
62 | if not isfile(test): |
|
62 | if not isfile(test): | |
63 | return False |
|
63 | return False | |
64 | for e in endings: |
|
64 | for e in endings: | |
65 | if test.endswith(e): |
|
65 | if test.endswith(e): | |
66 | return False |
|
66 | return False | |
67 | return True |
|
67 | return True | |
68 |
|
68 | |||
69 | #--------------------------------------------------------------------------- |
|
69 | #--------------------------------------------------------------------------- | |
70 | # Basic project information |
|
70 | # Basic project information | |
71 | #--------------------------------------------------------------------------- |
|
71 | #--------------------------------------------------------------------------- | |
72 |
|
72 | |||
73 | # release.py contains version, authors, license, url, keywords, etc. |
|
73 | # release.py contains version, authors, license, url, keywords, etc. | |
74 | execfile(pjoin('IPython','core','release.py'), globals()) |
|
74 | execfile(pjoin('IPython','core','release.py'), globals()) | |
75 |
|
75 | |||
76 | # Create a dict with the basic information |
|
76 | # Create a dict with the basic information | |
77 | # This dict is eventually passed to setup after additional keys are added. |
|
77 | # This dict is eventually passed to setup after additional keys are added. | |
78 | setup_args = dict( |
|
78 | setup_args = dict( | |
79 | name = name, |
|
79 | name = name, | |
80 | version = version, |
|
80 | version = version, | |
81 | description = description, |
|
81 | description = description, | |
82 | long_description = long_description, |
|
82 | long_description = long_description, | |
83 | author = author, |
|
83 | author = author, | |
84 | author_email = author_email, |
|
84 | author_email = author_email, | |
85 | url = url, |
|
85 | url = url, | |
86 | download_url = download_url, |
|
86 | download_url = download_url, | |
87 | license = license, |
|
87 | license = license, | |
88 | platforms = platforms, |
|
88 | platforms = platforms, | |
89 | keywords = keywords, |
|
89 | keywords = keywords, | |
90 | classifiers = classifiers, |
|
90 | classifiers = classifiers, | |
91 | cmdclass = {'install_data': install_data_ext}, |
|
91 | cmdclass = {'install_data': install_data_ext}, | |
92 | ) |
|
92 | ) | |
93 |
|
93 | |||
94 |
|
94 | |||
95 | #--------------------------------------------------------------------------- |
|
95 | #--------------------------------------------------------------------------- | |
96 | # Find packages |
|
96 | # Find packages | |
97 | #--------------------------------------------------------------------------- |
|
97 | #--------------------------------------------------------------------------- | |
98 |
|
98 | |||
99 | def find_packages(): |
|
99 | def find_packages(): | |
100 | """ |
|
100 | """ | |
101 | Find all of IPython's packages. |
|
101 | Find all of IPython's packages. | |
102 | """ |
|
102 | """ | |
103 | excludes = ['deathrow'] |
|
103 | excludes = ['deathrow'] | |
104 | packages = [] |
|
104 | packages = [] | |
105 | for dir,subdirs,files in os.walk('IPython'): |
|
105 | for dir,subdirs,files in os.walk('IPython'): | |
106 | package = dir.replace(os.path.sep, '.') |
|
106 | package = dir.replace(os.path.sep, '.') | |
107 | if any([ package.startswith('IPython.'+exc) for exc in excludes ]): |
|
107 | if any([ package.startswith('IPython.'+exc) for exc in excludes ]): | |
108 | # package is to be excluded (e.g. deathrow) |
|
108 | # package is to be excluded (e.g. deathrow) | |
109 | continue |
|
109 | continue | |
110 | if '__init__.py' not in files: |
|
110 | if '__init__.py' not in files: | |
111 | # not a package |
|
111 | # not a package | |
112 | continue |
|
112 | continue | |
113 | packages.append(package) |
|
113 | packages.append(package) | |
114 | return packages |
|
114 | return packages | |
115 |
|
115 | |||
116 | #--------------------------------------------------------------------------- |
|
116 | #--------------------------------------------------------------------------- | |
117 | # Find package data |
|
117 | # Find package data | |
118 | #--------------------------------------------------------------------------- |
|
118 | #--------------------------------------------------------------------------- | |
119 |
|
119 | |||
120 | def find_package_data(): |
|
120 | def find_package_data(): | |
121 | """ |
|
121 | """ | |
122 | Find IPython's package_data. |
|
122 | Find IPython's package_data. | |
123 | """ |
|
123 | """ | |
124 | # This is not enough for these things to appear in an sdist. |
|
124 | # This is not enough for these things to appear in an sdist. | |
125 | # We need to muck with the MANIFEST to get this to work |
|
125 | # We need to muck with the MANIFEST to get this to work | |
126 |
|
126 | |||
127 | # exclude static things that we don't ship (e.g. mathjax) |
|
127 | # exclude static things that we don't ship (e.g. mathjax) | |
128 | excludes = ['mathjax'] |
|
128 | excludes = ['mathjax'] | |
129 |
|
129 | |||
130 | # add 'static/' prefix to exclusions, and tuplify for use in startswith |
|
130 | # add 'static/' prefix to exclusions, and tuplify for use in startswith | |
131 | excludes = tuple([os.path.join('static', ex) for ex in excludes]) |
|
131 | excludes = tuple([os.path.join('static', ex) for ex in excludes]) | |
132 |
|
132 | |||
133 | # walk notebook resources: |
|
133 | # walk notebook resources: | |
134 | cwd = os.getcwd() |
|
134 | cwd = os.getcwd() | |
135 | os.chdir(os.path.join('IPython', 'frontend', 'html', 'notebook')) |
|
135 | os.chdir(os.path.join('IPython', 'frontend', 'html', 'notebook')) | |
136 | static_walk = list(os.walk('static')) |
|
136 | static_walk = list(os.walk('static')) | |
137 | os.chdir(cwd) |
|
137 | os.chdir(cwd) | |
138 | static_data = [] |
|
138 | static_data = [] | |
139 | for parent, dirs, files in static_walk: |
|
139 | for parent, dirs, files in static_walk: | |
140 | if parent.startswith(excludes): |
|
140 | if parent.startswith(excludes): | |
141 | continue |
|
141 | continue | |
142 | for f in files: |
|
142 | for f in files: | |
143 | static_data.append(os.path.join(parent, f)) |
|
143 | static_data.append(os.path.join(parent, f)) | |
144 |
|
144 | |||
145 | package_data = { |
|
145 | package_data = { | |
146 | 'IPython.config.profile' : ['README*', '*/*.py'], |
|
146 | 'IPython.config.profile' : ['README*', '*/*.py'], | |
147 | 'IPython.testing' : ['*.txt'], |
|
147 | 'IPython.testing' : ['*.txt'], | |
148 | 'IPython.frontend.html.notebook' : ['templates/*'] + static_data, |
|
148 | 'IPython.frontend.html.notebook' : ['templates/*'] + static_data, | |
149 | 'IPython.frontend.qt.console' : ['resources/icon/*.svg'], |
|
149 | 'IPython.frontend.qt.console' : ['resources/icon/*.svg'], | |
150 | } |
|
150 | } | |
151 | return package_data |
|
151 | return package_data | |
152 |
|
152 | |||
153 |
|
153 | |||
154 | #--------------------------------------------------------------------------- |
|
154 | #--------------------------------------------------------------------------- | |
155 | # Find data files |
|
155 | # Find data files | |
156 | #--------------------------------------------------------------------------- |
|
156 | #--------------------------------------------------------------------------- | |
157 |
|
157 | |||
158 | def make_dir_struct(tag,base,out_base): |
|
158 | def make_dir_struct(tag,base,out_base): | |
159 | """Make the directory structure of all files below a starting dir. |
|
159 | """Make the directory structure of all files below a starting dir. | |
160 |
|
160 | |||
161 | This is just a convenience routine to help build a nested directory |
|
161 | This is just a convenience routine to help build a nested directory | |
162 | hierarchy because distutils is too stupid to do this by itself. |
|
162 | hierarchy because distutils is too stupid to do this by itself. | |
163 |
|
163 | |||
164 | XXX - this needs a proper docstring! |
|
164 | XXX - this needs a proper docstring! | |
165 | """ |
|
165 | """ | |
166 |
|
166 | |||
167 | # we'll use these a lot below |
|
167 | # we'll use these a lot below | |
168 | lbase = len(base) |
|
168 | lbase = len(base) | |
169 | pathsep = os.path.sep |
|
169 | pathsep = os.path.sep | |
170 | lpathsep = len(pathsep) |
|
170 | lpathsep = len(pathsep) | |
171 |
|
171 | |||
172 | out = [] |
|
172 | out = [] | |
173 | for (dirpath,dirnames,filenames) in os.walk(base): |
|
173 | for (dirpath,dirnames,filenames) in os.walk(base): | |
174 | # we need to strip out the dirpath from the base to map it to the |
|
174 | # we need to strip out the dirpath from the base to map it to the | |
175 | # output (installation) path. This requires possibly stripping the |
|
175 | # output (installation) path. This requires possibly stripping the | |
176 | # path separator, because otherwise pjoin will not work correctly |
|
176 | # path separator, because otherwise pjoin will not work correctly | |
177 | # (pjoin('foo/','/bar') returns '/bar'). |
|
177 | # (pjoin('foo/','/bar') returns '/bar'). | |
178 |
|
178 | |||
179 | dp_eff = dirpath[lbase:] |
|
179 | dp_eff = dirpath[lbase:] | |
180 | if dp_eff.startswith(pathsep): |
|
180 | if dp_eff.startswith(pathsep): | |
181 | dp_eff = dp_eff[lpathsep:] |
|
181 | dp_eff = dp_eff[lpathsep:] | |
182 | # The output path must be anchored at the out_base marker |
|
182 | # The output path must be anchored at the out_base marker | |
183 | out_path = pjoin(out_base,dp_eff) |
|
183 | out_path = pjoin(out_base,dp_eff) | |
184 | # Now we can generate the final filenames. Since os.walk only produces |
|
184 | # Now we can generate the final filenames. Since os.walk only produces | |
185 | # filenames, we must join back with the dirpath to get full valid file |
|
185 | # filenames, we must join back with the dirpath to get full valid file | |
186 | # paths: |
|
186 | # paths: | |
187 | pfiles = [pjoin(dirpath,f) for f in filenames] |
|
187 | pfiles = [pjoin(dirpath,f) for f in filenames] | |
188 | # Finally, generate the entry we need, which is a pari of (output |
|
188 | # Finally, generate the entry we need, which is a pari of (output | |
189 | # path, files) for use as a data_files parameter in install_data. |
|
189 | # path, files) for use as a data_files parameter in install_data. | |
190 | out.append((out_path, pfiles)) |
|
190 | out.append((out_path, pfiles)) | |
191 |
|
191 | |||
192 | return out |
|
192 | return out | |
193 |
|
193 | |||
194 |
|
194 | |||
195 | def find_data_files(): |
|
195 | def find_data_files(): | |
196 | """ |
|
196 | """ | |
197 | Find IPython's data_files. |
|
197 | Find IPython's data_files. | |
198 |
|
198 | |||
199 | Most of these are docs. |
|
199 | Most of these are docs. | |
200 | """ |
|
200 | """ | |
201 |
|
201 | |||
202 | docdirbase = pjoin('share', 'doc', 'ipython') |
|
202 | docdirbase = pjoin('share', 'doc', 'ipython') | |
203 | manpagebase = pjoin('share', 'man', 'man1') |
|
203 | manpagebase = pjoin('share', 'man', 'man1') | |
204 |
|
204 | |||
205 | # Simple file lists can be made by hand |
|
205 | # Simple file lists can be made by hand | |
206 | manpages = filter(isfile, glob(pjoin('docs','man','*.1.gz'))) |
|
206 | manpages = filter(isfile, glob(pjoin('docs','man','*.1.gz'))) | |
207 | if not manpages: |
|
207 | if not manpages: | |
208 | # When running from a source tree, the manpages aren't gzipped |
|
208 | # When running from a source tree, the manpages aren't gzipped | |
209 | manpages = filter(isfile, glob(pjoin('docs','man','*.1'))) |
|
209 | manpages = filter(isfile, glob(pjoin('docs','man','*.1'))) | |
210 | igridhelpfiles = filter(isfile, |
|
210 | igridhelpfiles = filter(isfile, | |
211 | glob(pjoin('IPython','extensions','igrid_help.*'))) |
|
211 | glob(pjoin('IPython','extensions','igrid_help.*'))) | |
212 |
|
212 | |||
213 | # For nested structures, use the utility above |
|
213 | # For nested structures, use the utility above | |
214 | example_files = make_dir_struct( |
|
214 | example_files = make_dir_struct( | |
215 | 'data', |
|
215 | 'data', | |
216 | pjoin('docs','examples'), |
|
216 | pjoin('docs','examples'), | |
217 | pjoin(docdirbase,'examples') |
|
217 | pjoin(docdirbase,'examples') | |
218 | ) |
|
218 | ) | |
219 | manual_files = make_dir_struct( |
|
219 | manual_files = make_dir_struct( | |
220 | 'data', |
|
220 | 'data', | |
221 | pjoin('docs','html'), |
|
221 | pjoin('docs','html'), | |
222 | pjoin(docdirbase,'manual') |
|
222 | pjoin(docdirbase,'manual') | |
223 | ) |
|
223 | ) | |
224 |
|
224 | |||
225 | # And assemble the entire output list |
|
225 | # And assemble the entire output list | |
226 | data_files = [ (manpagebase, manpages), |
|
226 | data_files = [ (manpagebase, manpages), | |
227 | (pjoin(docdirbase, 'extensions'), igridhelpfiles), |
|
227 | (pjoin(docdirbase, 'extensions'), igridhelpfiles), | |
228 | ] + manual_files + example_files |
|
228 | ] + manual_files + example_files | |
229 |
|
229 | |||
230 | return data_files |
|
230 | return data_files | |
231 |
|
231 | |||
232 |
|
232 | |||
233 | def make_man_update_target(manpage): |
|
233 | def make_man_update_target(manpage): | |
234 | """Return a target_update-compliant tuple for the given manpage. |
|
234 | """Return a target_update-compliant tuple for the given manpage. | |
235 |
|
235 | |||
236 | Parameters |
|
236 | Parameters | |
237 | ---------- |
|
237 | ---------- | |
238 | manpage : string |
|
238 | manpage : string | |
239 | Name of the manpage, must include the section number (trailing number). |
|
239 | Name of the manpage, must include the section number (trailing number). | |
240 |
|
240 | |||
241 | Example |
|
241 | Example | |
242 | ------- |
|
242 | ------- | |
243 |
|
243 | |||
244 | >>> make_man_update_target('ipython.1') #doctest: +NORMALIZE_WHITESPACE |
|
244 | >>> make_man_update_target('ipython.1') #doctest: +NORMALIZE_WHITESPACE | |
245 | ('docs/man/ipython.1.gz', |
|
245 | ('docs/man/ipython.1.gz', | |
246 | ['docs/man/ipython.1'], |
|
246 | ['docs/man/ipython.1'], | |
247 | 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz') |
|
247 | 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz') | |
248 | """ |
|
248 | """ | |
249 | man_dir = pjoin('docs', 'man') |
|
249 | man_dir = pjoin('docs', 'man') | |
250 | manpage_gz = manpage + '.gz' |
|
250 | manpage_gz = manpage + '.gz' | |
251 | manpath = pjoin(man_dir, manpage) |
|
251 | manpath = pjoin(man_dir, manpage) | |
252 | manpath_gz = pjoin(man_dir, manpage_gz) |
|
252 | manpath_gz = pjoin(man_dir, manpage_gz) | |
253 | gz_cmd = ( "cd %(man_dir)s && gzip -9c %(manpage)s > %(manpage_gz)s" % |
|
253 | gz_cmd = ( "cd %(man_dir)s && gzip -9c %(manpage)s > %(manpage_gz)s" % | |
254 | locals() ) |
|
254 | locals() ) | |
255 | return (manpath_gz, [manpath], gz_cmd) |
|
255 | return (manpath_gz, [manpath], gz_cmd) | |
256 |
|
256 | |||
257 | #--------------------------------------------------------------------------- |
|
257 | #--------------------------------------------------------------------------- | |
258 | # Find scripts |
|
258 | # Find scripts | |
259 | #--------------------------------------------------------------------------- |
|
259 | #--------------------------------------------------------------------------- | |
260 |
|
260 | |||
261 | def find_scripts(entry_points=False, suffix=''): |
|
261 | def find_scripts(entry_points=False, suffix=''): | |
262 | """Find IPython's scripts. |
|
262 | """Find IPython's scripts. | |
263 |
|
263 | |||
264 | if entry_points is True: |
|
264 | if entry_points is True: | |
265 | return setuptools entry_point-style definitions |
|
265 | return setuptools entry_point-style definitions | |
266 | else: |
|
266 | else: | |
267 | return file paths of plain scripts [default] |
|
267 | return file paths of plain scripts [default] | |
268 |
|
268 | |||
269 | suffix is appended to script names if entry_points is True, so that the |
|
269 | suffix is appended to script names if entry_points is True, so that the | |
270 | Python 3 scripts get named "ipython3" etc. |
|
270 | Python 3 scripts get named "ipython3" etc. | |
271 | """ |
|
271 | """ | |
272 | if entry_points: |
|
272 | if entry_points: | |
273 | console_scripts = [s % suffix for s in [ |
|
273 | console_scripts = [s % suffix for s in [ | |
274 | 'ipython%s = IPython.frontend.terminal.ipapp:launch_new_instance', |
|
274 | 'ipython%s = IPython.frontend.terminal.ipapp:launch_new_instance', | |
275 | 'pycolor%s = IPython.utils.PyColorize:main', |
|
275 | 'pycolor%s = IPython.utils.PyColorize:main', | |
276 | 'ipcontroller%s = IPython.parallel.apps.ipcontrollerapp:launch_new_instance', |
|
276 | 'ipcontroller%s = IPython.parallel.apps.ipcontrollerapp:launch_new_instance', | |
277 | 'ipengine%s = IPython.parallel.apps.ipengineapp:launch_new_instance', |
|
277 | 'ipengine%s = IPython.parallel.apps.ipengineapp:launch_new_instance', | |
278 | 'iplogger%s = IPython.parallel.apps.iploggerapp:launch_new_instance', |
|
278 | 'iplogger%s = IPython.parallel.apps.iploggerapp:launch_new_instance', | |
279 | 'ipcluster%s = IPython.parallel.apps.ipclusterapp:launch_new_instance', |
|
279 | 'ipcluster%s = IPython.parallel.apps.ipclusterapp:launch_new_instance', | |
280 | 'iptest%s = IPython.testing.iptest:main', |
|
280 | 'iptest%s = IPython.testing.iptest:main', | |
281 | 'irunner%s = IPython.lib.irunner:main' |
|
281 | 'irunner%s = IPython.lib.irunner:main' | |
282 | ]] |
|
282 | ]] | |
283 | gui_scripts = [s % suffix for s in [ |
|
283 | gui_scripts = [s % suffix for s in [ | |
284 | 'ipython%s-qtconsole = IPython.frontend.qt.console.qtconsoleapp:main', |
|
284 | 'ipython%s-qtconsole = IPython.frontend.qt.console.qtconsoleapp:main', | |
285 | ]] |
|
285 | ]] | |
286 | scripts = dict(console_scripts=console_scripts, gui_scripts=gui_scripts) |
|
286 | scripts = dict(console_scripts=console_scripts, gui_scripts=gui_scripts) | |
287 | else: |
|
287 | else: | |
288 | parallel_scripts = pjoin('IPython','parallel','scripts') |
|
288 | parallel_scripts = pjoin('IPython','parallel','scripts') | |
289 | main_scripts = pjoin('IPython','scripts') |
|
289 | main_scripts = pjoin('IPython','scripts') | |
290 | scripts = [ |
|
290 | scripts = [ | |
291 | pjoin(parallel_scripts, 'ipengine'), |
|
291 | pjoin(parallel_scripts, 'ipengine'), | |
292 | pjoin(parallel_scripts, 'ipcontroller'), |
|
292 | pjoin(parallel_scripts, 'ipcontroller'), | |
293 | pjoin(parallel_scripts, 'ipcluster'), |
|
293 | pjoin(parallel_scripts, 'ipcluster'), | |
294 | pjoin(parallel_scripts, 'iplogger'), |
|
294 | pjoin(parallel_scripts, 'iplogger'), | |
295 | pjoin(main_scripts, 'ipython'), |
|
295 | pjoin(main_scripts, 'ipython'), | |
296 | pjoin(main_scripts, 'pycolor'), |
|
296 | pjoin(main_scripts, 'pycolor'), | |
297 | pjoin(main_scripts, 'irunner'), |
|
297 | pjoin(main_scripts, 'irunner'), | |
298 | pjoin(main_scripts, 'iptest') |
|
298 | pjoin(main_scripts, 'iptest') | |
299 | ] |
|
299 | ] | |
300 | return scripts |
|
300 | return scripts | |
301 |
|
301 | |||
302 | #--------------------------------------------------------------------------- |
|
302 | #--------------------------------------------------------------------------- | |
303 | # Verify all dependencies |
|
303 | # Verify all dependencies | |
304 | #--------------------------------------------------------------------------- |
|
304 | #--------------------------------------------------------------------------- | |
305 |
|
305 | |||
306 | def check_for_dependencies(): |
|
306 | def check_for_dependencies(): | |
307 | """Check for IPython's dependencies. |
|
307 | """Check for IPython's dependencies. | |
308 |
|
308 | |||
309 | This function should NOT be called if running under setuptools! |
|
309 | This function should NOT be called if running under setuptools! | |
310 | """ |
|
310 | """ | |
311 | from setupext.setupext import ( |
|
311 | from setupext.setupext import ( | |
312 | print_line, print_raw, print_status, |
|
312 | print_line, print_raw, print_status, | |
313 | check_for_sphinx, check_for_pygments, |
|
313 | check_for_sphinx, check_for_pygments, | |
314 | check_for_nose, check_for_pexpect, |
|
314 | check_for_nose, check_for_pexpect, | |
315 | check_for_pyzmq, check_for_readline |
|
315 | check_for_pyzmq, check_for_readline | |
316 | ) |
|
316 | ) | |
317 | print_line() |
|
317 | print_line() | |
318 | print_raw("BUILDING IPYTHON") |
|
318 | print_raw("BUILDING IPYTHON") | |
319 | print_status('python', sys.version) |
|
319 | print_status('python', sys.version) | |
320 | print_status('platform', sys.platform) |
|
320 | print_status('platform', sys.platform) | |
321 | if sys.platform == 'win32': |
|
321 | if sys.platform == 'win32': | |
322 | print_status('Windows version', sys.getwindowsversion()) |
|
322 | print_status('Windows version', sys.getwindowsversion()) | |
323 |
|
323 | |||
324 | print_raw("") |
|
324 | print_raw("") | |
325 | print_raw("OPTIONAL DEPENDENCIES") |
|
325 | print_raw("OPTIONAL DEPENDENCIES") | |
326 |
|
326 | |||
327 | check_for_sphinx() |
|
327 | check_for_sphinx() | |
328 | check_for_pygments() |
|
328 | check_for_pygments() | |
329 | check_for_nose() |
|
329 | check_for_nose() | |
330 | check_for_pexpect() |
|
330 | check_for_pexpect() | |
331 | check_for_pyzmq() |
|
331 | check_for_pyzmq() | |
332 | check_for_readline() |
|
332 | check_for_readline() | |
333 |
|
333 | |||
334 | def record_commit_info(pkg_dir, build_cmd=build_py): |
|
334 | def record_commit_info(pkg_dir, build_cmd=build_py): | |
335 | """ Return extended build command class for recording commit |
|
335 | """ Return extended build command class for recording commit | |
336 |
|
336 | |||
337 | records git commit in IPython.utils._sysinfo.commit |
|
337 | records git commit in IPython.utils._sysinfo.commit | |
338 |
|
338 | |||
339 | for use in IPython.utils.sysinfo.sys_info() calls after installation. |
|
339 | for use in IPython.utils.sysinfo.sys_info() calls after installation. | |
340 | """ |
|
340 | """ | |
341 |
|
341 | |||
342 | class MyBuildPy(build_cmd): |
|
342 | class MyBuildPy(build_cmd): | |
343 | ''' Subclass to write commit data into installation tree ''' |
|
343 | ''' Subclass to write commit data into installation tree ''' | |
344 | def run(self): |
|
344 | def run(self): | |
345 | build_cmd.run(self) |
|
345 | build_cmd.run(self) | |
346 | import subprocess |
|
346 | import subprocess | |
347 | proc = subprocess.Popen('git rev-parse --short HEAD', |
|
347 | proc = subprocess.Popen('git rev-parse --short HEAD', | |
348 | stdout=subprocess.PIPE, |
|
348 | stdout=subprocess.PIPE, | |
349 | stderr=subprocess.PIPE, |
|
349 | stderr=subprocess.PIPE, | |
350 | shell=True) |
|
350 | shell=True) | |
351 | repo_commit, _ = proc.communicate() |
|
351 | repo_commit, _ = proc.communicate() | |
352 | repo_commit = repo_commit.strip() |
|
352 | repo_commit = repo_commit.strip() | |
353 | # We write the installation commit even if it's empty |
|
353 | # We write the installation commit even if it's empty | |
354 | out_pth = pjoin(self.build_lib, pkg_dir, 'utils', '_sysinfo.py') |
|
354 | out_pth = pjoin(self.build_lib, pkg_dir, 'utils', '_sysinfo.py') | |
355 | with open(out_pth, 'w') as out_file: |
|
355 | with open(out_pth, 'w') as out_file: | |
356 | out_file.writelines([ |
|
356 | out_file.writelines([ | |
357 | '# GENERATED BY setup.py\n', |
|
357 | '# GENERATED BY setup.py\n', | |
358 | 'commit = "%s"\n' % repo_commit.decode('ascii'), |
|
358 | 'commit = "%s"\n' % repo_commit.decode('ascii'), | |
359 | ]) |
|
359 | ]) | |
360 | return MyBuildPy |
|
360 | return MyBuildPy | |
|
361 | ||||
|
362 | #----------------------------------------------------------------------------- | |||
|
363 | # Misc. utilities common to setup2/3 | |||
|
364 | #----------------------------------------------------------------------------- | |||
|
365 | ||||
|
366 | def bdist_wininst_options(): | |||
|
367 | """Options to setup specific to the creation of Windows binary installer. | |||
|
368 | """ | |||
|
369 | ||||
|
370 | setup_args = {} | |||
|
371 | ||||
|
372 | if 'bdist_wininst' not in sys.argv: | |||
|
373 | return setup_args | |||
|
374 | ||||
|
375 | # If we're building a binary Windows installer, a few extra flags are | |||
|
376 | # needed. Script to be run by the installer after the default setup | |||
|
377 | # routine, to add shortcuts and similar windows-only things. Windows | |||
|
378 | # post-install scripts MUST reside in the scripts/ dir, otherwise distutils | |||
|
379 | # doesn't find them. | |||
|
380 | if len(sys.argv) > 2 and \ | |||
|
381 | ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): | |||
|
382 | print >> sys.stderr, "ERROR: bdist_wininst must be run alone. Exiting." | |||
|
383 | sys.exit(1) | |||
|
384 | setup_args['scripts'] = [os.path.join('scripts', | |||
|
385 | 'ipython_win_post_install.py')] | |||
|
386 | setup_args['options'] = {"bdist_wininst": | |||
|
387 | {"install_script": | |||
|
388 | "ipython_win_post_install.py"}} | |||
|
389 | return setup_args |
General Comments 0
You need to be logged in to leave comments.
Login now