summaryrefslogtreecommitdiffstats
path: root/pre_commit/repository.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2020-08-30 11:22:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2020-08-30 11:22:53 +0000
commit6cfa8e0963e9a518a25528a248932fcf41b4f969 (patch)
tree6882a2a7a3214ef85d7a946f2506e9ed2c3f60f5 /pre_commit/repository.py
parentAdding upstream version 2.6.0. (diff)
downloadpre-commit-6cfa8e0963e9a518a25528a248932fcf41b4f969.tar.xz
pre-commit-6cfa8e0963e9a518a25528a248932fcf41b4f969.zip
Adding upstream version 2.7.1.upstream/2.7.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--pre_commit/repository.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/pre_commit/repository.py b/pre_commit/repository.py
index 77734ee..46e96c1 100644
--- a/pre_commit/repository.py
+++ b/pre_commit/repository.py
@@ -48,7 +48,7 @@ def _write_state(prefix: Prefix, venv: str, state: object) -> None:
with open(staging, 'w') as state_file:
state_file.write(json.dumps(state))
# Move the file into place atomically to indicate we've installed
- os.rename(staging, state_filename)
+ os.replace(staging, state_filename)
def _hook_installed(hook: Hook) -> bool:
@@ -82,6 +82,12 @@ def _hook_install(hook: Hook) -> None:
lang.install_environment(
hook.prefix, hook.language_version, hook.additional_dependencies,
)
+ if not lang.healthy(hook.prefix, hook.language_version):
+ raise AssertionError(
+ f'BUG: expected environment for {hook.language} to be healthy() '
+ f'immediately after install, please open an issue describing '
+ f'your environment',
+ )
# Write our state to indicate we're installed
_write_state(hook.prefix, venv, _state(hook.additional_dependencies))