Skip to content

Commit 7d0178e

Browse files
authored
Merge pull request #4493 from pypa/debt/4489-patched-dist
Remove _patched_dist
2 parents 5b5dc40 + c784432 commit 7d0178e

File tree

3 files changed

+1
-28
lines changed

3 files changed

+1
-28
lines changed

newsfragments/4489.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Removed lingering unused code around Distribution._patched_dist.

setuptools/command/egg_info.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -250,16 +250,6 @@ def finalize_options(self):
250250
#
251251
self.distribution.metadata.version = self.egg_version
252252

253-
# If we bootstrapped around the lack of a PKG-INFO, as might be the
254-
# case in a fresh checkout, make sure that any special tags get added
255-
# to the version info
256-
#
257-
pd = self.distribution._patched_dist
258-
if pd is not None and pd.key == self.egg_name.lower():
259-
pd._version = self.egg_version
260-
pd._parsed_version = packaging.version.Version(self.egg_version)
261-
self.distribution._patched_dist = None
262-
263253
def _get_egg_basename(self, py_version=PY_MAJOR, platform=None):
264254
"""Compute filename of the output egg. Private API."""
265255
return _egg_basename(self.egg_name, self.egg_version, py_version, platform)

setuptools/dist.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import os
77
import re
88
import sys
9-
from contextlib import suppress
109
from glob import iglob
1110
from pathlib import Path
1211
from typing import TYPE_CHECKING, MutableMapping
@@ -28,7 +27,6 @@
2827
from packaging.version import Version
2928

3029
from . import _entry_points
31-
from . import _normalization
3230
from . import _reqs
3331
from . import command as _ # noqa -- imported for side-effects
3432
from ._importlib import metadata
@@ -269,24 +267,9 @@ class Distribution(_Distribution):
269267
'extras_require': dict,
270268
}
271269

272-
_patched_dist = None
273270
# Used by build_py, editable_wheel and install_lib commands for legacy namespaces
274271
namespace_packages: list[str] #: :meta private: DEPRECATED
275272

276-
def patch_missing_pkg_info(self, attrs):
277-
# Fake up a replacement for the data that would normally come from
278-
# PKG-INFO, but which might not yet be built if this is a fresh
279-
# checkout.
280-
#
281-
if not attrs or 'name' not in attrs or 'version' not in attrs:
282-
return
283-
name = _normalization.safe_name(str(attrs['name'])).lower()
284-
with suppress(metadata.PackageNotFoundError):
285-
dist = metadata.distribution(name)
286-
if dist is not None and not dist.read_text('PKG-INFO'):
287-
dist._version = _normalization.safe_version(str(attrs['version']))
288-
self._patched_dist = dist
289-
290273
def __init__(self, attrs: MutableMapping | None = None) -> None:
291274
have_package_data = hasattr(self, "package_data")
292275
if not have_package_data:
@@ -295,7 +278,6 @@ def __init__(self, attrs: MutableMapping | None = None) -> None:
295278
self.dist_files: list[tuple[str, str, str]] = []
296279
# Filter-out setuptools' specific options.
297280
self.src_root = attrs.pop("src_root", None)
298-
self.patch_missing_pkg_info(attrs)
299281
self.dependency_links = attrs.pop('dependency_links', [])
300282
self.setup_requires = attrs.pop('setup_requires', [])
301283
for ep in metadata.entry_points(group='distutils.setup_keywords'):

0 commit comments

Comments
 (0)