Skip to content

Commit

Permalink
Pin the zip crate to 0.6 (#3645)
Browse files Browse the repository at this point in the history
## Summary

Restore API-compatibility with pre-1.1.0 versions of the `zip` crate,
and pin the dependency to the 0.6 series, due to concerns discussed in
#3642.

## Test Plan

```
cargo run -p uv-dev -- fetch-python
cargo test
```
  • Loading branch information
musicinmybrain authored May 18, 2024
1 parent 18b095c commit 53c2551
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 41 deletions.
7 changes: 7 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
enabled: true,
},
packageRules: [
{
// Disable updates of `zip-rs`; intentionally pinned for now due to ownership change
// See: https://github.com/astral-sh/uv/issues/3642
matchPackagePatterns: ["zip"],
matchManagers: ["cargo"],
enabled: false,
},
{
// Group upload/download artifact updates, the versions are dependent
groupName: "Artifact GitHub Actions dependencies",
Expand Down
40 changes: 3 additions & 37 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ wiremock = { version = "0.6.0" }
walkdir = { version = "2.5.0" }
which = { version = "6.0.0" }
winapi = { version = "0.3.9", features = ["fileapi", "handleapi", "ioapiset", "winbase", "winioctl", "winnt"] }
zip = { version = "1.1.0", default-features = false, features = ["deflate"] }
zip = { version = "0.6.6", default-features = false, features = ["deflate"] }

[workspace.metadata.cargo-shear]
ignored = ["flate2"]
Expand Down
5 changes: 2 additions & 3 deletions crates/install-wheel-rs/src/wheel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use rustc_hash::FxHashMap;
use sha2::{Digest, Sha256};
use tracing::{instrument, warn};
use walkdir::WalkDir;
use zip::write::SimpleFileOptions;
use zip::write::FileOptions;
use zip::ZipWriter;

use pypi_types::DirectUrl;
Expand Down Expand Up @@ -190,8 +190,7 @@ pub(crate) fn windows_script_launcher(
// We're using the zip writer, but with stored compression
// https://github.com/njsmith/posy/blob/04927e657ca97a5e35bb2252d168125de9a3a025/src/trampolines/mod.rs#L75-L82
// https://github.com/pypa/distlib/blob/8ed03aab48add854f377ce392efffb79bb4d6091/PC/launcher.c#L259-L271
let stored =
SimpleFileOptions::default().compression_method(zip::CompressionMethod::Stored);
let stored = FileOptions::default().compression_method(zip::CompressionMethod::Stored);
let mut archive = ZipWriter::new(Cursor::new(&mut payload));
let error_msg = "Writing to Vec<u8> should never fail";
archive.start_file("__main__.py", stored).expect(error_msg);
Expand Down

0 comments on commit 53c2551

Please sign in to comment.