8000 gh-127503: Emscripten make Python.sh function as proper Python CLI by hoodmane · Pull Request #127506 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-127503: Emscripten make Python.sh function as proper Python CLI #127506

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Dec 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply code formatter
  • Loading branch information
hoodmane committed Dec 3, 2024
commit 60875c04c139b01876a6b82a1e24aec0f81fc1a3
17 changes: 10 additions & 7 deletions Tools/wasm/emscripten/node_entry.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ import fs from "node:fs";
if (process?.versions?.node) {
const nodeVersion = Number(process.versions.node.split(".", 1)[0]);
if (nodeVersion < 18) {
process.stderr.write(
`Node version must be >= 18, got version ${process.version}\n`,
);
process.exit(1);
process.stderr.write(
`Node version must be >= 18, got version ${process.version}\n`,
);
process.exit(1);
}
}

function rootDirsToMount(Module) {
return fs
.readdirSync("/")
.filter((dir) => !["dev", "lib", "proc"].includes(dir)).map(dir => "/" + dir);
.readdirSync("/")
.filter((dir) => !["dev", "lib", "proc"].includes(dir))
.map((dir) => "/" + dir);
}

function mountDirectories(Module) {
Expand All @@ -25,7 +26,9 @@ function mountDirectories(Module) {
}

const thisProgram = "--this-program=";
const thisProgramIndex = process.argv.findIndex(x => x.startsWith(thisProgram));
const thisProgramIndex = process.argv.findIndex((x) =>
x.startsWith(thisProgram),
);

const settings = {
preRun(Module) {
Expand Down
0