##// END OF EJS Templates
Modernize setuptools usage in pyproject.toml...
Michał Górny -
Show More
@@ -1,3 +1,3 b''
1 [build-system]
1 [build-system]
2 requires = ["setuptools >= 51.0.0", "wheel"]
2 requires = ["setuptools >= 51.0.0"]
3 build-backend = "setuptools.build_meta:__legacy__"
3 build-backend = "setuptools.build_meta"
@@ -1,146 +1,148 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
21
22 # **Python version check**
22 # **Python version check**
23 #
23 #
24 # 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
25 # changing Python version requirements.
25 # changing Python version requirements.
26 if sys.version_info < (3, 8):
26 if sys.version_info < (3, 8):
27 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.'
28 try:
28 try:
29 import pip
29 import pip
30 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]])
31 if pip_version < (9, 0, 1) :
31 if pip_version < (9, 0, 1) :
32 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. '\
33 'pip {} detected.'.format(pip.__version__)
33 'pip {} detected.'.format(pip.__version__)
34 else:
34 else:
35 # pip is new enough - it must be something else
35 # pip is new enough - it must be something else
36 pip_message = ''
36 pip_message = ''
37 except Exception:
37 except Exception:
38 pass
38 pass
39
39
40
40
41 error = """
41 error = """
42 IPython 8+ supports Python 3.8 and above, following NEP 29.
42 IPython 8+ supports Python 3.8 and above, following NEP 29.
43 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.
44 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.
45 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.
46 Python 3.6 was supported with IPython up to 7.16.
46 Python 3.6 was supported with IPython up to 7.16.
47 Python 3.7 was still supported with the 7.x branch.
47 Python 3.7 was still supported with the 7.x branch.
48
48
49 See IPython `README.rst` file for more information:
49 See IPython `README.rst` file for more information:
50
50
51 https://github.com/ipython/ipython/blob/master/README.rst
51 https://github.com/ipython/ipython/blob/master/README.rst
52
52
53 Python {py} detected.
53 Python {py} detected.
54 {pip}
54 {pip}
55 """.format(
55 """.format(
56 py=sys.version_info, pip=pip_message
56 py=sys.version_info, pip=pip_message
57 )
57 )
58
58
59 print(error, file=sys.stderr)
59 print(error, file=sys.stderr)
60 sys.exit(1)
60 sys.exit(1)
61
61
62 # At least we're on the python version we need, move on.
62 # At least we're on the python version we need, move on.
63
63
64 from setuptools import setup
64 from setuptools import setup
65
65
66 # Our own imports
66 # Our own imports
67 sys.path.insert(0, ".")
68
67 from setupbase import target_update
69 from setupbase import target_update
68
70
69 from setupbase import (
71 from setupbase import (
70 setup_args,
72 setup_args,
71 check_package_data_first,
73 check_package_data_first,
72 find_data_files,
74 find_data_files,
73 git_prebuild,
75 git_prebuild,
74 install_symlinked,
76 install_symlinked,
75 install_lib_symlink,
77 install_lib_symlink,
76 install_scripts_for_symlink,
78 install_scripts_for_symlink,
77 unsymlink,
79 unsymlink,
78 )
80 )
79
81
80 #-------------------------------------------------------------------------------
82 #-------------------------------------------------------------------------------
81 # Handle OS specific things
83 # Handle OS specific things
82 #-------------------------------------------------------------------------------
84 #-------------------------------------------------------------------------------
83
85
84 if os.name in ('nt','dos'):
86 if os.name in ('nt','dos'):
85 os_name = 'windows'
87 os_name = 'windows'
86 else:
88 else:
87 os_name = os.name
89 os_name = os.name
88
90
89 # Under Windows, 'sdist' has not been supported. Now that the docs build with
91 # Under Windows, 'sdist' has not been supported. Now that the docs build with
90 # Sphinx it might work, but let's not turn it on until someone confirms that it
92 # Sphinx it might work, but let's not turn it on until someone confirms that it
91 # actually works.
93 # actually works.
92 if os_name == 'windows' and 'sdist' in sys.argv:
94 if os_name == 'windows' and 'sdist' in sys.argv:
93 print('The sdist command is not available under Windows. Exiting.')
95 print('The sdist command is not available under Windows. Exiting.')
94 sys.exit(1)
96 sys.exit(1)
95
97
96
98
97 #-------------------------------------------------------------------------------
99 #-------------------------------------------------------------------------------
98 # Things related to the IPython documentation
100 # Things related to the IPython documentation
99 #-------------------------------------------------------------------------------
101 #-------------------------------------------------------------------------------
100
102
101 # update the manuals when building a source dist
103 # update the manuals when building a source dist
102 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
104 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
103
105
104 # List of things to be updated. Each entry is a triplet of args for
106 # List of things to be updated. Each entry is a triplet of args for
105 # target_update()
107 # target_update()
106 to_update = [
108 to_update = [
107 (
109 (
108 "docs/man/ipython.1.gz",
110 "docs/man/ipython.1.gz",
109 ["docs/man/ipython.1"],
111 ["docs/man/ipython.1"],
110 "cd docs/man && python -m gzip --best ipython.1",
112 "cd docs/man && python -m gzip --best ipython.1",
111 ),
113 ),
112 ]
114 ]
113
115
114
116
115 [ target_update(*t) for t in to_update ]
117 [ target_update(*t) for t in to_update ]
116
118
117 #---------------------------------------------------------------------------
119 #---------------------------------------------------------------------------
118 # Find all the packages, package data, and data_files
120 # Find all the packages, package data, and data_files
119 #---------------------------------------------------------------------------
121 #---------------------------------------------------------------------------
120
122
121 data_files = find_data_files()
123 data_files = find_data_files()
122
124
123 setup_args['data_files'] = data_files
125 setup_args['data_files'] = data_files
124
126
125 #---------------------------------------------------------------------------
127 #---------------------------------------------------------------------------
126 # custom distutils commands
128 # custom distutils commands
127 #---------------------------------------------------------------------------
129 #---------------------------------------------------------------------------
128 # imports here, so they are after setuptools import if there was one
130 # imports here, so they are after setuptools import if there was one
129 from setuptools.command.sdist import sdist
131 from setuptools.command.sdist import sdist
130
132
131 setup_args['cmdclass'] = {
133 setup_args['cmdclass'] = {
132 'build_py': \
134 'build_py': \
133 check_package_data_first(git_prebuild('IPython')),
135 check_package_data_first(git_prebuild('IPython')),
134 'sdist' : git_prebuild('IPython', sdist),
136 'sdist' : git_prebuild('IPython', sdist),
135 'symlink': install_symlinked,
137 'symlink': install_symlinked,
136 'install_lib_symlink': install_lib_symlink,
138 'install_lib_symlink': install_lib_symlink,
137 'install_scripts_sym': install_scripts_for_symlink,
139 'install_scripts_sym': install_scripts_for_symlink,
138 'unsymlink': unsymlink,
140 'unsymlink': unsymlink,
139 }
141 }
140
142
141 #---------------------------------------------------------------------------
143 #---------------------------------------------------------------------------
142 # Do the actual setup now
144 # Do the actual setup now
143 #---------------------------------------------------------------------------
145 #---------------------------------------------------------------------------
144
146
145 if __name__ == "__main__":
147 if __name__ == "__main__":
146 setup(**setup_args)
148 setup(**setup_args)
General Comments 0
You need to be logged in to leave comments. Login now