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