From 494d29bd88aa3c4a8ecddec28a92b161aa3dcb2e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 7 Mar 2023 19:06:02 +0100 Subject: Adding upstream version 3.1.1. Signed-off-by: Daniel Baumann --- pre_commit/languages/rust.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'pre_commit/languages/rust.py') 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) -- cgit v1.2.3