diff --git a/newsfragments/4489.bugfix.rst b/newsfragments/4489.bugfix.rst new file mode 100644 index 0000000000..3f11d73393 --- /dev/null +++ b/newsfragments/4489.bugfix.rst @@ -0,0 +1 @@ +Removed lingering unused code around Distribution._patched_dist. \ No newline at end of file diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index fd9b54a411..30b62f5f2e 100644 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -250,16 +250,6 @@ def finalize_options(self): # self.distribution.metadata.version = self.egg_version - # If we bootstrapped around the lack of a PKG-INFO, as might be the - # case in a fresh checkout, make sure that any special tags get added - # to the version info - # - pd = self.distribution._patched_dist - if pd is not None and pd.key == self.egg_name.lower(): - pd._version = self.egg_version - pd._parsed_version = packaging.version.Version(self.egg_version) - self.distribution._patched_dist = None - def _get_egg_basename(self, py_version=PY_MAJOR, platform=None): """Compute filename of the output egg. Private API.""" return _egg_basename(self.egg_name, self.egg_version, py_version, platform) diff --git a/setuptools/dist.py b/setuptools/dist.py index bcab50ba65..b4496ab986 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -6,7 +6,6 @@ import os import re import sys -from contextlib import suppress from glob import iglob from pathlib import Path from typing import TYPE_CHECKING, MutableMapping @@ -28,7 +27,6 @@ from packaging.version import Version from . import _entry_points -from . import _normalization from . import _reqs from . import command as _ # noqa -- imported for side-effects from ._importlib import metadata @@ -269,24 +267,9 @@ class Distribution(_Distribution): 'extras_require': dict, } - _patched_dist = None # Used by build_py, editable_wheel and install_lib commands for legacy namespaces namespace_packages: list[str] #: :meta private: DEPRECATED - def patch_missing_pkg_info(self, attrs): - # Fake up a replacement for the data that would normally come from - # PKG-INFO, but which might not yet be built if this is a fresh - # checkout. - # - if not attrs or 'name' not in attrs or 'version' not in attrs: - return - name = _normalization.safe_name(str(attrs['name'])).lower() - with suppress(metadata.PackageNotFoundError): - dist = metadata.distribution(name) - if dist is not None and not dist.read_text('PKG-INFO'): - dist._version = _normalization.safe_version(str(attrs['version'])) - self._patched_dist = dist - def __init__(self, attrs: MutableMapping | None = None) -> None: have_package_data = hasattr(self, "package_data") if not have_package_data: @@ -295,7 +278,6 @@ def __init__(self, attrs: MutableMapping | None = None) -> None: self.dist_files: list[tuple[str, str, str]] = [] # Filter-out setuptools' specific options. self.src_root = attrs.pop("src_root", None) - self.patch_missing_pkg_info(attrs) self.dependency_links = attrs.pop('dependency_links', []) self.setup_requires = attrs.pop('setup_requires', []) for ep in metadata.entry_points(group='distutils.setup_keywords'):