MCPcopy
hub / github.com/pex-tool/pex / iter_distributions

Method iter_distributions

pex/environment.py:283–319  ·  view source on GitHub ↗
(self, result_type_wheel_file=False)

Source from the content-addressed store, hash-verified

281 return self._source_pex or self._pex
282
283 def iter_distributions(self, result_type_wheel_file=False):
284 # type: (bool) -> Iterator[FingerprintedDistribution]
285 if result_type_wheel_file and self._pex_info.deps_are_wheel_files:
286 with TRACER.timed(
287 "Searching dependency cache: {cache}".format(
288 cache=os.path.join(self.source_pex, self._pex_info.internal_cache)
289 ),
290 V=2,
291 ):
292 with identify_layout(self.source_pex) as layout:
293 for distribution_name, fingerprint in self._pex_info.distributions.items():
294 yield FingerprintedDistribution(
295 distribution=Distribution.load(
296 layout.wheel_file_path(
297 (self._pex_info.internal_cache, distribution_name)
298 )
299 ),
300 fingerprint=fingerprint,
301 )
302 else:
303 internal_cache = os.path.join(self._pex, self._pex_info.internal_cache)
304 with TRACER.timed(
305 "Searching dependency cache: {cache}".format(cache=internal_cache), V=2
306 ):
307 for distribution_name, fingerprint in self._pex_info.distributions.items():
308 dist_path = os.path.join(internal_cache, distribution_name)
309 if result_type_wheel_file:
310 yield repacked_whl(
311 installed_wheel=dist_path,
312 distribution_name=distribution_name,
313 fingerprint=fingerprint,
314 use_system_time=True,
315 )
316 else:
317 yield FingerprintedDistribution(
318 distribution=Distribution.load(dist_path), fingerprint=fingerprint
319 )
320
321 def _update_candidate_distributions(self, distribution_iter):
322 # type: (Iterable[FingerprintedDistribution]) -> None

Callers 1

resolve_distsMethod · 0.95

Calls 7

identify_layoutFunction · 0.90
repacked_whlFunction · 0.90
timedMethod · 0.80
joinMethod · 0.45
loadMethod · 0.45
wheel_file_pathMethod · 0.45

Tested by

no test coverage detected