Skip to content

Commit da9c986

Browse files
committed
optional bz2
1 parent b17c891 commit da9c986

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jit = ["rustpython-vm/jit"]
2727
threading = ["rustpython-vm/threading", "rustpython-stdlib/threading"]
2828
pylib = ["rustpython-vm/pylib"]
2929
zlib = ["stdlib", "rustpython-stdlib/zlib"]
30+
bz2 = ["stdlib", "rustpython-stdlib/bz2"]
3031
ssl = ["rustpython-stdlib/ssl"]
3132
ssl-vendor = ["rustpython-stdlib/ssl-vendor"]
3233

stdlib/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ unic-ucd-ident = "0.9.0"
4141
adler32 = "1.2.0"
4242
crc32fast = "1.3.2"
4343
flate2 = "1.0.23"
44-
bzip2 = "0.4"
44+
bzip2 = { version = "0.4", optional = true }
4545

4646
num-complex = "0.4.0"
4747
num-bigint = "0.4.3"
@@ -86,6 +86,7 @@ compiler = ["rustpython-vm/compiler"]
8686
# parser = ["rustpython-parser", "ast"]
8787

8888
zlib = ["libz-sys", "flate2/zlib"]
89+
bz2 = ["bzip2"]
8990
ssl = ["openssl", "openssl-sys", "foreign-types-shared"]
9091
ssl-vendor = ["ssl", "openssl/vendored", "openssl-probe"]
9192

stdlib/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ mod random;
2525
mod statistics;
2626
// TODO: maybe make this an extension module, if we ever get those
2727
// mod re;
28-
#[cfg(not(any(target_arch = "wasm32")))]
28+
#[cfg(feature = "bz2")]
2929
mod bz2;
3030
#[cfg(not(target_arch = "wasm32"))]
3131
pub mod socket;
@@ -117,12 +117,15 @@ pub fn get_module_inits() -> impl Iterator<Item = (Cow<'static, str>, StdlibInit
117117
"select" => select::make_module,
118118
"_socket" => socket::make_module,
119119
"faulthandler" => faulthandler::make_module,
120-
"_bz2" => bz2::make_module,
121120
}
122121
#[cfg(feature = "ssl")]
123122
{
124123
"_ssl" => ssl::make_module,
125124
}
125+
#[cfg(feature = "bz2")]
126+
{
127+
"_bz2" => bz2::make_module,
128+
}
126129
// Unix-only
127130
#[cfg(unix)]
128131
{

0 commit comments

Comments
 (0)