summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2021-05-21 17:08:16 -0400
committerGitHub <noreply@github.com>2021-05-21 17:08:16 -0400
commitc6a761fd4dd86283f25d828c7b9b56d764dcf84b (patch)
tree4729032ad87d53eda6960e20748435894a258194
parent57002305daec1d31622927c0aea0d4e7df79ec40 (diff)
parent1023e656f94124753e913bc070d82710a804b751 (diff)
downloadpython-setuptools-git-c6a761fd4dd86283f25d828c7b9b56d764dcf84b.tar.gz
Merge pull request #2678 from pypa/feature/static-commands
Move distutils command names into package metadata and declare entry points using static config.
-rw-r--r--changelog.d/2678.change.rst1
-rw-r--r--setup.cfg56
-rwxr-xr-xsetup.py57
-rw-r--r--setuptools/command/__init__.py9
-rw-r--r--setuptools/dist.py10
5 files changed, 66 insertions, 67 deletions
diff --git a/changelog.d/2678.change.rst b/changelog.d/2678.change.rst
new file mode 100644
index 00000000..529c58ad
--- /dev/null
+++ b/changelog.d/2678.change.rst
@@ -0,0 +1 @@
+Moved Setuptools' own entry points into declarative config.
diff --git a/setup.cfg b/setup.cfg
index 2ecba4b3..417026db 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -84,6 +84,62 @@ certs =
certifi==2016.9.26
[options.entry_points]
+distutils.commands =
+ alias = setuptools.command.alias:alias
+ bdist_egg = setuptools.command.bdist_egg:bdist_egg
+ bdist_rpm = setuptools.command.bdist_rpm:bdist_rpm
+ build_clib = setuptools.command.build_clib:build_clib
+ build_ext = setuptools.command.build_ext:build_ext
+ build_py = setuptools.command.build_py:build_py
+ develop = setuptools.command.develop:develop
+ dist_info = setuptools.command.dist_info:dist_info
+ easy_install = setuptools.command.easy_install:easy_install
+ egg_info = setuptools.command.egg_info:egg_info
+ install = setuptools.command.install:install
+ install_egg_info = setuptools.command.install_egg_info:install_egg_info
+ install_lib = setuptools.command.install_lib:install_lib
+ install_scripts = setuptools.command.install_scripts:install_scripts
+ rotate = setuptools.command.rotate:rotate
+ saveopts = setuptools.command.saveopts:saveopts
+ sdist = setuptools.command.sdist:sdist
+ setopt = setuptools.command.setopt:setopt
+ test = setuptools.command.test:test
+ upload_docs = setuptools.command.upload_docs:upload_docs
+setuptools.finalize_distribution_options =
+ parent_finalize = setuptools.dist:_Distribution.finalize_options
+ keywords = setuptools.dist:Distribution._finalize_setup_keywords
+ 2to3_doctests = setuptools.dist:Distribution._finalize_2to3_doctests
+distutils.setup_keywords =
+ eager_resources = setuptools.dist:assert_string_list
+ namespace_packages = setuptools.dist:check_nsp
+ extras_require = setuptools.dist:check_extras
+ install_requires = setuptools.dist:check_requirements
+ tests_require = setuptools.dist:check_requirements
+ setup_requires = setuptools.dist:check_requirements
+ python_requires = setuptools.dist:check_specifier
+ entry_points = setuptools.dist:check_entry_points
+ test_suite = setuptools.dist:check_test_suite
+ zip_safe = setuptools.dist:assert_bool
+ package_data = setuptools.dist:check_package_data
+ exclude_package_data = setuptools.dist:check_package_data
+ include_package_data = setuptools.dist:assert_bool
+ packages = setuptools.dist:check_packages
+ dependency_links = setuptools.dist:assert_string_list
+ test_loader = setuptools.dist:check_importable
+ test_runner = setuptools.dist:check_importable
+ use_2to3 = setuptools.dist:assert_bool
+ convert_2to3_doctests = setuptools.dist:assert_string_list
+ use_2to3_fixers = setuptools.dist:assert_string_list
+ use_2to3_exclude_fixers = setuptools.dist:assert_string_list
+egg_info.writers =
+ PKG-INFO = setuptools.command.egg_info:write_pkg_info
+ requires.txt = setuptools.command.egg_info:write_requirements
+ entry_points.txt = setuptools.command.egg_info:write_entries
+ eager_resources.txt = setuptools.command.egg_info:overwrite_arg
+ namespace_packages.txt = setuptools.command.egg_info:overwrite_arg
+ top_level.txt = setuptools.command.egg_info:write_toplevel_names
+ depends.txt = setuptools.command.egg_info:warn_depends_obsolete
+ dependency_links.txt = setuptools.command.egg_info:overwrite_arg
[egg_info]
tag_build = .post
diff --git a/setup.py b/setup.py
index f5cbff31..dded6c7a 100755
--- a/setup.py
+++ b/setup.py
@@ -10,15 +10,6 @@ from setuptools.command.install import install
here = os.path.dirname(__file__)
-def read_commands():
- command_ns = {}
- cmd_module_path = 'setuptools/command/__init__.py'
- init_path = os.path.join(here, cmd_module_path)
- with open(init_path) as init_file:
- exec(init_file.read(), command_ns)
- return command_ns['__all__']
-
-
package_data = dict(
setuptools=['script (dev).tmpl', 'script.tmpl', 'site-patch.py'],
)
@@ -96,54 +87,6 @@ setup_params = dict(
src_root=None,
cmdclass={'install': install_with_pth},
package_data=package_data,
- entry_points={
- "distutils.commands": [
- "%(cmd)s = setuptools.command.%(cmd)s:%(cmd)s" % locals()
- for cmd in read_commands()
- ],
- "setuptools.finalize_distribution_options": [
- "parent_finalize = setuptools.dist:_Distribution.finalize_options",
- "keywords = setuptools.dist:Distribution._finalize_setup_keywords",
- "2to3_doctests = "
- "setuptools.dist:Distribution._finalize_2to3_doctests",
- ],
- "distutils.setup_keywords": [
- "eager_resources = setuptools.dist:assert_string_list",
- "namespace_packages = setuptools.dist:check_nsp",
- "extras_require = setuptools.dist:check_extras",
- "install_requires = setuptools.dist:check_requirements",
- "tests_require = setuptools.dist:check_requirements",
- "setup_requires = setuptools.dist:check_requirements",
- "python_requires = setuptools.dist:check_specifier",
- "entry_points = setuptools.dist:check_entry_points",
- "test_suite = setuptools.dist:check_test_suite",
- "zip_safe = setuptools.dist:assert_bool",
- "package_data = setuptools.dist:check_package_data",
- "exclude_package_data = setuptools.dist:check_package_data",
- "include_package_data = setuptools.dist:assert_bool",
- "packages = setuptools.dist:check_packages",
- "dependency_links = setuptools.dist:assert_string_list",
- "test_loader = setuptools.dist:check_importable",
- "test_runner = setuptools.dist:check_importable",
- "use_2to3 = setuptools.dist:assert_bool",
- "convert_2to3_doctests = setuptools.dist:assert_string_list",
- "use_2to3_fixers = setuptools.dist:assert_string_list",
- "use_2to3_exclude_fixers = setuptools.dist:assert_string_list",
- ],
- "egg_info.writers": [
- "PKG-INFO = setuptools.command.egg_info:write_pkg_info",
- "requires.txt = setuptools.command.egg_info:write_requirements",
- "entry_points.txt = setuptools.command.egg_info:write_entries",
- "eager_resources.txt = setuptools.command.egg_info:overwrite_arg",
- (
- "namespace_packages.txt = "
- "setuptools.command.egg_info:overwrite_arg"
- ),
- "top_level.txt = setuptools.command.egg_info:write_toplevel_names",
- "depends.txt = setuptools.command.egg_info:warn_depends_obsolete",
- "dependency_links.txt = setuptools.command.egg_info:overwrite_arg",
- ],
- },
dependency_links=[
pypi_link(
'certifi-2016.9.26.tar.gz#md5=baa81e951a29958563689d868ef1064d',
diff --git a/setuptools/command/__init__.py b/setuptools/command/__init__.py
index 570e6957..b966dcea 100644
--- a/setuptools/command/__init__.py
+++ b/setuptools/command/__init__.py
@@ -1,15 +1,6 @@
-__all__ = [
- 'alias', 'bdist_egg', 'bdist_rpm', 'build_ext', 'build_py', 'develop',
- 'easy_install', 'egg_info', 'install', 'install_lib', 'rotate', 'saveopts',
- 'sdist', 'setopt', 'test', 'install_egg_info', 'install_scripts',
- 'upload_docs', 'build_clib', 'dist_info',
-]
-
from distutils.command.bdist import bdist
import sys
-from setuptools.command import install_scripts
-
if 'egg' not in bdist.format_commands:
bdist.format_command['egg'] = ('bdist_egg', "Python .egg file")
bdist.format_commands.append('egg')
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 96c82409..a1b7e832 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -639,7 +639,7 @@ class Distribution(_Distribution):
return opt
underscore_opt = opt.replace('-', '_')
- commands = distutils.command.__all__ + setuptools.command.__all__
+ commands = distutils.command.__all__ + self._setuptools_commands()
if (not section.startswith('options') and section != 'metadata'
and section not in commands):
return underscore_opt
@@ -651,6 +651,14 @@ class Distribution(_Distribution):
% (opt, underscore_opt))
return underscore_opt
+ def _setuptools_commands(self):
+ try:
+ dist = pkg_resources.get_distribution('setuptools')
+ return list(dist.get_entry_map('distutils.commands'))
+ except pkg_resources.DistributionNotFound:
+ # during bootstrapping, distribution doesn't exist
+ return []
+
def make_option_lowercase(self, opt, section):
if section != 'metadata' or opt.islower():
return opt