Skip to content

Commit 31f2ac1

Browse files
committed
split rustpython-stdlib crate
1 parent 90cb222 commit 31f2ac1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+462
-279
lines changed

Cargo.lock

+90-51
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+7-6
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ include = ["LICENSE", "Cargo.toml", "src/**/*.rs"]
1212
resolver = "2"
1313
members = [
1414
".", "ast", "bytecode", "common", "compiler", "compiler/porcelain",
15-
"derive", "jit", "parser", "vm", "vm/pylib-crate", "wasm/lib",
15+
"derive", "jit", "parser", "vm", "vm/pylib-crate", "stdlib", "wasm/lib",
1616
]
1717

1818
[features]
19-
default = ["threading", "pylib", "zlib"]
19+
default = ["threading", "pylib", "zlib", "stdlib"]
20+
stdlib = ["rustpython-stdlib"]
2021
flame-it = ["rustpython-vm/flame-it", "flame", "flamescope"]
2122
freeze-stdlib = ["rustpython-vm/freeze-stdlib"]
2223
jit = ["rustpython-vm/jit"]
2324
threading = ["rustpython-vm/threading"]
24-
zlib = ["rustpython-vm/zlib"]
25-
26-
ssl = ["rustpython-vm/ssl"]
27-
ssl-vendor = ["rustpython-vm/ssl-vendor"]
25+
zlib = ["rustpython-stdlib/zlib"]
26+
ssl = ["rustpython-stdlib/ssl"]
27+
ssl-vendor = ["rustpython-stdlib/ssl-vendor"]
2828

2929
[dependencies]
3030
log = "0.4"
@@ -33,6 +33,7 @@ clap = "2.33"
3333
rustpython-compiler = { path = "compiler/porcelain", version = "0.1.1" }
3434
rustpython-parser = { path = "parser", version = "0.1.1" }
3535
rustpython-vm = { path = "vm", version = "0.1.1", default-features = false, features = ["compile-parse"] }
36+
rustpython-stdlib = {path = "stdlib", optional = true, default-features = false, features = ["compile-parse"]}
3637
pylib = { package = "rustpython-pylib", path = "vm/pylib-crate", version = "0.1.0", optional = true }
3738
dirs = { package = "dirs-next", version = "2.0.0" }
3839
num-traits = "0.2.8"

src/lib.rs

+7
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@ where
9393
};
9494

9595
let interp = Interpreter::new_with_init(settings, |vm| {
96+
#[cfg(feature = "stdlib")]
97+
{
98+
let stdlib = rustpython_stdlib::get_module_inits();
99+
for (name, init) in stdlib.into_iter() {
100+
vm.add_native_module(name, init);
101+
}
102+
}
96103
init(vm);
97104
init_param
98105
});

0 commit comments

Comments
 (0)