Skip to content

Commit

Permalink
Introduce uv-production-flate2-backend for automatic rust_backend usa…
Browse files Browse the repository at this point in the history
…ge on s390x and zlib-ng everywhere else (but only in production)
  • Loading branch information
fasterthanlime committed Sep 4, 2024
1 parent eb0ae5f commit 8814da4
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ jobs:
target: ${{ matrix.platform.target }}
manylinux: auto
docker-options: ${{ matrix.platform.maturin_docker_options }}
args: --release --locked --out dist --no-default-features --features flate2/rust_backend --features production
args: --release --locked --out dist --no-default-features --features production
- uses: uraimo/run-on-arch-action@v2
if: matrix.platform.arch != 'ppc64'
name: Test wheel
Expand Down
8 changes: 8 additions & 0 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ uv-virtualenv = { path = "crates/uv-virtualenv" }
uv-warnings = { path = "crates/uv-warnings" }
uv-workspace = { path = "crates/uv-workspace" }
uv-production-memory-allocator = { path = "crates/uv-production-memory-allocator" }
uv-production-flate2-backend = { path = "crates/uv-production-flate2-backend" }

anstream = { version = "0.6.13" }
anyhow = { version = "1.0.80" }
Expand Down Expand Up @@ -168,7 +169,7 @@ xz2 = { version = "0.1.7" }
zip = { version = "0.6.6", default-features = false, features = ["deflate"] }

[workspace.metadata.cargo-shear]
ignored = ["flate2", "xz2", "uv-production-memory-allocator"]
ignored = ["flate2", "xz2", "uv-production-memory-allocator", "uv-production-flate2-backend"]

[patch.crates-io]
# For pyproject-toml
Expand Down
19 changes: 19 additions & 0 deletions crates/uv-production-flate2-backend/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "uv-production-flate2-backend"
version = "0.1.0"
edition.workspace = true
rust-version.workspace = true
homepage.workspace = true
documentation.workspace = true
repository.workspace = true
authors.workspace = true
license.workspace = true

[target.'cfg(not(target_arch = "s390x"))'.dependencies]
flate2 = { version = "1.0.28", default-features = false, features = ["zlib-ng"] }

[target.'cfg(target_arch = "s390x")'.dependencies]
flate2 = { version = "1.0.28", default-features = false, features = ["rust_backend"] }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/uv-production-flate2-backend/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//! The sole purpose of this crate is to enable one of
//! `flate2/zlib-ng` (on most platforms) or `flate2/rust_backend`
//! (on s390x)
9 changes: 6 additions & 3 deletions crates/uv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ uv-virtualenv = { workspace = true }
uv-warnings = { workspace = true }
uv-workspace = { workspace = true }
uv-production-memory-allocator = { workspace = true, optional = true }
uv-production-flate2-backend = { workspace = true, optional = true }

anstream = { workspace = true }
anyhow = { workspace = true }
Expand Down Expand Up @@ -94,13 +95,15 @@ tempfile = { workspace = true }
zip = { workspace = true }

[package.metadata.cargo-shear]
ignored = ["flate2", "uv-production-memory-allocator"]
ignored = ["flate2", "uv-production-memory-allocator", "uv-production-flate2-backend"]

[features]
default = ["flate2/zlib-ng", "python", "pypi", "git"]
default = ["python", "pypi", "git"]
# Use better memory allocators, etc. — also turns-on self-update.
production = ["self-update", "production-memory-allocator", "uv-distribution/production"]
production = ["self-update", "production-memory-allocator", "production-flate2-backend", "uv-distribution/production"]
production-memory-allocator = ["dep:uv-production-memory-allocator"]
production-flate2-backend = ["dep:uv-production-flate2-backend"]

# Introduces a dependency on a local Python installation.
python = []
# Introduces a dependency on a local Python installation with specific patch versions.
Expand Down

0 comments on commit 8814da4

Please sign in to comment.