Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/4489.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed lingering unused code around Distribution._patched_dist.
10 changes: 0 additions & 10 deletions setuptools/command/egg_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 0 additions & 18 deletions setuptools/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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'):
Expand Down