pocketpy/build_web.sh
Kanika Kapoor c7572c76ba Fix amalgamation script to work with python3-only environments (#444)
- Use sys.executable in Python scripts (amalgamate.py, cmake_build.py) instead of hardcoded 'python'
- Update shell scripts to prefer python3 over python with fallback
- Fix scripts/run_tests.py to detect python3 for CPython benchmarking

This fixes the issue where the amalgamation script fails on Linux systems
that only have python3 available and no 'python' symlink.
2025-12-27 00:42:53 +05:30

18 lines
440 B
Bash

set -e
# Use python3 if available, otherwise fall back to python
PYTHON=$(command -v python3 >/dev/null 2>&1 && echo python3 || echo python)
$PYTHON prebuild.py
rm -rf web/lib
mkdir web/lib
SRC=$(find src/ -name "*.c")
emcc $SRC -Iinclude/ -s -Os \
-sEXPORTED_FUNCTIONS=_py_initialize,_py_exec,_py_finalize,_py_printexc,_py_clearexc \
-sEXPORTED_RUNTIME_METHODS=ccall \
-sALLOW_MEMORY_GROWTH=1 \
-o web/lib/pocketpy.js