diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2022-02-06 11:20:38 -0500 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2022-02-06 13:38:30 -0500 |
| commit | ff3447a694f3b08dae8bd5268e64aa43f05a47a9 (patch) | |
| tree | be63ea0efbdd308ba976a3d9ab26e3e30c9f113f /setuptools | |
| parent | 988bf129164b8d46985c4d8b150086eedd95e37d (diff) | |
| download | python-setuptools-git-ff3447a694f3b08dae8bd5268e64aa43f05a47a9.tar.gz | |
Migrate remainder of 'iter_entry_points' to importlib_metadata.
Diffstat (limited to 'setuptools')
| -rw-r--r-- | setuptools/command/egg_info.py | 11 | ||||
| -rw-r--r-- | setuptools/command/sdist.py | 4 | ||||
| -rw-r--r-- | setuptools/command/upload_docs.py | 10 |
3 files changed, 14 insertions, 11 deletions
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 379f9398..d0e73002 100644 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -17,6 +17,8 @@ import warnings import time import collections +from .._importlib import metadata + from setuptools import Command from setuptools.command.sdist import sdist from setuptools.command.sdist import walk_revctrl @@ -24,7 +26,7 @@ from setuptools.command.setopt import edit_config from setuptools.command import bdist_egg from pkg_resources import ( Requirement, safe_name, parse_version, - safe_version, yield_lines, EntryPoint, iter_entry_points, to_filename) + safe_version, yield_lines, EntryPoint, to_filename) import setuptools.unicode_utils as unicode_utils from setuptools.glob import glob @@ -281,10 +283,9 @@ class egg_info(InfoCommon, Command): def run(self): self.mkpath(self.egg_info) os.utime(self.egg_info, None) - installer = self.distribution.fetch_build_egg - for ep in iter_entry_points('egg_info.writers'): - ep.require(installer=installer) - writer = ep.resolve() + for ep in metadata.entry_points(group='egg_info.writers'): + self.distribution._install_dependencies(ep) + writer = ep.load() writer(self, ep.name, os.path.join(self.egg_info, ep.name)) # Get rid of native_libs.txt if it was put there by older bdist_egg diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index 0285b690..0ffeacf3 100644 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -7,14 +7,14 @@ import contextlib from .py36compat import sdist_add_defaults -import pkg_resources +from .._importlib import metadata _default_revctrl = list def walk_revctrl(dirname=''): """Find all files under revision control""" - for ep in pkg_resources.iter_entry_points('setuptools.file_finders'): + for ep in metadata.entry_points(group='setuptools.file_finders'): for item in ep.load()(dirname): yield item diff --git a/setuptools/command/upload_docs.py b/setuptools/command/upload_docs.py index 845bff44..f429f568 100644 --- a/setuptools/command/upload_docs.py +++ b/setuptools/command/upload_docs.py @@ -18,7 +18,8 @@ import functools import http.client import urllib.parse -from pkg_resources import iter_entry_points +from .._importlib import metadata + from .upload import upload @@ -43,9 +44,10 @@ class upload_docs(upload): boolean_options = upload.boolean_options def has_sphinx(self): - if self.upload_dir is None: - for ep in iter_entry_points('distutils.commands', 'build_sphinx'): - return True + return bool( + self.upload_dir is None + and metadata.entry_points(group='distutils.commands', name='build_sphinx') + ) sub_commands = [('build_sphinx', has_sphinx)] |
