Skip to content

Commit dd5e39e

Browse files
committed
use auto decoder to better match python
1 parent d3b09d7 commit dd5e39e

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/distribution.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ enum SDistType {
3434
#[cfg(feature = "bzip2")]
3535
BzTar,
3636
#[cfg(feature = "xz")]
37-
LzTar,
38-
#[cfg(feature = "xz")]
3937
XzTar,
4038
}
4139

@@ -69,9 +67,7 @@ impl FromStr for SDistType {
6967
#[cfg(feature = "bzip2")]
7068
"bz2" | "tbz" => SDistType::BzTar,
7169
#[cfg(feature = "xz")]
72-
"lz" | "lzma" | "tlz" => SDistType::LzTar,
73-
#[cfg(feature = "xz")]
74-
"txz" | "xz" => SDistType::XzTar,
70+
"lz" | "lzma" | "tlz" | "txz" | "xz" => SDistType::XzTar,
7571
_ => return Err(Error::UnknownDistributionType),
7672
};
7773
Ok(dist_type)
@@ -166,14 +162,10 @@ impl Distribution {
166162
Self::parse_tar(BzDecoder::new(BufReader::new(fs_err::File::open(path)?)))
167163
}
168164
#[cfg(feature = "xz")]
169-
SDistType::LzTar => Self::parse_tar(XzDecoder::new_stream(
165+
SDistType::XzTar => Self::parse_tar(XzDecoder::new_stream(
170166
BufReader::new(fs_err::File::open(path)?),
171-
XzStream::new_lzma_decoder(u64::max_value()).unwrap(),
167+
XzStream::new_auto_decoder(u64::max_value(), 0).unwrap(),
172168
)),
173-
#[cfg(feature = "xz")]
174-
SDistType::XzTar => {
175-
Self::parse_tar(XzDecoder::new(BufReader::new(fs_err::File::open(path)?)))
176-
}
177169
}
178170
}
179171

0 commit comments

Comments
 (0)