Merging upstream version 3.1.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
f7ee0eb8fc
commit
c4c52947de
88 changed files with 1083 additions and 974 deletions
|
@ -9,18 +9,18 @@ import zipfile
|
|||
from typing import Generator
|
||||
from typing import Sequence
|
||||
|
||||
from pre_commit import lang_base
|
||||
from pre_commit.envcontext import envcontext
|
||||
from pre_commit.envcontext import PatchesT
|
||||
from pre_commit.envcontext import Var
|
||||
from pre_commit.languages import helpers
|
||||
from pre_commit.prefix import Prefix
|
||||
|
||||
ENVIRONMENT_DIR = 'dotnetenv'
|
||||
BIN_DIR = 'bin'
|
||||
|
||||
get_default_version = helpers.basic_get_default_version
|
||||
health_check = helpers.basic_health_check
|
||||
run_hook = helpers.basic_run_hook
|
||||
get_default_version = lang_base.basic_get_default_version
|
||||
health_check = lang_base.basic_health_check
|
||||
run_hook = lang_base.basic_run_hook
|
||||
|
||||
|
||||
def get_env_patch(venv: str) -> PatchesT:
|
||||
|
@ -31,7 +31,7 @@ def get_env_patch(venv: str) -> PatchesT:
|
|||
|
||||
@contextlib.contextmanager
|
||||
def in_env(prefix: Prefix, version: str) -> Generator[None, None, None]:
|
||||
envdir = helpers.environment_dir(prefix, ENVIRONMENT_DIR, version)
|
||||
envdir = lang_base.environment_dir(prefix, ENVIRONMENT_DIR, version)
|
||||
with envcontext(get_env_patch(envdir)):
|
||||
yield
|
||||
|
||||
|
@ -57,19 +57,19 @@ def install_environment(
|
|||
version: str,
|
||||
additional_dependencies: Sequence[str],
|
||||
) -> None:
|
||||
helpers.assert_version_default('dotnet', version)
|
||||
helpers.assert_no_additional_deps('dotnet', additional_dependencies)
|
||||
lang_base.assert_version_default('dotnet', version)
|
||||
lang_base.assert_no_additional_deps('dotnet', additional_dependencies)
|
||||
|
||||
envdir = helpers.environment_dir(prefix, ENVIRONMENT_DIR, version)
|
||||
build_dir = 'pre-commit-build'
|
||||
envdir = lang_base.environment_dir(prefix, ENVIRONMENT_DIR, version)
|
||||
build_dir = prefix.path('pre-commit-build')
|
||||
|
||||
# Build & pack nupkg file
|
||||
helpers.run_setup_cmd(
|
||||
lang_base.setup_cmd(
|
||||
prefix,
|
||||
(
|
||||
'dotnet', 'pack',
|
||||
'--configuration', 'Release',
|
||||
'--output', build_dir,
|
||||
'--property', f'PackageOutputPath={build_dir}',
|
||||
),
|
||||
)
|
||||
|
||||
|
@ -99,7 +99,7 @@ def install_environment(
|
|||
|
||||
# Install to bin dir
|
||||
with _nuget_config_no_sources() as nuget_config:
|
||||
helpers.run_setup_cmd(
|
||||
lang_base.setup_cmd(
|
||||
prefix,
|
||||
(
|
||||
'dotnet', 'tool', 'install',
|
||||
|
@ -109,7 +109,3 @@ def install_environment(
|
|||
tool_id,
|
||||
),
|
||||
)
|
||||
|
||||
# Clean the git dir, ignoring the environment dir
|
||||
clean_cmd = ('git', 'clean', '-ffxd', '-e', f'{ENVIRONMENT_DIR}-*')
|
||||
helpers.run_setup_cmd(prefix, clean_cmd)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue