summaryrefslogtreecommitdiffstats
path: root/pre_commit
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-07 18:06:02 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-07 18:06:02 +0000
commit494d29bd88aa3c4a8ecddec28a92b161aa3dcb2e (patch)
treef94425366e1338631ded59b6d1280d67a8d167a3 /pre_commit
parentAdding upstream version 3.1.0. (diff)
downloadpre-commit-494d29bd88aa3c4a8ecddec28a92b161aa3dcb2e.tar.xz
pre-commit-494d29bd88aa3c4a8ecddec28a92b161aa3dcb2e.zip
Adding upstream version 3.1.1.upstream/3.1.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit')
-rw-r--r--pre_commit/languages/rust.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/pre_commit/languages/rust.py b/pre_commit/languages/rust.py
index e98e0d0..af5f483 100644
--- a/pre_commit/languages/rust.py
+++ b/pre_commit/languages/rust.py
@@ -142,10 +142,15 @@ def install_environment(
else:
packages_to_install.add((package,))
- with in_env(prefix, version):
+ with contextlib.ExitStack() as ctx:
+ ctx.enter_context(in_env(prefix, version))
+
if version != 'system':
install_rust_with_toolchain(_rust_toolchain(version))
+ tmpdir = ctx.enter_context(tempfile.TemporaryDirectory())
+ ctx.enter_context(envcontext((('RUSTUP_HOME', tmpdir),)))
+
if len(lib_deps) > 0:
_add_dependencies(prefix, lib_deps)