MCPcopy Index your code
hub / github.com/pex-tool/pex / PyenvPythonDistribution

Class PyenvPythonDistribution

testing/__init__.py:697–725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

695
696@attr.s(frozen=True)
697class PyenvPythonDistribution(PythonDistribution):
698 pyenv_root = attr.ib() # type: str
699 _pyenv_script = attr.ib() # type: str
700
701 def pyenv_env(self, **extra_env):
702 # type: (**str) -> Dict[str, str]
703 env = os.environ.copy()
704 env.update(extra_env)
705 env["PYENV_ROOT"] = self.pyenv_root
706 env["PATH"] = os.pathsep.join(
707 [os.path.join(self.pyenv_root, path) for path in ("bin", "shims")]
708 + os.getenv("PATH", os.defpath).split(os.pathsep)
709 )
710 return env
711
712 def run_pyenv(
713 self,
714 args, # type: Iterable[str]
715 **popen_kwargs # type: Any
716 ):
717 # type: (...) -> Text
718 return cast(
719 "Text",
720 subprocess.check_output(
721 args=[self._pyenv_script] + list(args),
722 env=self.pyenv_env(**popen_kwargs.pop("env", {})),
723 **popen_kwargs
724 ).decode("utf-8"),
725 )
726
727
728def ensure_python_distribution(

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…