Skip to content

Commit f90575b

Browse files
committed
xz2->liblzma
1 parent bc5a6a6 commit f90575b

3 files changed

Lines changed: 32 additions & 34 deletions

File tree

‎Cargo.lock‎

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

‎crates/stdlib/Cargo.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ pkcs8 = { version = "0.10", features = ["encryption", "pkcs5", "pem"], optional
139139

140140
[target.'cfg(not(any(target_os = "android", target_arch = "wasm32")))'.dependencies]
141141
libsqlite3-sys = { version = "0.36", features = ["bundled"], optional = true }
142-
lzma-sys = "0.1"
143-
xz2 = "0.1"
142+
liblzma-sys = "0.4"
143+
liblzma = "0.4"
144144

145145
[target.'cfg(windows)'.dependencies]
146146
paste = { workspace = true }

‎crates/stdlib/src/lzma.rs‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,47 +9,45 @@ mod _lzma {
99
DecompressError, DecompressState, DecompressStatus, Decompressor,
1010
};
1111
use alloc::fmt;
12+
use liblzma::stream::{Action, Check, Error, Filters, LzmaOptions, Status, Stream};
1213
#[pyattr]
13-
use lzma_sys::{
14+
use liblzma_sys::{
1415
LZMA_CHECK_CRC32 as CHECK_CRC32, LZMA_CHECK_CRC64 as CHECK_CRC64,
1516
LZMA_CHECK_NONE as CHECK_NONE, LZMA_CHECK_SHA256 as CHECK_SHA256,
1617
};
1718
#[pyattr]
18-
use lzma_sys::{
19+
use liblzma_sys::{
1920
LZMA_FILTER_ARM as FILTER_ARM, LZMA_FILTER_ARMTHUMB as FILTER_ARMTHUMB,
2021
LZMA_FILTER_IA64 as FILTER_IA64, LZMA_FILTER_LZMA1 as FILTER_LZMA1,
2122
LZMA_FILTER_LZMA2 as FILTER_LZMA2, LZMA_FILTER_POWERPC as FILTER_POWERPC,
2223
LZMA_FILTER_SPARC as FILTER_SPARC, LZMA_FILTER_X86 as FILTER_X86,
2324
};
2425
#[pyattr]
25-
use lzma_sys::{
26+
use liblzma_sys::{
2627
LZMA_MF_BT2 as MF_BT2, LZMA_MF_BT3 as MF_BT3, LZMA_MF_BT4 as MF_BT4, LZMA_MF_HC3 as MF_HC3,
2728
LZMA_MF_HC4 as MF_HC4,
2829
};
2930
#[pyattr]
30-
use lzma_sys::{LZMA_MODE_FAST as MODE_FAST, LZMA_MODE_NORMAL as MODE_NORMAL};
31+
use liblzma_sys::{LZMA_MODE_FAST as MODE_FAST, LZMA_MODE_NORMAL as MODE_NORMAL};
3132
#[pyattr]
32-
use lzma_sys::{
33+
use liblzma_sys::{
3334
LZMA_PRESET_DEFAULT as PRESET_DEFAULT, LZMA_PRESET_EXTREME as PRESET_EXTREME,
34-
LZMA_PRESET_LEVEL_MASK as PRESET_LEVEL_MASK,
3535
};
3636
use rustpython_common::lock::PyMutex;
3737
use rustpython_vm::builtins::{PyBaseExceptionRef, PyBytesRef, PyType, PyTypeRef};
3838
use rustpython_vm::convert::ToPyException;
3939
use rustpython_vm::function::ArgBytesLike;
4040
use rustpython_vm::types::Constructor;
4141
use rustpython_vm::{Py, PyObjectRef, PyPayload, PyResult, VirtualMachine};
42-
use xz2::stream::{Action, Check, Error, Filters, LzmaOptions, Status, Stream};
4342

4443
#[cfg(windows)]
4544
type EnumVal = i32;
4645
#[cfg(not(windows))]
4746
type EnumVal = u32;
4847

4948
const BUFSIZ: usize = 8192;
50-
// TODO: can't find this in lzma-sys, but find way not to hardcode this
5149
#[pyattr]
52-
const FILTER_DELTA: i32 = 3;
50+
const FILTER_DELTA: u64 = liblzma_sys::LZMA_FILTER_DELTA;
5351
#[pyattr]
5452
const CHECK_ID_MAX: i32 = 15;
5553
#[pyattr]
@@ -87,7 +85,7 @@ mod _lzma {
8785

8886
#[pyfunction]
8987
fn is_check_supported(check: i32) -> bool {
90-
unsafe { lzma_sys::lzma_check_is_supported(check as _) != 0 }
88+
unsafe { liblzma_sys::lzma_check_is_supported(check as _) != 0 }
9189
}
9290

9391
// TODO: To implement these we need a function to convert a pyobject to a lzma filter and related structs

0 commit comments

Comments
 (0)