diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d6d0be1..35082462 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,13 +24,6 @@ jobs: cache-dependency-glob: "uv.lock" cache-local-path: ${{ env.UV_CACHE_DIR }} - - name: Install additional OS dependencies - run: | - sudo apt-get update - sudo apt-get -y install \ - pkg-config \ - liblzma-dev - - name: 🏗 Install the project run: uv sync --locked --group lint @@ -67,13 +60,6 @@ jobs: cache-local-path: ${{ env.UV_CACHE_DIR }} python-version: ${{ matrix.python-version }} - - name: Install additional OS dependencies - run: | - sudo apt-get update - sudo apt-get -y install \ - pkg-config \ - liblzma-dev - - name: 🏗 Install the project run: uv sync --locked --group test @@ -106,13 +92,6 @@ jobs: with: python-version-file: ".python-version" - - name: Install additional OS dependencies - run: | - sudo apt-get update - sudo apt-get -y install \ - pkg-config \ - liblzma-dev - - name: 🏗 Install the project run: | uv export --group benchmark > requirements.txt diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index e9e0625a..cadab996 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -31,12 +31,6 @@ jobs: with: enable-cache: true python-version: ${{ matrix.python-version }} - - name: Install additional OS dependencies - run: | - sudo apt-get update - sudo apt-get -y install \ - pkg-config \ - liblzma-dev - name: 🏗 Set package version run: | sed -i "s/^version = \".*\"/version = \"${{ github.event.release.tag_name }}\"/" pyproject.toml diff --git a/Cargo.lock b/Cargo.lock index 88f34974..701c46aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,6 +20,17 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +[[package]] +name = "cc" +version = "1.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13208fcbb66eaeffe09b99fffbe1af420f00a7b35aa99ad683dfc1aa76145229" +dependencies = [ + "jobserver", + "libc", + "shlex", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -32,8 +43,8 @@ version = "0.0.0" dependencies = [ "base64", "byteorder", + "liblzma", "pyo3", - "rust-lzma", ] [[package]] @@ -48,12 +59,41 @@ version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + [[package]] name = "libc" version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +[[package]] +name = "liblzma" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "603222e049bf0da71529325ada5d02dc3871cbd3679cf905429f7f0de93da87b" +dependencies = [ + "liblzma-sys", +] + +[[package]] +name = "liblzma-sys" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41e2171ce6827cbab9bc97238a58361bf9a526080475f21dbc470e1842258b2d" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "memoffset" version = "0.9.1" @@ -163,14 +203,10 @@ dependencies = [ ] [[package]] -name = "rust-lzma" -version = "0.6.0" +name = "shlex" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d62915608f6cee1d7f2fc00f28b4f058ff79d6e4ec3c2fe0006b09b52437c84" -dependencies = [ - "pkg-config", - "vcpkg", -] +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "syn" @@ -200,9 +236,3 @@ name = "unindent" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" diff --git a/Cargo.toml b/Cargo.toml index 56fc6cbb..afcf901b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,5 +12,5 @@ crate-type = ["cdylib"] [dependencies] base64 = "0.22.1" byteorder = "1.5.0" +liblzma = "0.3.5" pyo3 = "0.23.3" -rust-lzma = "0.6.0" diff --git a/scripts/setup.sh b/scripts/setup.sh index 0ee5a116..4ac91477 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -8,7 +8,6 @@ curl -LsSf https://astral.sh/uv/install.sh | sh # Install required packages for rust-lzma sudo apt update -sudo apt install -y pkg-config liblzma-dev # Install project dependencies uv sync --frozen --group dev diff --git a/src/util.rs b/src/util.rs index 96538d0a..282b83af 100644 --- a/src/util.rs +++ b/src/util.rs @@ -1,6 +1,9 @@ use std::error::Error; +use std::io::{Cursor, Read}; use base64::{engine::general_purpose, Engine as _}; +use liblzma::read::XzDecoder; +use liblzma::stream::Stream; use pyo3::exceptions::PyValueError; use pyo3::prelude::*; @@ -15,7 +18,13 @@ pub fn decompress_7z_base64_data(value: String) -> Result, Box