Show More
@@ -20,17 +20,20 b' requires utilities which are not available under Windows."""' | |||||
20 | #----------------------------------------------------------------------------- |
|
20 | #----------------------------------------------------------------------------- | |
21 | # Minimal Python version sanity check |
|
21 | # Minimal Python version sanity check | |
22 | #----------------------------------------------------------------------------- |
|
22 | #----------------------------------------------------------------------------- | |
|
23 | from __future__ import print_function | |||
23 |
|
24 | |||
24 | import sys |
|
25 | import sys | |
25 |
|
26 | |||
26 | # 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 | |
27 | # changing Python version requirements. |
|
28 | # changing Python version requirements. | |
28 | if sys.version[0:3] < '2.6': |
|
29 | #~ if sys.version[0:3] < '2.6': | |
29 | error = """\ |
|
30 | #~ error = """\ | |
30 | ERROR: 'IPython requires Python Version 2.6 or above.' |
|
31 | #~ ERROR: 'IPython requires Python Version 2.6 or above.' | |
31 | Exiting.""" |
|
32 | #~ Exiting.""" | |
32 | print >> sys.stderr, error |
|
33 | #~ print >> sys.stderr, error | |
33 | sys.exit(1) |
|
34 | #~ sys.exit(1) | |
|
35 | ||||
|
36 | PY3 = (sys.version_info[0] >= 3) | |||
34 |
|
37 | |||
35 | # At least we're on the python version we need, move on. |
|
38 | # At least we're on the python version we need, move on. | |
36 |
|
39 | |||
@@ -50,8 +53,12 b" if os.path.exists('MANIFEST'): os.remove('MANIFEST')" | |||||
50 |
|
53 | |||
51 | from distutils.core import setup |
|
54 | from distutils.core import setup | |
52 |
|
55 | |||
|
56 | # On Python 3, we need distribute (new setuptools) to do the 2to3 conversion | |||
|
57 | if PY3: | |||
|
58 | import setuptools | |||
|
59 | ||||
53 | # Our own imports |
|
60 | # Our own imports | |
54 |
from |
|
61 | from setupbase import target_update | |
55 |
|
62 | |||
56 | from setupbase import ( |
|
63 | from setupbase import ( | |
57 | setup_args, |
|
64 | setup_args, | |
@@ -91,14 +98,14 b" if os.name == 'posix':" | |||||
91 | elif os.name in ['nt','dos']: |
|
98 | elif os.name in ['nt','dos']: | |
92 | os_name = 'windows' |
|
99 | os_name = 'windows' | |
93 | else: |
|
100 | else: | |
94 |
print |
|
101 | print('Unsupported operating system:',os.name) | |
95 | sys.exit(1) |
|
102 | sys.exit(1) | |
96 |
|
103 | |||
97 | # Under Windows, 'sdist' has not been supported. Now that the docs build with |
|
104 | # 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 |
|
105 | # Sphinx it might work, but let's not turn it on until someone confirms that it | |
99 | # actually works. |
|
106 | # actually works. | |
100 | if os_name == 'windows' and 'sdist' in sys.argv: |
|
107 | if os_name == 'windows' and 'sdist' in sys.argv: | |
101 |
print |
|
108 | print('The sdist command is not available under Windows. Exiting.') | |
102 | sys.exit(1) |
|
109 | sys.exit(1) | |
103 |
|
110 | |||
104 | #------------------------------------------------------------------------------- |
|
111 | #------------------------------------------------------------------------------- | |
@@ -187,6 +194,11 b' packages = find_packages()' | |||||
187 | package_data = find_package_data() |
|
194 | package_data = find_package_data() | |
188 | data_files = find_data_files() |
|
195 | data_files = find_data_files() | |
189 |
|
196 | |||
|
197 | setup_args['cmdclass'] = {'build_py': record_commit_info('IPython')} | |||
|
198 | setup_args['packages'] = packages | |||
|
199 | setup_args['package_data'] = package_data | |||
|
200 | setup_args['data_files'] = data_files | |||
|
201 | ||||
190 | #--------------------------------------------------------------------------- |
|
202 | #--------------------------------------------------------------------------- | |
191 | # Handle scripts, dependencies, and setuptools specific things |
|
203 | # Handle scripts, dependencies, and setuptools specific things | |
192 | #--------------------------------------------------------------------------- |
|
204 | #--------------------------------------------------------------------------- | |
@@ -247,6 +259,12 b" if 'setuptools' in sys.modules:" | |||||
247 | setup_args['options'] = {"bdist_wininst": |
|
259 | setup_args['options'] = {"bdist_wininst": | |
248 | {"install_script": |
|
260 | {"install_script": | |
249 | "ipython_win_post_install.py"}} |
|
261 | "ipython_win_post_install.py"}} | |
|
262 | ||||
|
263 | if PY3: | |||
|
264 | setuptools_extra_args['use_2to3'] = True | |||
|
265 | from setuptools.command.build_py import build_py | |||
|
266 | setup_args['cmdclass'] = {'build_py': record_commit_info('IPython', build_cmd=build_py)} | |||
|
267 | setuptools_extra_args['entry_points'] = find_scripts(True, suffix='3') | |||
250 | else: |
|
268 | else: | |
251 | # If we are running without setuptools, call this function which will |
|
269 | # If we are running without setuptools, call this function which will | |
252 | # check for dependencies an inform the user what is needed. This is |
|
270 | # check for dependencies an inform the user what is needed. This is | |
@@ -258,10 +276,6 b' else:' | |||||
258 | # Do the actual setup now |
|
276 | # Do the actual setup now | |
259 | #--------------------------------------------------------------------------- |
|
277 | #--------------------------------------------------------------------------- | |
260 |
|
278 | |||
261 | setup_args['cmdclass'] = {'build_py': record_commit_info('IPython')} |
|
|||
262 | setup_args['packages'] = packages |
|
|||
263 | setup_args['package_data'] = package_data |
|
|||
264 | setup_args['data_files'] = data_files |
|
|||
265 | setup_args.update(setuptools_extra_args) |
|
279 | setup_args.update(setuptools_extra_args) | |
266 |
|
280 | |||
267 | def main(): |
|
281 | def main(): |
@@ -251,6 +251,44 b' def make_man_update_target(manpage):' | |||||
251 | locals() ) |
|
251 | locals() ) | |
252 | return (manpath_gz, [manpath], gz_cmd) |
|
252 | return (manpath_gz, [manpath], gz_cmd) | |
253 |
|
253 | |||
|
254 | # The two functions below are copied from IPython.utils.path, so we don't need | |||
|
255 | # to import IPython during setup, which fails on Python 3. | |||
|
256 | ||||
|
257 | def target_outdated(target,deps): | |||
|
258 | """Determine whether a target is out of date. | |||
|
259 | ||||
|
260 | target_outdated(target,deps) -> 1/0 | |||
|
261 | ||||
|
262 | deps: list of filenames which MUST exist. | |||
|
263 | target: single filename which may or may not exist. | |||
|
264 | ||||
|
265 | If target doesn't exist or is older than any file listed in deps, return | |||
|
266 | true, otherwise return false. | |||
|
267 | """ | |||
|
268 | try: | |||
|
269 | target_time = os.path.getmtime(target) | |||
|
270 | except os.error: | |||
|
271 | return 1 | |||
|
272 | for dep in deps: | |||
|
273 | dep_time = os.path.getmtime(dep) | |||
|
274 | if dep_time > target_time: | |||
|
275 | #print "For target",target,"Dep failed:",dep # dbg | |||
|
276 | #print "times (dep,tar):",dep_time,target_time # dbg | |||
|
277 | return 1 | |||
|
278 | return 0 | |||
|
279 | ||||
|
280 | ||||
|
281 | def target_update(target,deps,cmd): | |||
|
282 | """Update a target with a given command given a list of dependencies. | |||
|
283 | ||||
|
284 | target_update(target,deps,cmd) -> runs cmd if target is outdated. | |||
|
285 | ||||
|
286 | This is just a wrapper around target_outdated() which calls the given | |||
|
287 | command if target is outdated.""" | |||
|
288 | ||||
|
289 | if target_outdated(target,deps): | |||
|
290 | system(cmd) | |||
|
291 | ||||
254 | #--------------------------------------------------------------------------- |
|
292 | #--------------------------------------------------------------------------- | |
255 | # Find scripts |
|
293 | # Find scripts | |
256 | #--------------------------------------------------------------------------- |
|
294 | #--------------------------------------------------------------------------- |
@@ -1,4 +1,5 b'' | |||||
1 | # encoding: utf-8 |
|
1 | # encoding: utf-8 | |
|
2 | from __future__ import print_function | |||
2 |
|
3 | |||
3 | __docformat__ = "restructuredtext en" |
|
4 | __docformat__ = "restructuredtext en" | |
4 |
|
5 | |||
@@ -27,26 +28,26 b' def check_display(f):' | |||||
27 |
|
28 | |||
28 | @check_display |
|
29 | @check_display | |
29 | def print_line(char='='): |
|
30 | def print_line(char='='): | |
30 |
print |
|
31 | print(char * 76) | |
31 |
|
32 | |||
32 | @check_display |
|
33 | @check_display | |
33 | def print_status(package, status): |
|
34 | def print_status(package, status): | |
34 | initial_indent = "%22s: " % package |
|
35 | initial_indent = "%22s: " % package | |
35 | indent = ' ' * 24 |
|
36 | indent = ' ' * 24 | |
36 |
print |
|
37 | print(fill(str(status), width=76, | |
37 | initial_indent=initial_indent, |
|
38 | initial_indent=initial_indent, | |
38 | subsequent_indent=indent) |
|
39 | subsequent_indent=indent)) | |
39 |
|
40 | |||
40 | @check_display |
|
41 | @check_display | |
41 | def print_message(message): |
|
42 | def print_message(message): | |
42 | indent = ' ' * 24 + "* " |
|
43 | indent = ' ' * 24 + "* " | |
43 |
print |
|
44 | print(fill(str(message), width=76, | |
44 | initial_indent=indent, |
|
45 | initial_indent=indent, | |
45 | subsequent_indent=indent) |
|
46 | subsequent_indent=indent)) | |
46 |
|
47 | |||
47 | @check_display |
|
48 | @check_display | |
48 | def print_raw(section): |
|
49 | def print_raw(section): | |
49 |
print |
|
50 | print(section) | |
50 |
|
51 | |||
51 | #------------------------------------------------------------------------------- |
|
52 | #------------------------------------------------------------------------------- | |
52 | # Tests for specific packages |
|
53 | # Tests for specific packages |
General Comments 0
You need to be logged in to leave comments.
Login now