summaryrefslogtreecommitdiffstats
path: root/pre_commit/languages
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-07 18:06:06 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-07 18:06:06 +0000
commit59c0d333517337095002921e9748e50138eb2d20 (patch)
tree21a2224fd490a200ed6b71bf993c745d0d27ebdf /pre_commit/languages
parentReleasing debian version 3.1.0-1. (diff)
downloadpre-commit-59c0d333517337095002921e9748e50138eb2d20.tar.xz
pre-commit-59c0d333517337095002921e9748e50138eb2d20.zip
Merging upstream version 3.1.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit/languages')
-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)