mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Remove unnecessary files after installation
This commit is contained in:
parent
84ba1fd0c2
commit
51d673dff5
2 changed files with 9 additions and 7 deletions
|
|
@ -9,6 +9,7 @@ from pre_commit.envcontext import Var
|
||||||
from pre_commit.languages import helpers
|
from pre_commit.languages import helpers
|
||||||
from pre_commit.util import clean_path_on_failure
|
from pre_commit.util import clean_path_on_failure
|
||||||
from pre_commit.util import cmd_output
|
from pre_commit.util import cmd_output
|
||||||
|
from pre_commit.util import rmtree
|
||||||
from pre_commit.xargs import xargs
|
from pre_commit.xargs import xargs
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -66,6 +67,9 @@ def install_environment(
|
||||||
cmd_output('go', 'get', './...', cwd=repo_src_dir, env=env)
|
cmd_output('go', 'get', './...', cwd=repo_src_dir, env=env)
|
||||||
for dependency in additional_dependencies:
|
for dependency in additional_dependencies:
|
||||||
cmd_output('go', 'get', dependency, cwd=repo_src_dir, env=env)
|
cmd_output('go', 'get', dependency, cwd=repo_src_dir, env=env)
|
||||||
|
# Same some disk space, we don't need these after installation
|
||||||
|
rmtree(repo_cmd_runner.path(directory, 'src'))
|
||||||
|
rmtree(repo_cmd_runner.path(directory, 'pkg'))
|
||||||
|
|
||||||
|
|
||||||
def run_hook(repo_cmd_runner, hook, file_args):
|
def run_hook(repo_cmd_runner, hook, file_args):
|
||||||
|
|
|
||||||
|
|
@ -553,13 +553,11 @@ def test_additional_golang_dependencies_installed(
|
||||||
config['hooks'][0]['additional_dependencies'] = ['github.com/firba1/tpol']
|
config['hooks'][0]['additional_dependencies'] = ['github.com/firba1/tpol']
|
||||||
repo = Repository.create(config, store)
|
repo = Repository.create(config, store)
|
||||||
repo.require_installed()
|
repo.require_installed()
|
||||||
with golang.in_env(repo.cmd_runner):
|
binaries = os.listdir(repo.cmd_runner.path(
|
||||||
gopath = repo.cmd_runner.path(helpers.environment_dir(
|
helpers.environment_dir(golang.ENVIRONMENT_DIR, 'default'),
|
||||||
golang.ENVIRONMENT_DIR, 'default',
|
'bin',
|
||||||
))
|
))
|
||||||
env = dict(os.environ, GOPATH=gopath)
|
assert 'tpol' in binaries
|
||||||
output = cmd_output('go', 'list', '...', env=env)[1]
|
|
||||||
assert 'github.com/firba1/tpol' in output
|
|
||||||
|
|
||||||
|
|
||||||
def test_reinstall(tempdir_factory, store, log_info_mock):
|
def test_reinstall(tempdir_factory, store, log_info_mock):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue