##// END OF EJS Templates
Only use setuptools, avoid distutils as much as possible
James Morris -
Show More
@@ -19,7 +19,6 b' requires utilities which are not available under Windows."""'
19
19
20 import os
20 import os
21 import sys
21 import sys
22 from pathlib import Path
23
22
24 # **Python version check**
23 # **Python version check**
25 #
24 #
@@ -61,12 +60,7 b' Python {py} detected.'
61
60
62 # At least we're on the python version we need, move on.
61 # At least we're on the python version we need, move on.
63
62
64 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
63 from setuptools import setup
65 # update it when the contents of directories change.
66 if Path("MANIFEST").exists():
67 Path("MANIFEST").unlink()
68
69 from distutils.core import setup
70
64
71 # Our own imports
65 # Our own imports
72 from setupbase import target_update
66 from setupbase import target_update
@@ -137,7 +131,7 b" setup_args['data_files'] = data_files"
137 # custom distutils commands
131 # custom distutils commands
138 #---------------------------------------------------------------------------
132 #---------------------------------------------------------------------------
139 # imports here, so they are after setuptools import if there was one
133 # imports here, so they are after setuptools import if there was one
140 from distutils.command.sdist import sdist
134 from setuptools.command.sdist import sdist
141
135
142 setup_args['cmdclass'] = {
136 setup_args['cmdclass'] = {
143 'build_py': \
137 'build_py': \
@@ -154,16 +148,6 b" setup_args['cmdclass'] = {"
154 # Handle scripts, dependencies, and setuptools specific things
148 # Handle scripts, dependencies, and setuptools specific things
155 #---------------------------------------------------------------------------
149 #---------------------------------------------------------------------------
156
150
157 # For some commands, use setuptools. Note that we do NOT list install here!
158 # If you want a setuptools-enhanced install, just run 'setupegg.py install'
159 needs_setuptools = {'develop', 'release', 'bdist_egg', 'bdist_rpm',
160 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel',
161 'egg_info', 'easy_install', 'upload', 'install_egg_info',
162 }
163
164 if len(needs_setuptools.intersection(sys.argv)) > 0:
165 import setuptools
166
167 # This dict is used for passing extra arguments that are setuptools
151 # This dict is used for passing extra arguments that are setuptools
168 # specific to setup
152 # specific to setup
169 setuptools_extra_args = {}
153 setuptools_extra_args = {}
@@ -244,25 +228,18 b' for key, deps in extras_require.items():'
244 everything.update(deps)
228 everything.update(deps)
245 extras_require['all'] = list(sorted(everything))
229 extras_require['all'] = list(sorted(everything))
246
230
247 if "setuptools" in sys.modules:
231 setuptools_extra_args["python_requires"] = ">=3.8"
248 setuptools_extra_args["python_requires"] = ">=3.8"
232 setuptools_extra_args["zip_safe"] = False
249 setuptools_extra_args["zip_safe"] = False
233 setuptools_extra_args["entry_points"] = {
250 setuptools_extra_args["entry_points"] = {
234 "console_scripts": find_entry_points(),
251 "console_scripts": find_entry_points(),
235 "pygments.lexers": [
252 "pygments.lexers": [
236 "ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer",
253 "ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer",
237 "ipython = IPython.lib.lexers:IPythonLexer",
254 "ipython = IPython.lib.lexers:IPythonLexer",
238 "ipython3 = IPython.lib.lexers:IPython3Lexer",
255 "ipython3 = IPython.lib.lexers:IPython3Lexer",
239 ],
256 ],
240 }
257 }
241 setup_args["extras_require"] = extras_require
258 setup_args['extras_require'] = extras_require
242 setup_args["install_requires"] = install_requires
259 setup_args['install_requires'] = install_requires
260
261 else:
262 # scripts has to be a non-empty list, or install_scripts isn't called
263 setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()]
264
265 setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt
266
243
267 #---------------------------------------------------------------------------
244 #---------------------------------------------------------------------------
268 # Do the actual setup now
245 # Do the actual setup now
General Comments 0
You need to be logged in to leave comments. Login now