File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed
src/pip/_internal/metadata Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -30,16 +30,19 @@ def _should_use_importlib_metadata() -> bool:
30
30
"""Whether to use the ``importlib.metadata`` or ``pkg_resources`` backend.
31
31
32
32
By default, pip uses ``importlib.metadata`` on Python 3.11+, and
33
- ``pkg_resourcess`` otherwise. This can be overridden by a couple of ways:
33
+ ``pkg_resourcess`` On Python <3.13. Up to Python 3.12, This can be
34
+ overridden by a couple of ways:
34
35
35
36
* If environment variable ``_PIP_USE_IMPORTLIB_METADATA`` is set, it
36
37
dictates whether ``importlib.metadata`` is used, regardless of Python
37
38
version.
38
- * On Python 3.11+, Python distributors can patch ``importlib.metadata``
39
- to add a global constant ``_PIP_USE_IMPORTLIB_METADATA = False``. This
40
- makes pip use ``pkg_resources`` (unless the user set the aforementioned
39
+ * On Python 3.11+, Python distributors can patch ``importlib.metadata`` to
40
+ add a global constant ``_PIP_USE_IMPORTLIB_METADATA = False``. This makes
41
+ pip use ``pkg_resources`` (unless the user set the aforementioned
41
42
environment variable to *True*).
42
43
"""
44
+ if sys .version_info >= (3 , 13 ):
45
+ return True
43
46
with contextlib .suppress (KeyError , ValueError ):
44
47
return bool (strtobool (os .environ ["_PIP_USE_IMPORTLIB_METADATA" ]))
45
48
if sys .version_info < (3 , 11 ):
Original file line number Diff line number Diff line change @@ -173,9 +173,10 @@ def _iter_distributions(self) -> Iterator[BaseDistribution]:
173
173
finder = _DistributionFinder ()
174
174
for location in self ._paths :
175
175
yield from finder .find (location )
176
- for dist in finder .find_eggs (location ):
177
- _emit_egg_deprecation (dist .location )
178
- yield dist
176
+ if sys .version_info < (3 , 13 ):
177
+ for dist in finder .find_eggs (location ):
178
+ _emit_egg_deprecation (dist .location )
179
+ yield dist
179
180
# This must go last because that's how pkg_resources tie-breaks.
180
181
yield from finder .find_linked (location )
181
182
Original file line number Diff line number Diff line change @@ -628,6 +628,10 @@ def test_uninstall_with_symlink(
628
628
assert symlink_target .stat ().st_mode == st_mode
629
629
630
630
631
+ @pytest .mark .skipif (
632
+ "sys.version_info >= (3, 13)" ,
633
+ reason = "Uninstall of .egg distributions not supported in Python 3.13+" ,
634
+ )
631
635
def test_uninstall_setuptools_develop_install (
632
636
script : PipTestEnvironment , data : TestData
633
637
) -> None :
You can’t perform that action at this time.
0 commit comments