mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
simplify environment_dir
This commit is contained in:
parent
10f835c501
commit
05c8911363
17 changed files with 77 additions and 103 deletions
|
|
@ -18,11 +18,6 @@ get_default_version = helpers.basic_get_default_version
|
|||
health_check = helpers.basic_health_check
|
||||
|
||||
|
||||
def _envdir(prefix: Prefix, version: str) -> str:
|
||||
directory = helpers.environment_dir(ENVIRONMENT_DIR, version)
|
||||
return prefix.path(directory)
|
||||
|
||||
|
||||
def get_env_patch(venv: str) -> PatchesT:
|
||||
return (
|
||||
('PATH', (os.path.join(venv, 'bin'), os.pathsep, Var('PATH'))),
|
||||
|
|
@ -42,7 +37,8 @@ def in_env(
|
|||
prefix: Prefix,
|
||||
language_version: str,
|
||||
) -> Generator[None, None, None]:
|
||||
with envcontext(get_env_patch(_envdir(prefix, language_version))):
|
||||
envdir = helpers.environment_dir(prefix, ENVIRONMENT_DIR, language_version)
|
||||
with envcontext(get_env_patch(envdir)):
|
||||
yield
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue