Make puffin-fs tokio dependency opt-in (#1100)

This commit is contained in:
Charlie Marsh 2024-01-25 09:47:46 -08:00 committed by GitHub
parent 5ad2e60561
commit e0902d7d5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 3 deletions

View file

@ -12,7 +12,7 @@ pep440_rs = { path = "../pep440-rs" }
pep508_rs = { path = "../pep508-rs" }
platform-tags = { path = "../platform-tags" }
puffin-cache = { path = "../puffin-cache" }
puffin-fs = { path = "../puffin-fs" }
puffin-fs = { path = "../puffin-fs", features = ["tokio"] }
puffin-normalize = { path = "../puffin-normalize" }
pypi-types = { path = "../pypi-types" }

View file

@ -23,7 +23,7 @@ platform-tags = { path = "../platform-tags" }
puffin-cache = { path = "../puffin-cache" }
puffin-client = { path = "../puffin-client" }
puffin-extract = { path = "../puffin-extract" }
puffin-fs = { path = "../puffin-fs" }
puffin-fs = { path = "../puffin-fs", features = ["tokio"] }
puffin-git = { path = "../puffin-git", features = ["vendored-openssl"] }
puffin-normalize = { path = "../puffin-normalize" }
puffin-traits = { path = "../puffin-traits" }

View file

@ -16,8 +16,12 @@ workspace = true
puffin-warnings = { path = "../puffin-warnings" }
dunce = { workspace = true }
fs-err = { workspace = true, features = ["tokio"] }
fs-err = { workspace = true }
fs2 = { workspace = true }
junction = { workspace = true }
tempfile = { workspace = true }
tracing = { workspace = true }
[features]
default = []
tokio = ["fs-err/tokio"]

View file

@ -51,6 +51,7 @@ pub fn replace_symlink(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> std::io:
}
/// Write `data` to `path` atomically using a temporary file and atomic rename.
#[cfg(feature = "tokio")]
pub async fn write_atomic(path: impl AsRef<Path>, data: impl AsRef<[u8]>) -> std::io::Result<()> {
let temp_file = NamedTempFile::new_in(
path.as_ref()