Skip to content

Commit 23f7cbf

Browse files
coolreader18youknowone
authored andcommitted
Make sqlite optional
1 parent ae78ecc commit 23f7cbf

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
env:
18-
CARGO_ARGS: --no-default-features --features stdlib,zlib,importlib,encodings,ssl
18+
CARGO_ARGS: --no-default-features --features stdlib,zlib,importlib,encodings,sqlite,ssl
1919
# Skip additional tests on Windows. They are checked on Linux and MacOS.
2020
WINDOWS_SKIPS: >-
2121
test_datetime

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jit = ["rustpython-vm/jit"]
2020
threading = ["rustpython-vm/threading", "rustpython-stdlib/threading"]
2121
zlib = ["stdlib", "rustpython-stdlib/zlib"]
2222
bz2 = ["stdlib", "rustpython-stdlib/bz2"]
23+
sqlite = ["rustpython-stdlib/sqlite"]
2324
ssl = ["rustpython-stdlib/ssl"]
2425
ssl-vendor = ["ssl", "rustpython-stdlib/ssl-vendor"]
2526

stdlib/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ compiler = ["rustpython-vm/compiler"]
1616
threading = ["rustpython-common/threading", "rustpython-vm/threading"]
1717
zlib = ["libz-sys", "flate2/zlib"]
1818
bz2 = ["bzip2"]
19+
sqlite = ["dep:libsqlite3-sys"]
1920
ssl = ["openssl", "openssl-sys", "foreign-types-shared"]
2021
ssl-vendor = ["ssl", "openssl/vendored", "openssl-probe"]
2122

@@ -107,7 +108,7 @@ openssl-probe = { version = "0.1.5", optional = true }
107108
foreign-types-shared = { version = "0.1.1", optional = true }
108109

109110
[target.'cfg(not(any(target_os = "android", target_arch = "wasm32")))'.dependencies]
110-
libsqlite3-sys = { version = "0.28", features = ["bundled"] }
111+
libsqlite3-sys = { version = "0.28", features = ["bundled"], optional = true }
111112

112113
[target.'cfg(windows)'.dependencies]
113114
junction = { workspace = true }
@@ -135,4 +136,4 @@ features = [
135136
system-configuration = "0.5.0"
136137

137138
[lints]
138-
workspace = true
139+
workspace = true

stdlib/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ mod resource;
6161
mod scproxy;
6262
#[cfg(any(unix, windows, target_os = "wasi"))]
6363
mod select;
64-
#[cfg(not(any(target_os = "android", target_arch = "wasm32")))]
64+
#[cfg(all(
65+
feature = "sqlite",
66+
not(any(target_os = "android", target_arch = "wasm32"))
67+
))]
6568
mod sqlite;
6669
#[cfg(all(not(target_arch = "wasm32"), feature = "ssl"))]
6770
mod ssl;
@@ -141,7 +144,7 @@ pub fn get_module_inits() -> impl Iterator<Item = (Cow<'static, str>, StdlibInit
141144
"_multiprocessing" => multiprocessing::make_module,
142145
"_socket" => socket::make_module,
143146
}
144-
#[cfg(not(any(target_os = "android", target_arch = "wasm32")))]
147+
#[cfg(all(feature = "sqlite", not(any(target_os = "android", target_arch = "wasm32"))))]
145148
{
146149
"_sqlite3" => sqlite::make_module,
147150
}

0 commit comments

Comments
 (0)