From 2e14ba865c7e2d3b22aff6bc1a4d75dd94d55cf4 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Sun, 31 Aug 2025 23:36:13 +0900 Subject: [PATCH 1/3] getrandom/wasm_js for rustpython-common --- common/Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/Cargo.toml b/common/Cargo.toml index 94704d18c9..67fa73a4bb 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -36,6 +36,9 @@ lock_api = "0.4" siphasher = "1" num-complex.workspace = true +[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dependencies] +getrandom = { workspace = true, features = ["wasm_js"] } + [target.'cfg(windows)'.dependencies] widestring = { workspace = true } windows-sys = { workspace = true, features = [ From 5cbb15299fb2d834f3544f233f8a78bcad236847 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Sun, 31 Aug 2025 23:36:32 +0900 Subject: [PATCH 2/3] wasm_js rustflags on top workspace --- .cargo/config.toml | 3 +++ wasm/lib/.cargo/config.toml | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index a590c044d8..635229119f 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -3,3 +3,6 @@ rustflags = "-C link-arg=/STACK:8000000" [target.'cfg(all(target_os = "windows", not(target_env = "msvc")))'] rustflags = "-C link-args=-Wl,--stack,8000000" + +[target.wasm32-unknown-unknown] +rustflags = ["--cfg=getrandom_backend=\"wasm_js\""] diff --git a/wasm/lib/.cargo/config.toml b/wasm/lib/.cargo/config.toml index ce1e7c694a..f4e8c002fc 100644 --- a/wasm/lib/.cargo/config.toml +++ b/wasm/lib/.cargo/config.toml @@ -1,5 +1,2 @@ [build] target = "wasm32-unknown-unknown" - -[target.wasm32-unknown-unknown] -rustflags = ["--cfg=getrandom_backend=\"wasm_js\""] From 2e36ff819d1860bbd7367906b87955f086217209 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Sun, 14 Sep 2025 17:06:50 +0900 Subject: [PATCH 3/3] rustpython-common/wasm_js --- common/Cargo.toml | 4 +--- vm/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/common/Cargo.toml b/common/Cargo.toml index 67fa73a4bb..79bf058ebe 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -10,6 +10,7 @@ license.workspace = true [features] threading = ["parking_lot"] +wasm_js = ["getrandom/wasm_js"] [dependencies] rustpython-literal = { workspace = true } @@ -36,9 +37,6 @@ lock_api = "0.4" siphasher = "1" num-complex.workspace = true -[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dependencies] -getrandom = { workspace = true, features = ["wasm_js"] } - [target.'cfg(windows)'.dependencies] widestring = { workspace = true } windows-sys = { workspace = true, features = [ diff --git a/vm/Cargo.toml b/vm/Cargo.toml index 803eae014e..938cb0bb41 100644 --- a/vm/Cargo.toml +++ b/vm/Cargo.toml @@ -24,7 +24,7 @@ ast = ["ruff_python_ast", "ruff_text_size"] codegen = ["rustpython-codegen", "ast"] parser = ["ast"] serde = ["dep:serde"] -wasmbind = ["chrono/wasmbind", "getrandom/wasm_js", "wasm-bindgen"] +wasmbind = ["rustpython-common/wasm_js", "chrono/wasmbind", "wasm-bindgen"] [dependencies] rustpython-compiler = { workspace = true, optional = true }