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