Skip to content

Commit b112bac

Browse files
Update Rust crate tempfile to v3.20.0 (#13776)
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 <details> <summary>Stebalien/tempfile (tempfile)</summary> ### [`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**: </details> --- ### 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. --- - [ ] <!-- rebase-check -->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). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC4zMy42IiwidXBkYXRlZEluVmVyIjoiNDAuMzMuNiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiaW50ZXJuYWwiXX0=--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: konstin <[email protected]>
1 parent b144cfe commit b112bac

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/uv-distribution/src/distribution_database.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
602602
let id = self
603603
.build_context
604604
.cache()
605-
.persist(temp_dir.into_path(), wheel_entry.path())
605+
.persist(temp_dir.keep(), wheel_entry.path())
606606
.await
607607
.map_err(Error::CacheRead)?;
608608

@@ -773,7 +773,7 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
773773
let id = self
774774
.build_context
775775
.cache()
776-
.persist(temp_dir.into_path(), wheel_entry.path())
776+
.persist(temp_dir.keep(), wheel_entry.path())
777777
.await
778778
.map_err(Error::CacheRead)?;
779779

@@ -934,7 +934,7 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
934934
let id = self
935935
.build_context
936936
.cache()
937-
.persist(temp_dir.into_path(), wheel_entry.path())
937+
.persist(temp_dir.keep(), wheel_entry.path())
938938
.await
939939
.map_err(Error::CacheWrite)?;
940940

@@ -982,7 +982,7 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
982982
let id = self
983983
.build_context
984984
.cache()
985-
.persist(temp_dir.into_path(), target)
985+
.persist(temp_dir.keep(), target)
986986
.await
987987
.map_err(Error::CacheWrite)?;
988988

crates/uv-distribution/src/source/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2136,7 +2136,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
21362136
// Extract the top-level directory.
21372137
let extracted = match uv_extract::strip_component(temp_dir.path()) {
21382138
Ok(top_level) => top_level,
2139-
Err(uv_extract::Error::NonSingularArchive(_)) => temp_dir.into_path(),
2139+
Err(uv_extract::Error::NonSingularArchive(_)) => temp_dir.keep(),
21402140
Err(err) => {
21412141
return Err(Error::Extract(
21422142
temp_dir.path().to_string_lossy().into_owned(),

crates/uv-python/src/downloads.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ impl ManagedPythonDownload {
798798
// Extract the top-level directory.
799799
let mut extracted = match uv_extract::strip_component(temp_dir.path()) {
800800
Ok(top_level) => top_level,
801-
Err(uv_extract::Error::NonSingularArchive(_)) => temp_dir.into_path(),
801+
Err(uv_extract::Error::NonSingularArchive(_)) => temp_dir.keep(),
802802
Err(err) => return Err(Error::ExtractError(filename.to_string(), err)),
803803
};
804804

crates/uv/src/commands/project/environment.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ impl CachedEnvironment {
117117
.await?;
118118

119119
// Now that the environment is complete, sync it to its content-addressed location.
120-
let id = cache
121-
.persist(temp_dir.into_path(), cache_entry.path())
122-
.await?;
120+
let id = cache.persist(temp_dir.keep(), cache_entry.path()).await?;
123121
let root = cache.archive(&id);
124122

125123
Ok(Self(PythonEnvironment::from_root(root, cache)?))

0 commit comments

Comments
 (0)