From 548e9a107969cd423515b478f0369a679087e4cf Mon Sep 17 00:00:00 2001 From: j178 <10510431+j178@users.noreply.github.com> Date: Sun, 8 Dec 2024 14:15:15 +0800 Subject: [PATCH] Disable uv cache on Windows --- .config/nextest.toml | 10 ---------- Cargo.lock | 7 ------- Cargo.toml | 2 +- src/languages/python/impl.rs | 16 +++++++++++++--- 4 files changed, 14 insertions(+), 21 deletions(-) delete mode 100644 .config/nextest.toml diff --git a/.config/nextest.toml b/.config/nextest.toml deleted file mode 100644 index e115d0e..0000000 --- a/.config/nextest.toml +++ /dev/null @@ -1,10 +0,0 @@ -[test-groups] -uv = { max-threads = 1} - -# On Windows, concurrent uv runs may fail by `Access Denied` errors -# due to concurrent uv cache writes. -# Configure these tests to run sequentially. -[[profile.default.overrides]] -filter = 'binary(run) and test(/run_basic|same_repo|local_need_install/)' -platform = 'cfg(windows)' -test-group = 'uv' diff --git a/Cargo.lock b/Cargo.lock index f5728aa..1829601 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1089,7 +1089,6 @@ dependencies = [ "console", "number_prefix", "portable-atomic", - "unicode-segmentation", "unicode-width 0.2.0", "web-time", ] @@ -2372,12 +2371,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" -[[package]] -name = "unicode-segmentation" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" - [[package]] name = "unicode-width" version = "0.1.14" diff --git a/Cargo.toml b/Cargo.toml index e9590f5..bb00347 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ fs2 = "0.4.3" futures = "0.3.31" home = "0.5.9" http = "1.1.0" -indicatif = { version = "0.17.8", features = ["improved_unicode"] } +indicatif = "0.17.8" indoc = "2.0.5" itertools = "0.13.0" md5 = "0.7.0" diff --git a/src/languages/python/impl.rs b/src/languages/python/impl.rs index 759558e..9ed93ad 100644 --- a/src/languages/python/impl.rs +++ b/src/languages/python/impl.rs @@ -27,9 +27,19 @@ impl LanguageImpl for Python { let uv = ensure_uv().await?; - // Set uv cache dir? tools dir? python dir? + let uv_cmd = |summary| { + #[allow(unused_mut)] + let mut cmd = Cmd::new(&uv, summary); + // Don't use cache in Windows, multiple uv instances will conflict with each other. + // See https://github.com/astral-sh/uv/issues/8664 + #[cfg(windows)] + cmd.env("UV_NO_CACHE", "1"); + cmd + }; + + // TODO: Set uv cache dir? tools dir? python dir? // Create venv - Cmd::new(&uv, "create venv") + uv_cmd("create venv") .arg("venv") .arg(&venv) .arg("--python") @@ -41,7 +51,7 @@ impl LanguageImpl for Python { patch_cfg_version_info(&venv).await?; // Install dependencies - Cmd::new(&uv, "install dependencies") + uv_cmd("install dependencies") .arg("pip") .arg("install") .arg(".")