From b112baccff9f847f799583644297faaf3948fb27 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 2 Jun 2025 07:47:08 +0000 Subject: [PATCH] Update Rust crate tempfile to v3.20.0 (#13776) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [tempfile](https://stebalien.com/projects/tempfile-rs/) ([source](https://redirect.github.com/Stebalien/tempfile)) | workspace.dependencies | minor | `3.19.1` -> `3.20.0` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes
Stebalien/tempfile (tempfile) ### [`v3.20.0`](https://redirect.github.com/Stebalien/tempfile/blob/HEAD/CHANGELOG.md#3200) [Compare Source](https://redirect.github.com/Stebalien/tempfile/compare/v3.19.1...v3.20.0) This release mostly unifies the behavior/capabilities around "keeping" temporary files: - Rename `Builder::keep(bool)` (via deprecation) to `Builder::disable_cleanup(bool)` to make it clear that behaves differently from `NamedTempFile::keep()`. The former disables automatic cleanup while the latter *consumes* the `NamedTempFile` object entirely and unsets the "temporary file" attribute (on Windows). - Rename `TempDir::into_path` (via deprecation) to `TempDir::keep` to mirror `NamedTempFile::keep`. - Add `TempDir::disable_cleanup`, `NamedTempFile::disable_cleanup`, and `TempPath::disable_cleanup` making it possible to disable automatic cleanup in-place *after* creating a temporary file/directory (equivalent to calling `Builder::disable_cleanup` before creating the file/directory). Additionally, it adds a few spooled temporary file features: - Add `SpooledTempFile::into_file` for turning a `SpooledTempFile` into a regular unnamed temporary file, writing it to the backing storage ("rolling" it) if it was still stored in-memory. - Add `spooled_tempfile_in` and `SpooledTempFile::new_in` methods for creating spooled temporary files in a specific directory. This makes it possible to choose the backing device for your spooled temporary file which is rather important on Linux where the default temporary directory is likely backed by memory (defeating the entire point of having a spooled temporary file). Finally, this release improves documentation, especially the top-level documentation explaining which temporary file type to use. **BREAKING** for those with `deny(warnings)`: - `Builder::keep` deprecated in favor of `Builder::disable_cleanup`. - `TempDir::into_path` is deprecated in favor of `TempDir::keep`. **BREAKING**:
--- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/astral-sh/uv). --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: konstin --- Cargo.lock | 4 ++-- crates/uv-distribution/src/distribution_database.rs | 8 ++++---- crates/uv-distribution/src/source/mod.rs | 2 +- crates/uv-python/src/downloads.rs | 2 +- crates/uv/src/commands/project/environment.rs | 4 +--- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2c1fad471..773a76b35 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3876,9 +3876,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.19.1" +version = "3.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" +checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" dependencies = [ "fastrand", "getrandom 0.3.1", diff --git a/crates/uv-distribution/src/distribution_database.rs b/crates/uv-distribution/src/distribution_database.rs index cd3196cd1..0ecea36e6 100644 --- a/crates/uv-distribution/src/distribution_database.rs +++ b/crates/uv-distribution/src/distribution_database.rs @@ -602,7 +602,7 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> { let id = self .build_context .cache() - .persist(temp_dir.into_path(), wheel_entry.path()) + .persist(temp_dir.keep(), wheel_entry.path()) .await .map_err(Error::CacheRead)?; @@ -773,7 +773,7 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> { let id = self .build_context .cache() - .persist(temp_dir.into_path(), wheel_entry.path()) + .persist(temp_dir.keep(), wheel_entry.path()) .await .map_err(Error::CacheRead)?; @@ -934,7 +934,7 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> { let id = self .build_context .cache() - .persist(temp_dir.into_path(), wheel_entry.path()) + .persist(temp_dir.keep(), wheel_entry.path()) .await .map_err(Error::CacheWrite)?; @@ -982,7 +982,7 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> { let id = self .build_context .cache() - .persist(temp_dir.into_path(), target) + .persist(temp_dir.keep(), target) .await .map_err(Error::CacheWrite)?; diff --git a/crates/uv-distribution/src/source/mod.rs b/crates/uv-distribution/src/source/mod.rs index 18bac0010..7a92d700f 100644 --- a/crates/uv-distribution/src/source/mod.rs +++ b/crates/uv-distribution/src/source/mod.rs @@ -2136,7 +2136,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> { // Extract the top-level directory. let extracted = match uv_extract::strip_component(temp_dir.path()) { Ok(top_level) => top_level, - Err(uv_extract::Error::NonSingularArchive(_)) => temp_dir.into_path(), + Err(uv_extract::Error::NonSingularArchive(_)) => temp_dir.keep(), Err(err) => { return Err(Error::Extract( temp_dir.path().to_string_lossy().into_owned(), diff --git a/crates/uv-python/src/downloads.rs b/crates/uv-python/src/downloads.rs index fcc39691a..9b7fc2825 100644 --- a/crates/uv-python/src/downloads.rs +++ b/crates/uv-python/src/downloads.rs @@ -798,7 +798,7 @@ impl ManagedPythonDownload { // Extract the top-level directory. let mut extracted = match uv_extract::strip_component(temp_dir.path()) { Ok(top_level) => top_level, - Err(uv_extract::Error::NonSingularArchive(_)) => temp_dir.into_path(), + Err(uv_extract::Error::NonSingularArchive(_)) => temp_dir.keep(), Err(err) => return Err(Error::ExtractError(filename.to_string(), err)), }; diff --git a/crates/uv/src/commands/project/environment.rs b/crates/uv/src/commands/project/environment.rs index 62cd5060e..f7ba006c5 100644 --- a/crates/uv/src/commands/project/environment.rs +++ b/crates/uv/src/commands/project/environment.rs @@ -117,9 +117,7 @@ impl CachedEnvironment { .await?; // Now that the environment is complete, sync it to its content-addressed location. - let id = cache - .persist(temp_dir.into_path(), cache_entry.path()) - .await?; + let id = cache.persist(temp_dir.keep(), cache_entry.path()).await?; let root = cache.archive(&id); Ok(Self(PythonEnvironment::from_root(root, cache)?))