2025-02-09 21:33:11 +01:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2025-02-09 21:10:22 +01:00
|
|
|
from typing import Sequence
|
|
|
|
|
|
|
|
from pre_commit.languages import helpers
|
|
|
|
from pre_commit.languages.docker import docker_cmd
|
2025-02-09 21:36:17 +01:00
|
|
|
from pre_commit.prefix import Prefix
|
2025-02-09 21:10:22 +01:00
|
|
|
|
|
|
|
ENVIRONMENT_DIR = None
|
|
|
|
get_default_version = helpers.basic_get_default_version
|
2025-02-09 21:33:50 +01:00
|
|
|
health_check = helpers.basic_health_check
|
2025-02-09 21:10:22 +01:00
|
|
|
install_environment = helpers.no_install
|
2025-02-09 21:36:17 +01:00
|
|
|
in_env = helpers.no_env
|
2025-02-09 21:10:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
def run_hook(
|
2025-02-09 21:36:17 +01:00
|
|
|
prefix: Prefix,
|
|
|
|
entry: str,
|
|
|
|
args: Sequence[str],
|
2025-02-09 21:10:22 +01:00
|
|
|
file_args: Sequence[str],
|
2025-02-09 21:36:17 +01:00
|
|
|
*,
|
|
|
|
is_local: bool,
|
|
|
|
require_serial: bool,
|
2025-02-09 21:10:22 +01:00
|
|
|
color: bool,
|
2025-02-09 21:33:11 +01:00
|
|
|
) -> tuple[int, bytes]: # pragma: win32 no cover
|
2025-02-09 21:36:17 +01:00
|
|
|
cmd = docker_cmd() + helpers.hook_cmd(entry, args)
|
|
|
|
return helpers.run_xargs(
|
|
|
|
cmd,
|
|
|
|
file_args,
|
|
|
|
require_serial=require_serial,
|
|
|
|
color=color,
|
|
|
|
)
|