Skip to content
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
Fix wasm_build
  • Loading branch information
savannahostrowski committed Oct 8, 2025
commit 459d59fd7b1881b7c597b07101a5faa6ad5f962d
27 changes: 18 additions & 9 deletions Tools/wasm/wasm_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
./Tools/wasm/wasm_builder.py --clean build build

"""

import argparse
import enum
import dataclasses
Expand Down Expand Up @@ -67,7 +68,9 @@

# path to Emscripten SDK config file.
# auto-detect's EMSDK in /opt/emsdk without ". emsdk_env.sh".
EM_CONFIG = pathlib.Path(os.environ.setdefault("EM_CONFIG", "/opt/emsdk/.emscripten"))
EM_CONFIG = pathlib.Path(
os.environ.setdefault("EM_CONFIG", "/opt/emsdk/.emscripten")
)
EMSDK_MIN_VERSION = (3, 1, 19)
EMSDK_BROKEN_VERSION = {
(3, 1, 14): "https://github.com/emscripten-core/emscripten/issues/17338",
Expand Down Expand Up @@ -261,8 +264,7 @@ def _check_emscripten() -> None:
# git / upstream / tot-upstream installation
version = version[:-4]
version_tuple = cast(
Tuple[int, int, int],
tuple(int(v) for v in version.split("."))
Tuple[int, int, int], tuple(int(v) for v in version.split("."))
)
if version_tuple < EMSDK_MIN_VERSION:
raise ConditionError(
Expand Down Expand Up @@ -518,7 +520,7 @@ def make_cmd(self) -> List[str]:
def getenv(self) -> Dict[str, Any]:
"""Generate environ dict for platform"""
env = os.environ.copy()
if hasattr(os, 'process_cpu_count'):
if hasattr(os, "process_cpu_count"):
cpu_count = os.process_cpu_count()
else:
cpu_count = os.cpu_count()
Expand Down Expand Up @@ -596,7 +598,9 @@ def run_py(self, *args: str) -> int:
"""Run Python with hostrunner"""
self._check_execute()
return self.run_make(
"--eval", f"run: all; $(HOSTRUNNER) ./$(PYTHON) {shlex.join(args)}", "run"
"--eval",
f"run: all; $(HOSTRUNNER) ./$(PYTHON) {shlex.join(args)}",
"run",
)

def run_browser(self, bind: str = "127.0.0.1", port: int = 8000) -> None:
Expand Down Expand Up @@ -666,9 +670,12 @@ def build_emports(self, force: bool = False) -> None:
# Pre-build libbz2, libsqlite3, libz, and some system libs.
ports_cmd.extend(["-sUSE_ZLIB", "-sUSE_BZIP2", "-sUSE_SQLITE3"])
# Multi-threaded sqlite3 has different suffix
embuilder_cmd.extend(
["build", "bzip2", "sqlite3-mt" if self.pthreads else "sqlite3", "zlib"]
)
embuilder_cmd.extend([
"build",
"bzip2",
"sqlite3-mt" if self.pthreads else "sqlite3",
"zlib",
])

self._run_cmd(embuilder_cmd, cwd=SRCDIR)

Expand Down Expand Up @@ -817,7 +824,9 @@ def build_emports(self, force: bool = False) -> None:

# Don't list broken and experimental variants in help
platforms_choices = list(p.name for p in _profiles) + ["cleanall"]
platforms_help = list(p.name for p in _profiles if p.support_level) + ["cleanall"]
platforms_help = list(p.name for p in _profiles if p.support_level) + [
"cleanall"
]
parser.add_argument(
"platform",
metavar="PLATFORM",
Expand Down
Loading