MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / get_env_patch

Function get_env_patch

pre_commit/languages/conda.py:24–40  ·  view source on GitHub ↗
(env: str)

Source from the content-addressed store, hash-verified

22
23
24def get_env_patch(env: str) -> PatchesT:
25 # On non-windows systems executable live in $CONDA_PREFIX/bin, on Windows
26 # they can be in $CONDA_PREFIX/bin, $CONDA_PREFIX/Library/bin,
27 # $CONDA_PREFIX/Scripts and $CONDA_PREFIX. Whereas the latter only
28 # seems to be used for python.exe.
29 path: SubstitutionT = (os.path.join(env, 'bin'), os.pathsep, Var('PATH'))
30 if sys.platform == 'win32': # pragma: win32 cover
31 path = (env, os.pathsep, *path)
32 path = (os.path.join(env, 'Scripts'), os.pathsep, *path)
33 path = (os.path.join(env, 'Library', 'bin'), os.pathsep, *path)
34
35 return (
36 ('PYTHONHOME', UNSET),
37 ('VIRTUAL_ENV', UNSET),
38 ('CONDA_PREFIX', env),
39 ('PATH', path),
40 )
41
42
43@contextlib.contextmanager

Callers 1

in_envFunction · 0.70

Calls 1

VarClass · 0.90

Tested by

no test coverage detected