| 22 | |
| 23 | |
| 24 | def 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 |