1
- import functools
2
1
import importlib .metadata
3
2
import logging
4
3
import os
12
11
13
12
from pip ._internal .metadata .base import BaseDistribution , BaseEnvironment
14
13
from pip ._internal .models .wheel import Wheel
15
- from pip ._internal .utils .deprecation import deprecated
16
14
from pip ._internal .utils .filetypes import WHEEL_EXTENSION
17
15
18
16
from ._compat import BadMetadata , BasePath , get_dist_name , get_info_location
@@ -131,29 +129,6 @@ def _find_eggs_in_zip(self, location: str) -> Iterator[BaseDistribution]:
131
129
for dist in find_eggs_in_zip (importer , location ):
132
130
yield legacy .Distribution (dist )
133
131
134
- def find_eggs (self , location : str ) -> Iterator [BaseDistribution ]:
135
- """Find eggs in a location.
136
-
137
- This actually uses the old *pkg_resources* backend. We likely want to
138
- deprecate this so we can eventually remove the *pkg_resources*
139
- dependency entirely. Before that, this should first emit a deprecation
140
- warning for some versions when using the fallback since importing
141
- *pkg_resources* is slow for those who don't need it.
142
- """
143
- if os .path .isdir (location ):
144
- yield from self ._find_eggs_in_dir (location )
145
- if zipfile .is_zipfile (location ):
146
- yield from self ._find_eggs_in_zip (location )
147
-
148
-
149
- @functools .lru_cache (maxsize = None ) # Warn a distribution exactly once.
150
- def _emit_egg_deprecation (location : Optional [str ]) -> None :
151
- deprecated (
152
- reason = f"Loading egg at { location } is deprecated." ,
153
- replacement = "to use pip for package installation." ,
154
- gone_in = "23.3" ,
155
- )
156
-
157
132
158
133
class Environment (BaseEnvironment ):
159
134
def __init__ (self , paths : Sequence [str ]) -> None :
@@ -173,9 +148,6 @@ def _iter_distributions(self) -> Iterator[BaseDistribution]:
173
148
finder = _DistributionFinder ()
174
149
for location in self ._paths :
175
150
yield from finder .find (location )
176
- for dist in finder .find_eggs (location ):
177
- _emit_egg_deprecation (dist .location )
178
- yield dist
179
151
# This must go last because that's how pkg_resources tie-breaks.
180
152
yield from finder .find_linked (location )
181
153
0 commit comments