##// END OF EJS Templates
Merge pull request #5500 from minrk/check-3.3...
Thomas Kluyver -
r16301:4f17f81a merge
parent child Browse files
Show More
@@ -1,145 +1,147 b''
1 # encoding: utf-8
1 # encoding: utf-8
2 """
2 """
3 IPython: tools for interactive and parallel computing in Python.
3 IPython: tools for interactive and parallel computing in Python.
4
4
5 http://ipython.org
5 http://ipython.org
6 """
6 """
7 #-----------------------------------------------------------------------------
7 #-----------------------------------------------------------------------------
8 # Copyright (c) 2008-2011, IPython Development Team.
8 # Copyright (c) 2008-2011, IPython Development Team.
9 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
9 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
10 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
10 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
11 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
11 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
12 #
12 #
13 # Distributed under the terms of the Modified BSD License.
13 # Distributed under the terms of the Modified BSD License.
14 #
14 #
15 # The full license is in the file COPYING.txt, distributed with this software.
15 # The full license is in the file COPYING.txt, distributed with this software.
16 #-----------------------------------------------------------------------------
16 #-----------------------------------------------------------------------------
17
17
18 #-----------------------------------------------------------------------------
18 #-----------------------------------------------------------------------------
19 # Imports
19 # Imports
20 #-----------------------------------------------------------------------------
20 #-----------------------------------------------------------------------------
21 from __future__ import absolute_import
21 from __future__ import absolute_import
22
22
23 import os
23 import os
24 import sys
24 import sys
25
25
26 #-----------------------------------------------------------------------------
26 #-----------------------------------------------------------------------------
27 # Setup everything
27 # Setup everything
28 #-----------------------------------------------------------------------------
28 #-----------------------------------------------------------------------------
29
29
30 # Don't forget to also update setup.py when this changes!
30 # Don't forget to also update setup.py when this changes!
31 if sys.version_info[:2] < (2,7):
31 v = sys.version_info
32 raise ImportError('IPython requires Python Version 2.7 or above.')
32 if v[:2] < (2,7) or (v[0] >= 3 and v[:2] < (3,3)):
33 raise ImportError('IPython requires Python version 2.7 or 3.3 or above.')
34 del v
33
35
34 # Make it easy to import extensions - they are always directly on pythonpath.
36 # Make it easy to import extensions - they are always directly on pythonpath.
35 # Therefore, non-IPython modules can be added to extensions directory.
37 # Therefore, non-IPython modules can be added to extensions directory.
36 # This should probably be in ipapp.py.
38 # This should probably be in ipapp.py.
37 sys.path.append(os.path.join(os.path.dirname(__file__), "extensions"))
39 sys.path.append(os.path.join(os.path.dirname(__file__), "extensions"))
38
40
39 #-----------------------------------------------------------------------------
41 #-----------------------------------------------------------------------------
40 # Setup the top level names
42 # Setup the top level names
41 #-----------------------------------------------------------------------------
43 #-----------------------------------------------------------------------------
42
44
43 from .config.loader import Config
45 from .config.loader import Config
44 from .core.getipython import get_ipython
46 from .core.getipython import get_ipython
45 from .core import release
47 from .core import release
46 from .core.application import Application
48 from .core.application import Application
47 from .terminal.embed import embed
49 from .terminal.embed import embed
48
50
49 from .core.error import TryNext
51 from .core.error import TryNext
50 from .core.interactiveshell import InteractiveShell
52 from .core.interactiveshell import InteractiveShell
51 from .testing import test
53 from .testing import test
52 from .utils.sysinfo import sys_info
54 from .utils.sysinfo import sys_info
53 from .utils.frame import extract_module_locals
55 from .utils.frame import extract_module_locals
54
56
55 # Release data
57 # Release data
56 __author__ = '%s <%s>' % (release.author, release.author_email)
58 __author__ = '%s <%s>' % (release.author, release.author_email)
57 __license__ = release.license
59 __license__ = release.license
58 __version__ = release.version
60 __version__ = release.version
59 version_info = release.version_info
61 version_info = release.version_info
60
62
61 def embed_kernel(module=None, local_ns=None, **kwargs):
63 def embed_kernel(module=None, local_ns=None, **kwargs):
62 """Embed and start an IPython kernel in a given scope.
64 """Embed and start an IPython kernel in a given scope.
63
65
64 If you don't want the kernel to initialize the namespace
66 If you don't want the kernel to initialize the namespace
65 from the scope of the surrounding function,
67 from the scope of the surrounding function,
66 and/or you want to load full IPython configuration,
68 and/or you want to load full IPython configuration,
67 you probably want `IPython.start_kernel()` instead.
69 you probably want `IPython.start_kernel()` instead.
68
70
69 Parameters
71 Parameters
70 ----------
72 ----------
71 module : ModuleType, optional
73 module : ModuleType, optional
72 The module to load into IPython globals (default: caller)
74 The module to load into IPython globals (default: caller)
73 local_ns : dict, optional
75 local_ns : dict, optional
74 The namespace to load into IPython user namespace (default: caller)
76 The namespace to load into IPython user namespace (default: caller)
75
77
76 kwargs : various, optional
78 kwargs : various, optional
77 Further keyword args are relayed to the IPKernelApp constructor,
79 Further keyword args are relayed to the IPKernelApp constructor,
78 allowing configuration of the Kernel. Will only have an effect
80 allowing configuration of the Kernel. Will only have an effect
79 on the first embed_kernel call for a given process.
81 on the first embed_kernel call for a given process.
80 """
82 """
81
83
82 (caller_module, caller_locals) = extract_module_locals(1)
84 (caller_module, caller_locals) = extract_module_locals(1)
83 if module is None:
85 if module is None:
84 module = caller_module
86 module = caller_module
85 if local_ns is None:
87 if local_ns is None:
86 local_ns = caller_locals
88 local_ns = caller_locals
87
89
88 # Only import .zmq when we really need it
90 # Only import .zmq when we really need it
89 from IPython.kernel.zmq.embed import embed_kernel as real_embed_kernel
91 from IPython.kernel.zmq.embed import embed_kernel as real_embed_kernel
90 real_embed_kernel(module=module, local_ns=local_ns, **kwargs)
92 real_embed_kernel(module=module, local_ns=local_ns, **kwargs)
91
93
92 def start_ipython(argv=None, **kwargs):
94 def start_ipython(argv=None, **kwargs):
93 """Launch a normal IPython instance (as opposed to embedded)
95 """Launch a normal IPython instance (as opposed to embedded)
94
96
95 `IPython.embed()` puts a shell in a particular calling scope,
97 `IPython.embed()` puts a shell in a particular calling scope,
96 such as a function or method for debugging purposes,
98 such as a function or method for debugging purposes,
97 which is often not desirable.
99 which is often not desirable.
98
100
99 `start_ipython()` does full, regular IPython initialization,
101 `start_ipython()` does full, regular IPython initialization,
100 including loading startup files, configuration, etc.
102 including loading startup files, configuration, etc.
101 much of which is skipped by `embed()`.
103 much of which is skipped by `embed()`.
102
104
103 This is a public API method, and will survive implementation changes.
105 This is a public API method, and will survive implementation changes.
104
106
105 Parameters
107 Parameters
106 ----------
108 ----------
107
109
108 argv : list or None, optional
110 argv : list or None, optional
109 If unspecified or None, IPython will parse command-line options from sys.argv.
111 If unspecified or None, IPython will parse command-line options from sys.argv.
110 To prevent any command-line parsing, pass an empty list: `argv=[]`.
112 To prevent any command-line parsing, pass an empty list: `argv=[]`.
111 user_ns : dict, optional
113 user_ns : dict, optional
112 specify this dictionary to initialize the IPython user namespace with particular values.
114 specify this dictionary to initialize the IPython user namespace with particular values.
113 kwargs : various, optional
115 kwargs : various, optional
114 Any other kwargs will be passed to the Application constructor,
116 Any other kwargs will be passed to the Application constructor,
115 such as `config`.
117 such as `config`.
116 """
118 """
117 from IPython.terminal.ipapp import launch_new_instance
119 from IPython.terminal.ipapp import launch_new_instance
118 return launch_new_instance(argv=argv, **kwargs)
120 return launch_new_instance(argv=argv, **kwargs)
119
121
120 def start_kernel(argv=None, **kwargs):
122 def start_kernel(argv=None, **kwargs):
121 """Launch a normal IPython kernel instance (as opposed to embedded)
123 """Launch a normal IPython kernel instance (as opposed to embedded)
122
124
123 `IPython.embed_kernel()` puts a shell in a particular calling scope,
125 `IPython.embed_kernel()` puts a shell in a particular calling scope,
124 such as a function or method for debugging purposes,
126 such as a function or method for debugging purposes,
125 which is often not desirable.
127 which is often not desirable.
126
128
127 `start_kernel()` does full, regular IPython initialization,
129 `start_kernel()` does full, regular IPython initialization,
128 including loading startup files, configuration, etc.
130 including loading startup files, configuration, etc.
129 much of which is skipped by `embed()`.
131 much of which is skipped by `embed()`.
130
132
131 Parameters
133 Parameters
132 ----------
134 ----------
133
135
134 argv : list or None, optional
136 argv : list or None, optional
135 If unspecified or None, IPython will parse command-line options from sys.argv.
137 If unspecified or None, IPython will parse command-line options from sys.argv.
136 To prevent any command-line parsing, pass an empty list: `argv=[]`.
138 To prevent any command-line parsing, pass an empty list: `argv=[]`.
137 user_ns : dict, optional
139 user_ns : dict, optional
138 specify this dictionary to initialize the IPython user namespace with particular values.
140 specify this dictionary to initialize the IPython user namespace with particular values.
139 kwargs : various, optional
141 kwargs : various, optional
140 Any other kwargs will be passed to the Application constructor,
142 Any other kwargs will be passed to the Application constructor,
141 such as `config`.
143 such as `config`.
142 """
144 """
143 from IPython.kernel.zmq.kernelapp import launch_new_instance
145 from IPython.kernel.zmq.kernelapp import launch_new_instance
144 return launch_new_instance(argv=argv, **kwargs)
146 return launch_new_instance(argv=argv, **kwargs)
145 No newline at end of file
147
@@ -1,343 +1,344 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 if sys.version_info[:2] < (2,7):
29 v = sys.version_info
30 error = "ERROR: IPython requires Python Version 2.7 or above."
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 print(error, file=sys.stderr)
32 print(error, file=sys.stderr)
32 sys.exit(1)
33 sys.exit(1)
33
34
34 PY3 = (sys.version_info[0] >= 3)
35 PY3 = (sys.version_info[0] >= 3)
35
36
36 # 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.
37
38
38 #-------------------------------------------------------------------------------
39 #-------------------------------------------------------------------------------
39 # Imports
40 # Imports
40 #-------------------------------------------------------------------------------
41 #-------------------------------------------------------------------------------
41
42
42 # Stdlib imports
43 # Stdlib imports
43 import os
44 import os
44 import shutil
45 import shutil
45
46
46 from glob import glob
47 from glob import glob
47
48
48 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
49 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
49 # update it when the contents of directories change.
50 # update it when the contents of directories change.
50 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
51 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
51
52
52 from distutils.core import setup
53 from distutils.core import setup
53
54
54 # Our own imports
55 # Our own imports
55 from setupbase import target_update
56 from setupbase import target_update
56
57
57 from setupbase import (
58 from setupbase import (
58 setup_args,
59 setup_args,
59 find_packages,
60 find_packages,
60 find_package_data,
61 find_package_data,
61 check_package_data_first,
62 check_package_data_first,
62 find_entry_points,
63 find_entry_points,
63 build_scripts_entrypt,
64 build_scripts_entrypt,
64 find_data_files,
65 find_data_files,
65 check_for_dependencies,
66 check_for_dependencies,
66 git_prebuild,
67 git_prebuild,
67 check_submodule_status,
68 check_submodule_status,
68 update_submodules,
69 update_submodules,
69 require_submodules,
70 require_submodules,
70 UpdateSubmodules,
71 UpdateSubmodules,
71 get_bdist_wheel,
72 get_bdist_wheel,
72 CompileCSS,
73 CompileCSS,
73 JavascriptVersion,
74 JavascriptVersion,
74 install_symlinked,
75 install_symlinked,
75 install_lib_symlink,
76 install_lib_symlink,
76 install_scripts_for_symlink,
77 install_scripts_for_symlink,
77 unsymlink,
78 unsymlink,
78 )
79 )
79 from setupext import setupext
80 from setupext import setupext
80
81
81 isfile = os.path.isfile
82 isfile = os.path.isfile
82 pjoin = os.path.join
83 pjoin = os.path.join
83
84
84 #-----------------------------------------------------------------------------
85 #-----------------------------------------------------------------------------
85 # Function definitions
86 # Function definitions
86 #-----------------------------------------------------------------------------
87 #-----------------------------------------------------------------------------
87
88
88 def cleanup():
89 def cleanup():
89 """Clean up the junk left around by the build process"""
90 """Clean up the junk left around by the build process"""
90 if "develop" not in sys.argv and "egg_info" not in sys.argv:
91 if "develop" not in sys.argv and "egg_info" not in sys.argv:
91 try:
92 try:
92 shutil.rmtree('ipython.egg-info')
93 shutil.rmtree('ipython.egg-info')
93 except:
94 except:
94 try:
95 try:
95 os.unlink('ipython.egg-info')
96 os.unlink('ipython.egg-info')
96 except:
97 except:
97 pass
98 pass
98
99
99 #-------------------------------------------------------------------------------
100 #-------------------------------------------------------------------------------
100 # Handle OS specific things
101 # Handle OS specific things
101 #-------------------------------------------------------------------------------
102 #-------------------------------------------------------------------------------
102
103
103 if os.name in ('nt','dos'):
104 if os.name in ('nt','dos'):
104 os_name = 'windows'
105 os_name = 'windows'
105 else:
106 else:
106 os_name = os.name
107 os_name = os.name
107
108
108 # Under Windows, 'sdist' has not been supported. Now that the docs build with
109 # Under Windows, 'sdist' has not been supported. Now that the docs build with
109 # Sphinx it might work, but let's not turn it on until someone confirms that it
110 # Sphinx it might work, but let's not turn it on until someone confirms that it
110 # actually works.
111 # actually works.
111 if os_name == 'windows' and 'sdist' in sys.argv:
112 if os_name == 'windows' and 'sdist' in sys.argv:
112 print('The sdist command is not available under Windows. Exiting.')
113 print('The sdist command is not available under Windows. Exiting.')
113 sys.exit(1)
114 sys.exit(1)
114
115
115 #-------------------------------------------------------------------------------
116 #-------------------------------------------------------------------------------
116 # Make sure we aren't trying to run without submodules
117 # Make sure we aren't trying to run without submodules
117 #-------------------------------------------------------------------------------
118 #-------------------------------------------------------------------------------
118 here = os.path.abspath(os.path.dirname(__file__))
119 here = os.path.abspath(os.path.dirname(__file__))
119
120
120 def require_clean_submodules():
121 def require_clean_submodules():
121 """Check on git submodules before distutils can do anything
122 """Check on git submodules before distutils can do anything
122
123
123 Since distutils cannot be trusted to update the tree
124 Since distutils cannot be trusted to update the tree
124 after everything has been set in motion,
125 after everything has been set in motion,
125 this is not a distutils command.
126 this is not a distutils command.
126 """
127 """
127 # PACKAGERS: Add a return here to skip checks for git submodules
128 # PACKAGERS: Add a return here to skip checks for git submodules
128
129
129 # don't do anything if nothing is actually supposed to happen
130 # don't do anything if nothing is actually supposed to happen
130 for do_nothing in ('-h', '--help', '--help-commands', 'clean', 'submodule'):
131 for do_nothing in ('-h', '--help', '--help-commands', 'clean', 'submodule'):
131 if do_nothing in sys.argv:
132 if do_nothing in sys.argv:
132 return
133 return
133
134
134 status = check_submodule_status(here)
135 status = check_submodule_status(here)
135
136
136 if status == "missing":
137 if status == "missing":
137 print("checking out submodules for the first time")
138 print("checking out submodules for the first time")
138 update_submodules(here)
139 update_submodules(here)
139 elif status == "unclean":
140 elif status == "unclean":
140 print('\n'.join([
141 print('\n'.join([
141 "Cannot build / install IPython with unclean submodules",
142 "Cannot build / install IPython with unclean submodules",
142 "Please update submodules with",
143 "Please update submodules with",
143 " python setup.py submodule",
144 " python setup.py submodule",
144 "or",
145 "or",
145 " git submodule update",
146 " git submodule update",
146 "or commit any submodule changes you have made."
147 "or commit any submodule changes you have made."
147 ]))
148 ]))
148 sys.exit(1)
149 sys.exit(1)
149
150
150 require_clean_submodules()
151 require_clean_submodules()
151
152
152 #-------------------------------------------------------------------------------
153 #-------------------------------------------------------------------------------
153 # Things related to the IPython documentation
154 # Things related to the IPython documentation
154 #-------------------------------------------------------------------------------
155 #-------------------------------------------------------------------------------
155
156
156 # update the manuals when building a source dist
157 # update the manuals when building a source dist
157 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
158 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
158
159
159 # List of things to be updated. Each entry is a triplet of args for
160 # List of things to be updated. Each entry is a triplet of args for
160 # target_update()
161 # target_update()
161 to_update = [
162 to_update = [
162 # FIXME - Disabled for now: we need to redo an automatic way
163 # FIXME - Disabled for now: we need to redo an automatic way
163 # of generating the magic info inside the rst.
164 # of generating the magic info inside the rst.
164 #('docs/magic.tex',
165 #('docs/magic.tex',
165 #['IPython/Magic.py'],
166 #['IPython/Magic.py'],
166 #"cd doc && ./update_magic.sh" ),
167 #"cd doc && ./update_magic.sh" ),
167
168
168 ('docs/man/ipcluster.1.gz',
169 ('docs/man/ipcluster.1.gz',
169 ['docs/man/ipcluster.1'],
170 ['docs/man/ipcluster.1'],
170 'cd docs/man && gzip -9c ipcluster.1 > ipcluster.1.gz'),
171 'cd docs/man && gzip -9c ipcluster.1 > ipcluster.1.gz'),
171
172
172 ('docs/man/ipcontroller.1.gz',
173 ('docs/man/ipcontroller.1.gz',
173 ['docs/man/ipcontroller.1'],
174 ['docs/man/ipcontroller.1'],
174 'cd docs/man && gzip -9c ipcontroller.1 > ipcontroller.1.gz'),
175 'cd docs/man && gzip -9c ipcontroller.1 > ipcontroller.1.gz'),
175
176
176 ('docs/man/ipengine.1.gz',
177 ('docs/man/ipengine.1.gz',
177 ['docs/man/ipengine.1'],
178 ['docs/man/ipengine.1'],
178 'cd docs/man && gzip -9c ipengine.1 > ipengine.1.gz'),
179 'cd docs/man && gzip -9c ipengine.1 > ipengine.1.gz'),
179
180
180 ('docs/man/ipython.1.gz',
181 ('docs/man/ipython.1.gz',
181 ['docs/man/ipython.1'],
182 ['docs/man/ipython.1'],
182 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
183 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
183
184
184 ]
185 ]
185
186
186
187
187 [ target_update(*t) for t in to_update ]
188 [ target_update(*t) for t in to_update ]
188
189
189 #---------------------------------------------------------------------------
190 #---------------------------------------------------------------------------
190 # Find all the packages, package data, and data_files
191 # Find all the packages, package data, and data_files
191 #---------------------------------------------------------------------------
192 #---------------------------------------------------------------------------
192
193
193 packages = find_packages()
194 packages = find_packages()
194 package_data = find_package_data()
195 package_data = find_package_data()
195
196
196 data_files = find_data_files()
197 data_files = find_data_files()
197
198
198 setup_args['packages'] = packages
199 setup_args['packages'] = packages
199 setup_args['package_data'] = package_data
200 setup_args['package_data'] = package_data
200 setup_args['data_files'] = data_files
201 setup_args['data_files'] = data_files
201
202
202 #---------------------------------------------------------------------------
203 #---------------------------------------------------------------------------
203 # custom distutils commands
204 # custom distutils commands
204 #---------------------------------------------------------------------------
205 #---------------------------------------------------------------------------
205 # imports here, so they are after setuptools import if there was one
206 # imports here, so they are after setuptools import if there was one
206 from distutils.command.sdist import sdist
207 from distutils.command.sdist import sdist
207 from distutils.command.upload import upload
208 from distutils.command.upload import upload
208
209
209 class UploadWindowsInstallers(upload):
210 class UploadWindowsInstallers(upload):
210
211
211 description = "Upload Windows installers to PyPI (only used from tools/release_windows.py)"
212 description = "Upload Windows installers to PyPI (only used from tools/release_windows.py)"
212 user_options = upload.user_options + [
213 user_options = upload.user_options + [
213 ('files=', 'f', 'exe file (or glob) to upload')
214 ('files=', 'f', 'exe file (or glob) to upload')
214 ]
215 ]
215 def initialize_options(self):
216 def initialize_options(self):
216 upload.initialize_options(self)
217 upload.initialize_options(self)
217 meta = self.distribution.metadata
218 meta = self.distribution.metadata
218 base = '{name}-{version}'.format(
219 base = '{name}-{version}'.format(
219 name=meta.get_name(),
220 name=meta.get_name(),
220 version=meta.get_version()
221 version=meta.get_version()
221 )
222 )
222 self.files = os.path.join('dist', '%s.*.exe' % base)
223 self.files = os.path.join('dist', '%s.*.exe' % base)
223
224
224 def run(self):
225 def run(self):
225 for dist_file in glob(self.files):
226 for dist_file in glob(self.files):
226 self.upload_file('bdist_wininst', 'any', dist_file)
227 self.upload_file('bdist_wininst', 'any', dist_file)
227
228
228 setup_args['cmdclass'] = {
229 setup_args['cmdclass'] = {
229 'build_py': check_package_data_first(git_prebuild('IPython')),
230 'build_py': check_package_data_first(git_prebuild('IPython')),
230 'sdist' : git_prebuild('IPython', sdist),
231 'sdist' : git_prebuild('IPython', sdist),
231 'upload_wininst' : UploadWindowsInstallers,
232 'upload_wininst' : UploadWindowsInstallers,
232 'submodule' : UpdateSubmodules,
233 'submodule' : UpdateSubmodules,
233 'css' : CompileCSS,
234 'css' : CompileCSS,
234 'symlink': install_symlinked,
235 'symlink': install_symlinked,
235 'install_lib_symlink': install_lib_symlink,
236 'install_lib_symlink': install_lib_symlink,
236 'install_scripts_sym': install_scripts_for_symlink,
237 'install_scripts_sym': install_scripts_for_symlink,
237 'unsymlink': unsymlink,
238 'unsymlink': unsymlink,
238 'jsversion' : JavascriptVersion,
239 'jsversion' : JavascriptVersion,
239 }
240 }
240
241
241 #---------------------------------------------------------------------------
242 #---------------------------------------------------------------------------
242 # Handle scripts, dependencies, and setuptools specific things
243 # Handle scripts, dependencies, and setuptools specific things
243 #---------------------------------------------------------------------------
244 #---------------------------------------------------------------------------
244
245
245 # For some commands, use setuptools. Note that we do NOT list install here!
246 # For some commands, use setuptools. Note that we do NOT list install here!
246 # If you want a setuptools-enhanced install, just run 'setupegg.py install'
247 # If you want a setuptools-enhanced install, just run 'setupegg.py install'
247 needs_setuptools = set(('develop', 'release', 'bdist_egg', 'bdist_rpm',
248 needs_setuptools = set(('develop', 'release', 'bdist_egg', 'bdist_rpm',
248 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel',
249 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel',
249 'egg_info', 'easy_install', 'upload', 'install_egg_info',
250 'egg_info', 'easy_install', 'upload', 'install_egg_info',
250 ))
251 ))
251 if sys.platform == 'win32':
252 if sys.platform == 'win32':
252 # Depend on setuptools for install on *Windows only*
253 # Depend on setuptools for install on *Windows only*
253 # If we get script-installation working without setuptools,
254 # If we get script-installation working without setuptools,
254 # then we can back off, but until then use it.
255 # then we can back off, but until then use it.
255 # See Issue #369 on GitHub for more
256 # See Issue #369 on GitHub for more
256 needs_setuptools.add('install')
257 needs_setuptools.add('install')
257
258
258 if len(needs_setuptools.intersection(sys.argv)) > 0:
259 if len(needs_setuptools.intersection(sys.argv)) > 0:
259 import setuptools
260 import setuptools
260
261
261 # This dict is used for passing extra arguments that are setuptools
262 # This dict is used for passing extra arguments that are setuptools
262 # specific to setup
263 # specific to setup
263 setuptools_extra_args = {}
264 setuptools_extra_args = {}
264
265
265 # setuptools requirements
266 # setuptools requirements
266
267
267 extras_require = dict(
268 extras_require = dict(
268 parallel = ['pyzmq>=2.1.11'],
269 parallel = ['pyzmq>=2.1.11'],
269 qtconsole = ['pyzmq>=2.1.11', 'pygments'],
270 qtconsole = ['pyzmq>=2.1.11', 'pygments'],
270 zmq = ['pyzmq>=2.1.11'],
271 zmq = ['pyzmq>=2.1.11'],
271 doc = ['Sphinx>=1.1', 'numpydoc'],
272 doc = ['Sphinx>=1.1', 'numpydoc'],
272 test = ['nose>=0.10.1'],
273 test = ['nose>=0.10.1'],
273 notebook = ['tornado>=3.1', 'pyzmq>=2.1.11', 'jinja2'],
274 notebook = ['tornado>=3.1', 'pyzmq>=2.1.11', 'jinja2'],
274 nbconvert = ['pygments', 'jinja2', 'Sphinx>=0.3']
275 nbconvert = ['pygments', 'jinja2', 'Sphinx>=0.3']
275 )
276 )
276 if sys.version_info < (3, 3):
277 if sys.version_info < (3, 3):
277 extras_require['test'].append('mock')
278 extras_require['test'].append('mock')
278
279
279 everything = set()
280 everything = set()
280 for deps in extras_require.values():
281 for deps in extras_require.values():
281 everything.update(deps)
282 everything.update(deps)
282 extras_require['all'] = everything
283 extras_require['all'] = everything
283
284
284 install_requires = []
285 install_requires = []
285 if sys.platform == 'darwin':
286 if sys.platform == 'darwin':
286 if any(arg.startswith('bdist') for arg in sys.argv) or not setupext.check_for_readline():
287 if any(arg.startswith('bdist') for arg in sys.argv) or not setupext.check_for_readline():
287 install_requires.append('gnureadline')
288 install_requires.append('gnureadline')
288 elif sys.platform.startswith('win'):
289 elif sys.platform.startswith('win'):
289 # Pyreadline has unicode and Python 3 fixes in 2.0
290 # Pyreadline has unicode and Python 3 fixes in 2.0
290 install_requires.append('pyreadline>=2.0')
291 install_requires.append('pyreadline>=2.0')
291
292
292 if 'setuptools' in sys.modules:
293 if 'setuptools' in sys.modules:
293 # setup.py develop should check for submodules
294 # setup.py develop should check for submodules
294 from setuptools.command.develop import develop
295 from setuptools.command.develop import develop
295 setup_args['cmdclass']['develop'] = require_submodules(develop)
296 setup_args['cmdclass']['develop'] = require_submodules(develop)
296 setup_args['cmdclass']['bdist_wheel'] = get_bdist_wheel()
297 setup_args['cmdclass']['bdist_wheel'] = get_bdist_wheel()
297
298
298 setuptools_extra_args['zip_safe'] = False
299 setuptools_extra_args['zip_safe'] = False
299 setuptools_extra_args['entry_points'] = {'console_scripts':find_entry_points()}
300 setuptools_extra_args['entry_points'] = {'console_scripts':find_entry_points()}
300 setup_args['extras_require'] = extras_require
301 setup_args['extras_require'] = extras_require
301 requires = setup_args['install_requires'] = install_requires
302 requires = setup_args['install_requires'] = install_requires
302
303
303 # Script to be run by the windows binary installer after the default setup
304 # Script to be run by the windows binary installer after the default setup
304 # routine, to add shortcuts and similar windows-only things. Windows
305 # routine, to add shortcuts and similar windows-only things. Windows
305 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
306 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
306 # doesn't find them.
307 # doesn't find them.
307 if 'bdist_wininst' in sys.argv:
308 if 'bdist_wininst' in sys.argv:
308 if len(sys.argv) > 2 and \
309 if len(sys.argv) > 2 and \
309 ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
310 ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
310 print >> sys.stderr, "ERROR: bdist_wininst must be run alone. Exiting."
311 print >> sys.stderr, "ERROR: bdist_wininst must be run alone. Exiting."
311 sys.exit(1)
312 sys.exit(1)
312 setup_args['data_files'].append(
313 setup_args['data_files'].append(
313 ['Scripts', ('scripts/ipython.ico', 'scripts/ipython_nb.ico')])
314 ['Scripts', ('scripts/ipython.ico', 'scripts/ipython_nb.ico')])
314 setup_args['scripts'] = [pjoin('scripts','ipython_win_post_install.py')]
315 setup_args['scripts'] = [pjoin('scripts','ipython_win_post_install.py')]
315 setup_args['options'] = {"bdist_wininst":
316 setup_args['options'] = {"bdist_wininst":
316 {"install_script":
317 {"install_script":
317 "ipython_win_post_install.py"}}
318 "ipython_win_post_install.py"}}
318
319
319 else:
320 else:
320 # If we are installing without setuptools, call this function which will
321 # If we are installing without setuptools, call this function which will
321 # check for dependencies an inform the user what is needed. This is
322 # check for dependencies an inform the user what is needed. This is
322 # just to make life easy for users.
323 # just to make life easy for users.
323 for install_cmd in ('install', 'symlink'):
324 for install_cmd in ('install', 'symlink'):
324 if install_cmd in sys.argv:
325 if install_cmd in sys.argv:
325 check_for_dependencies()
326 check_for_dependencies()
326 break
327 break
327 # scripts has to be a non-empty list, or install_scripts isn't called
328 # scripts has to be a non-empty list, or install_scripts isn't called
328 setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()]
329 setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()]
329
330
330 setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt
331 setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt
331
332
332 #---------------------------------------------------------------------------
333 #---------------------------------------------------------------------------
333 # Do the actual setup now
334 # Do the actual setup now
334 #---------------------------------------------------------------------------
335 #---------------------------------------------------------------------------
335
336
336 setup_args.update(setuptools_extra_args)
337 setup_args.update(setuptools_extra_args)
337
338
338 def main():
339 def main():
339 setup(**setup_args)
340 setup(**setup_args)
340 cleanup()
341 cleanup()
341
342
342 if __name__ == '__main__':
343 if __name__ == '__main__':
343 main()
344 main()
General Comments 0
You need to be logged in to leave comments. Login now