mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Minor fixups
This commit is contained in:
parent
7c8272da77
commit
de2ead13a1
4 changed files with 12 additions and 7 deletions
|
|
@ -41,8 +41,8 @@ CONFIG_JSON_SCHEMA = {
|
||||||
},
|
},
|
||||||
'additional_dependencies': {
|
'additional_dependencies': {
|
||||||
'type': 'array',
|
'type': 'array',
|
||||||
'items': {'type': 'string'}
|
'items': {'type': 'string'},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
'required': ['id'],
|
'required': ['id'],
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,10 @@ MANIFEST_JSON_SCHEMA = {
|
||||||
'type': 'string',
|
'type': 'string',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
'additional_dependencies': {
|
||||||
|
'type': 'array',
|
||||||
|
'items': {'type': 'string'},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
'required': ['id', 'name', 'entry', 'language', 'files'],
|
'required': ['id', 'name', 'entry', 'language', 'files'],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,8 @@ class Repository(object):
|
||||||
dep_dict = defaultdict(lambda: defaultdict(set))
|
dep_dict = defaultdict(lambda: defaultdict(set))
|
||||||
for _, hook in self.hooks:
|
for _, hook in self.hooks:
|
||||||
dep_dict[hook['language']][hook['language_version']].update(
|
dep_dict[hook['language']][hook['language_version']].update(
|
||||||
hook.get('additional_dependencies', []))
|
hook.get('additional_dependencies', []),
|
||||||
|
)
|
||||||
return dep_dict
|
return dep_dict
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
|
|
@ -118,7 +119,8 @@ class Repository(object):
|
||||||
|
|
||||||
language.install_environment(
|
language.install_environment(
|
||||||
self.cmd_runner, language_version,
|
self.cmd_runner, language_version,
|
||||||
self.additional_dependencies[language_name][language_version])
|
self.additional_dependencies[language_name][language_version],
|
||||||
|
)
|
||||||
# Touch the .installed file (atomic) to indicate we've installed
|
# Touch the .installed file (atomic) to indicate we've installed
|
||||||
open(self.cmd_runner.path(directory, '.installed'), 'w').close()
|
open(self.cmd_runner.path(directory, '.installed'), 'w').close()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,6 @@ def mock_repo_config():
|
||||||
'hooks': [{
|
'hooks': [{
|
||||||
'id': 'pyflakes',
|
'id': 'pyflakes',
|
||||||
'files': '\\.py$',
|
'files': '\\.py$',
|
||||||
'additional_dependencies': ['pep8']
|
|
||||||
}],
|
}],
|
||||||
}
|
}
|
||||||
config_wrapped = apply_defaults([config], CONFIG_JSON_SCHEMA)
|
config_wrapped = apply_defaults([config], CONFIG_JSON_SCHEMA)
|
||||||
|
|
@ -345,12 +344,12 @@ def test_additional_python_dependencies_installed(tempdir_factory, store):
|
||||||
def test_additional_ruby_dependencies_installed(tempdir_factory, store):
|
def test_additional_ruby_dependencies_installed(tempdir_factory, store):
|
||||||
path = make_repo(tempdir_factory, 'ruby_hooks_repo')
|
path = make_repo(tempdir_factory, 'ruby_hooks_repo')
|
||||||
config = make_config_from_repo(path)
|
config = make_config_from_repo(path)
|
||||||
config['hooks'][0]['additional_dependencies'] = ['mime-types']
|
config['hooks'][0]['additional_dependencies'] = ['thread_safe']
|
||||||
repo = Repository.create(config, store)
|
repo = Repository.create(config, store)
|
||||||
repo.run_hook(repo.hooks[0][1], [])
|
repo.run_hook(repo.hooks[0][1], [])
|
||||||
with ruby.in_env(repo.cmd_runner, 'default') as env:
|
with ruby.in_env(repo.cmd_runner, 'default') as env:
|
||||||
output = env.run('gem list --local')[1]
|
output = env.run('gem list --local')[1]
|
||||||
assert 'mime-types' in output
|
assert 'thread_safe' in output
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.integration
|
@pytest.mark.integration
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue