mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-14 04:50:20 -06:00
44 lines
1013 B
Python
44 lines
1013 B
Python
from __future__ import unicode_literals
|
|
|
|
import shlex
|
|
|
|
from pre_commit.util import cmd_output
|
|
|
|
|
|
def run_setup_cmd(runner, cmd):
|
|
cmd_output(*cmd, cwd=runner.prefix_dir, encoding=None)
|
|
|
|
|
|
def environment_dir(ENVIRONMENT_DIR, language_version):
|
|
if ENVIRONMENT_DIR is None:
|
|
return None
|
|
else:
|
|
return '{}-{}'.format(ENVIRONMENT_DIR, language_version)
|
|
|
|
|
|
def to_cmd(hook):
|
|
return tuple(shlex.split(hook['entry'])) + tuple(hook['args'])
|
|
|
|
|
|
def assert_version_default(binary, version):
|
|
if version != 'default':
|
|
raise AssertionError(
|
|
'For now, pre-commit requires system-installed {}'.format(binary),
|
|
)
|
|
|
|
|
|
def assert_no_additional_deps(lang, additional_deps):
|
|
if additional_deps:
|
|
raise AssertionError(
|
|
'For now, pre-commit does not support '
|
|
'additional_dependencies for {}'.format(lang),
|
|
)
|
|
|
|
|
|
def basic_get_default_version():
|
|
return 'default'
|
|
|
|
|
|
def basic_healthy(repo_cmd_runner, language_version):
|
|
return True
|