WASMTIME_VERSION: 38.0.3
WASI_SDK_VERSION: 24
WASI_SDK_PATH: /opt/wasi-sdk
- CROSS_BUILD_PYTHON: cross-build/build
CROSS_BUILD_WASI: cross-build/wasm32-wasip1
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
run: python3 Tools/wasm/wasi configure-build-python -- --config-cache --with-pydebug
- name: "Make build Python"
run: python3 Tools/wasm/wasi make-build-python
- - name: "Configure host"
+ - name: "Display build info of the build Python"
+ run: python3 Tools/wasm/wasi pythoninfo-build
+ - name: "Configure host/WASI Python"
# `--with-pydebug` inferred from configure-build-python
run: python3 Tools/wasm/wasi configure-host -- --config-cache
- - name: "Make host"
+ - name: "Make host/WASI Python"
run: python3 Tools/wasm/wasi make-host
- - name: "Display build info"
- run: make --directory "${CROSS_BUILD_WASI}" pythoninfo
+ - name: "Display build info of the host/WASI Python"
+ run: python3 Tools/wasm/wasi pythoninfo-host
- name: "Test"
run: make --directory "${CROSS_BUILD_WASI}" test
log("🎉", f"{binary} {version}")
+@subdir(BUILD_DIR)
+def pythoninfo_build_python(context, working_dir):
+ """Display build info of the build Python."""
+ call(["make", "pythoninfo"], context=context)
+
+
def find_wasi_sdk():
"""Find the path to the WASI SDK."""
wasi_sdk_path = None
)
+@subdir(lambda context: CROSS_BUILD_DIR / context.host_triple)
+def pythoninfo_wasi_python(context, working_dir):
+ """Display build info of the host/WASI Python."""
+ call(["make", "pythoninfo"], context=context)
+
+
def clean_contents(context):
"""Delete all files created by this script."""
if CROSS_BUILD_DIR.exists():
build_python = subcommands.add_parser(
"build-python", help="Build the build Python"
)
+ pythoninfo_build = subcommands.add_parser(
+ "pythoninfo-build", help="Display build info of the build Python"
+ )
configure_host = subcommands.add_parser(
"configure-host",
help="Run `configure` for the "
build_host = subcommands.add_parser(
"build-host", help="Build the host/WASI Python"
)
+ pythoninfo_host = subcommands.add_parser(
+ "pythoninfo-host", help="Display build info of the host/WASI Python"
+ )
subcommands.add_parser(
"clean", help="Delete files and directories created by this script"
)
configure_build,
make_build,
build_python,
+ pythoninfo_build,
configure_host,
make_host,
+ pythoninfo_host,
build_host,
):
subcommand.add_argument(
help="Command template for running the WASI host; defaults to "
f"`{default_host_runner}`",
)
- for subcommand in build, configure_host, make_host, build_host:
+ for subcommand in (
+ build,
+ configure_host,
+ make_host,
+ build_host,
+ pythoninfo_host,
+ ):
subcommand.add_argument(
"--host-triple",
action="store",
context = parser.parse_args()
context.init_dir = pathlib.Path().absolute()
- build_build_python = build_steps(configure_build_python, make_build_python)
- build_wasi_python = build_steps(configure_wasi_python, make_wasi_python)
+ build_build_python = build_steps(
+ configure_build_python,
+ make_build_python,
+ pythoninfo_build_python,
+ )
+ build_wasi_python = build_steps(
+ configure_wasi_python,
+ make_wasi_python,
+ pythoninfo_wasi_python,
+ )
dispatch = {
"configure-build-python": configure_build_python,
"make-build-python": make_build_python,
"build-python": build_build_python,
+ "pythoninfo-build": pythoninfo_build_python,
"configure-host": configure_wasi_python,
"make-host": make_wasi_python,
"build-host": build_wasi_python,
+ "pythoninfo-host": pythoninfo_wasi_python,
"build": build_steps(build_build_python, build_wasi_python),
"clean": clean_contents,
+ None: lambda args: parser.print_help(),
}
dispatch[context.subcommand](context)