##// END OF EJS Templates
Merge pull request #13607 from MrMino/setup.py-unused-import...
Blazej Michalik -
r27613:6ddb518c merge
parent child Browse files
Show More
@@ -1,145 +1,144 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Setup script for IPython.
2 """Setup script for IPython.
3
3
4 Under Posix environments it works like a typical setup.py script.
4 Under Posix environments it works like a typical setup.py script.
5 Under Windows, the command sdist is not supported, since IPython
5 Under Windows, the command sdist is not supported, since IPython
6 requires utilities which are not available under Windows."""
6 requires utilities which are not available under Windows."""
7
7
8 #-----------------------------------------------------------------------------
8 #-----------------------------------------------------------------------------
9 # Copyright (c) 2008-2011, IPython Development Team.
9 # Copyright (c) 2008-2011, IPython Development Team.
10 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
10 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
11 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
11 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
12 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
12 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
13 #
13 #
14 # Distributed under the terms of the Modified BSD License.
14 # Distributed under the terms of the Modified BSD License.
15 #
15 #
16 # The full license is in the file COPYING.rst, distributed with this software.
16 # The full license is in the file COPYING.rst, distributed with this software.
17 #-----------------------------------------------------------------------------
17 #-----------------------------------------------------------------------------
18
18
19 import os
19 import os
20 import sys
20 import sys
21 from itertools import chain
22
21
23 # **Python version check**
22 # **Python version check**
24 #
23 #
25 # This check is also made in IPython/__init__, don't forget to update both when
24 # This check is also made in IPython/__init__, don't forget to update both when
26 # changing Python version requirements.
25 # changing Python version requirements.
27 if sys.version_info < (3, 8):
26 if sys.version_info < (3, 8):
28 pip_message = 'This may be due to an out of date pip. Make sure you have pip >= 9.0.1.'
27 pip_message = 'This may be due to an out of date pip. Make sure you have pip >= 9.0.1.'
29 try:
28 try:
30 import pip
29 import pip
31 pip_version = tuple([int(x) for x in pip.__version__.split('.')[:3]])
30 pip_version = tuple([int(x) for x in pip.__version__.split('.')[:3]])
32 if pip_version < (9, 0, 1) :
31 if pip_version < (9, 0, 1) :
33 pip_message = 'Your pip version is out of date, please install pip >= 9.0.1. '\
32 pip_message = 'Your pip version is out of date, please install pip >= 9.0.1. '\
34 'pip {} detected.'.format(pip.__version__)
33 'pip {} detected.'.format(pip.__version__)
35 else:
34 else:
36 # pip is new enough - it must be something else
35 # pip is new enough - it must be something else
37 pip_message = ''
36 pip_message = ''
38 except Exception:
37 except Exception:
39 pass
38 pass
40
39
41
40
42 error = """
41 error = """
43 IPython 8+ supports Python 3.8 and above, following NEP 29.
42 IPython 8+ supports Python 3.8 and above, following NEP 29.
44 When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
43 When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
45 Python 3.3 and 3.4 were supported up to IPython 6.x.
44 Python 3.3 and 3.4 were supported up to IPython 6.x.
46 Python 3.5 was supported with IPython 7.0 to 7.9.
45 Python 3.5 was supported with IPython 7.0 to 7.9.
47 Python 3.6 was supported with IPython up to 7.16.
46 Python 3.6 was supported with IPython up to 7.16.
48 Python 3.7 was still supported with the 7.x branch.
47 Python 3.7 was still supported with the 7.x branch.
49
48
50 See IPython `README.rst` file for more information:
49 See IPython `README.rst` file for more information:
51
50
52 https://github.com/ipython/ipython/blob/master/README.rst
51 https://github.com/ipython/ipython/blob/master/README.rst
53
52
54 Python {py} detected.
53 Python {py} detected.
55 {pip}
54 {pip}
56 """.format(py=sys.version_info, pip=pip_message )
55 """.format(py=sys.version_info, pip=pip_message )
57
56
58 print(error, file=sys.stderr)
57 print(error, file=sys.stderr)
59 sys.exit(1)
58 sys.exit(1)
60
59
61 # At least we're on the python version we need, move on.
60 # At least we're on the python version we need, move on.
62
61
63 from setuptools import setup
62 from setuptools import setup
64
63
65 # Our own imports
64 # Our own imports
66 from setupbase import target_update
65 from setupbase import target_update
67
66
68 from setupbase import (
67 from setupbase import (
69 setup_args,
68 setup_args,
70 check_package_data_first,
69 check_package_data_first,
71 find_data_files,
70 find_data_files,
72 git_prebuild,
71 git_prebuild,
73 install_symlinked,
72 install_symlinked,
74 install_lib_symlink,
73 install_lib_symlink,
75 install_scripts_for_symlink,
74 install_scripts_for_symlink,
76 unsymlink,
75 unsymlink,
77 )
76 )
78
77
79 #-------------------------------------------------------------------------------
78 #-------------------------------------------------------------------------------
80 # Handle OS specific things
79 # Handle OS specific things
81 #-------------------------------------------------------------------------------
80 #-------------------------------------------------------------------------------
82
81
83 if os.name in ('nt','dos'):
82 if os.name in ('nt','dos'):
84 os_name = 'windows'
83 os_name = 'windows'
85 else:
84 else:
86 os_name = os.name
85 os_name = os.name
87
86
88 # Under Windows, 'sdist' has not been supported. Now that the docs build with
87 # Under Windows, 'sdist' has not been supported. Now that the docs build with
89 # Sphinx it might work, but let's not turn it on until someone confirms that it
88 # Sphinx it might work, but let's not turn it on until someone confirms that it
90 # actually works.
89 # actually works.
91 if os_name == 'windows' and 'sdist' in sys.argv:
90 if os_name == 'windows' and 'sdist' in sys.argv:
92 print('The sdist command is not available under Windows. Exiting.')
91 print('The sdist command is not available under Windows. Exiting.')
93 sys.exit(1)
92 sys.exit(1)
94
93
95
94
96 #-------------------------------------------------------------------------------
95 #-------------------------------------------------------------------------------
97 # Things related to the IPython documentation
96 # Things related to the IPython documentation
98 #-------------------------------------------------------------------------------
97 #-------------------------------------------------------------------------------
99
98
100 # update the manuals when building a source dist
99 # update the manuals when building a source dist
101 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
100 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
102
101
103 # List of things to be updated. Each entry is a triplet of args for
102 # List of things to be updated. Each entry is a triplet of args for
104 # target_update()
103 # target_update()
105 to_update = [
104 to_update = [
106 (
105 (
107 "docs/man/ipython.1.gz",
106 "docs/man/ipython.1.gz",
108 ["docs/man/ipython.1"],
107 ["docs/man/ipython.1"],
109 "cd docs/man && python -m gzip --best ipython.1",
108 "cd docs/man && python -m gzip --best ipython.1",
110 ),
109 ),
111 ]
110 ]
112
111
113
112
114 [ target_update(*t) for t in to_update ]
113 [ target_update(*t) for t in to_update ]
115
114
116 #---------------------------------------------------------------------------
115 #---------------------------------------------------------------------------
117 # Find all the packages, package data, and data_files
116 # Find all the packages, package data, and data_files
118 #---------------------------------------------------------------------------
117 #---------------------------------------------------------------------------
119
118
120 data_files = find_data_files()
119 data_files = find_data_files()
121
120
122 setup_args['data_files'] = data_files
121 setup_args['data_files'] = data_files
123
122
124 #---------------------------------------------------------------------------
123 #---------------------------------------------------------------------------
125 # custom distutils commands
124 # custom distutils commands
126 #---------------------------------------------------------------------------
125 #---------------------------------------------------------------------------
127 # imports here, so they are after setuptools import if there was one
126 # imports here, so they are after setuptools import if there was one
128 from setuptools.command.sdist import sdist
127 from setuptools.command.sdist import sdist
129
128
130 setup_args['cmdclass'] = {
129 setup_args['cmdclass'] = {
131 'build_py': \
130 'build_py': \
132 check_package_data_first(git_prebuild('IPython')),
131 check_package_data_first(git_prebuild('IPython')),
133 'sdist' : git_prebuild('IPython', sdist),
132 'sdist' : git_prebuild('IPython', sdist),
134 'symlink': install_symlinked,
133 'symlink': install_symlinked,
135 'install_lib_symlink': install_lib_symlink,
134 'install_lib_symlink': install_lib_symlink,
136 'install_scripts_sym': install_scripts_for_symlink,
135 'install_scripts_sym': install_scripts_for_symlink,
137 'unsymlink': unsymlink,
136 'unsymlink': unsymlink,
138 }
137 }
139
138
140 #---------------------------------------------------------------------------
139 #---------------------------------------------------------------------------
141 # Do the actual setup now
140 # Do the actual setup now
142 #---------------------------------------------------------------------------
141 #---------------------------------------------------------------------------
143
142
144 if __name__ == "__main__":
143 if __name__ == "__main__":
145 setup(**setup_args)
144 setup(**setup_args)
General Comments 0
You need to be logged in to leave comments. Login now