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

Method encode

pex/interpreter.py:469–509  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

467 self._free_threaded = free_threaded
468
469 def encode(self):
470 # type: () -> str
471 site_packages = [] # type: List[str]
472 purelib = None # type: Optional[str]
473 platlib = None # type: Optional[str]
474 for entry in self._site_packages:
475 entry_path = adjust_to_final_path(entry.path)
476 site_packages.append(entry_path)
477 if isinstance(entry, Purelib):
478 purelib = entry_path
479 elif isinstance(entry, Platlib):
480 platlib = entry_path
481
482 values = dict(
483 __format_version__=self._FORMAT_VERSION,
484 binary=adjust_to_final_path(self._binary),
485 prefix=adjust_to_final_path(self._prefix),
486 base_prefix=adjust_to_final_path(self._base_prefix),
487 sys_path=[adjust_to_final_path(entry) for entry in self._sys_path],
488 site_packages=site_packages,
489 # N.B.: We encode purelib and platlib site-packages entries on the side like this to
490 # ensure older Pex versions that did not know the distinction can still use the
491 # interpreter cache.
492 purelib=purelib,
493 platlib=platlib,
494 extras_paths=[adjust_to_final_path(extras_path) for extras_path in self._extras_paths],
495 paths={name: adjust_to_final_path(path) for name, path in self._paths.items()},
496 packaging_version=self._packaging_version,
497 python_tag=self._python_tag,
498 abi_tag=self._abi_tag,
499 platform_tag=self._platform_tag,
500 version=self._version,
501 pypy_version=self._pypy_version,
502 supported_tags=[
503 (tag.interpreter, tag.abi, tag.platform) for tag in self._supported_tags
504 ],
505 env_markers=self._env_markers.as_dict(),
506 configured_macosx_deployment_target=self._configured_macosx_deployment_target,
507 free_threaded=self._free_threaded,
508 )
509 return json.dumps(values, sort_keys=True, separators=(",", ":"))
510
511 @property
512 def binary(self):

Callers 15

validate_entry_pointFunction · 0.45
ensure_venvFunction · 0.45
parseMethod · 0.45
__init__Method · 0.45
to_bytesFunction · 0.45
idMethod · 0.45
venv_dirFunction · 0.45
extractallMethod · 0.45
install_wheelFunction · 0.45
write_bytesMethod · 0.45
_prepare_codeMethod · 0.45

Calls 3

adjust_to_final_pathFunction · 0.85
appendMethod · 0.80
as_dictMethod · 0.45

Tested by

no test coverage detected