Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
472f775
Create a `_shared` module
brettcannon May 6, 2026
ae91c98
Merge remote-tracking branch 'upstream' into wasi-package
brettcannon May 6, 2026
15503a3
Attempt at getting `lib/` working
brettcannon Jun 3, 2026
db0bff7
Ignore "/dist/"
brettcannon Jun 3, 2026
b97d997
Get `lib/` working
brettcannon Jun 3, 2026
0808516
Add some caching
brettcannon Jun 3, 2026
353cf3c
Log what's going on
brettcannon Jun 4, 2026
99a8eb5
Fix an over-zealous substitution
brettcannon Jun 9, 2026
02870c2
Centralize context in an object
brettcannon Jun 9, 2026
b91761f
Make calculating if a debug build was used easier
brettcannon Jun 9, 2026
1cf9836
Run `ruff format`
brettcannon Jun 9, 2026
347e950
Add comment to clarify debug check for Python 3.13 and older
brettcannon Jun 9, 2026
6748280
Put the files into a subdirectory that records the Python version and…
brettcannon Jun 10, 2026
de141e8
Add the man page
brettcannon Jun 10, 2026
4c53d56
Symlink man page
brettcannon Jun 11, 2026
c5f1a65
Get symlinks working
brettcannon Jun 11, 2026
6048670
Fix the `clean` and `build` commands
brettcannon Jul 9, 2026
19899cd
Get `wasmtime.toml` copied over
brettcannon Jul 9, 2026
1b5b8e7
Copy `python.wasm`
brettcannon Jul 9, 2026
feef36d
Copy `pythonN.Md-config`
brettcannon Jul 9, 2026
32f2bd0
Get the wasmtime script working
brettcannon Jul 10, 2026
fbf38fe
`ruff format`
brettcannon Jul 10, 2026
4f69a2a
Get at the WASI build version easily
brettcannon Jul 10, 2026
fd0464e
Remove reproducible build comments from _package.py
brettcannon Jul 10, 2026
b7c618f
Add archiving
brettcannon Jul 15, 2026
5ff44ba
Ignore dist/
brettcannon Jul 15, 2026
ff35f02
Merge branch 'main' into wasi-package
brettcannon Jul 15, 2026
fe5c640
Add quiet mode for pythoninfo commands in main function
brettcannon Jul 15, 2026
d2b5418
Fix archive function to correctly store mtime argument
brettcannon Jul 15, 2026
3742dcb
Update gather function to use dynamic Python versioning in logs
brettcannon Jul 15, 2026
7406160
Format wasmtime_script for better readability
brettcannon Jul 15, 2026
1cf4769
Update archive function log message for clarity
brettcannon Jul 15, 2026
cb0f034
Add comment to clarify use of `xz -T`
brettcannon Jul 16, 2026
5ed0e89
Merge remote-tracking branch 'upstream' into wasi-package
brettcannon Jul 22, 2026
1c28ad8
Reformat
brettcannon Jul 22, 2026
612174b
Make all imports lazy
brettcannon Jul 22, 2026
7b475a5
`ruff check`
brettcannon Jul 22, 2026
f89df22
Plug a hole where the lack of a WASI SDK didn't raise an exception
brettcannon Jul 22, 2026
abc9ea4
Actually delete the generated `Setup.local`
brettcannon Jul 22, 2026
3789b64
Fix archive function to use the correct file name and set working dir…
brettcannon Jul 22, 2026
d97c44f
Make symlinks relative
brettcannon Jul 22, 2026
d9cd409
Add error handling for multiple or missing WASI SDKs
brettcannon Jul 22, 2026
f2214f9
Fix build interpreter to read build details from the correct file path
brettcannon Jul 22, 2026
8222bf4
Enhance archive function to support SOURCE_DATE_EPOCH
brettcannon Jul 22, 2026
8c77179
`ruff format`
brettcannon Jul 22, 2026
7883611
Add `lib-dynload` to get rid of a warning when launching the REPL
brettcannon Jul 22, 2026
28126f4
`ruff format`
brettcannon Jul 22, 2026
d14bb0d
Merge branch 'main' into wasi-package
brettcannon Jul 22, 2026
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ Tools/unicode/data/
/config.status.lineno
/.ccache
/cross-build*/
/dist/
/jit_stencils*.h
/jit_unwind_info*.h
.jit-stamp
Expand Down
40 changes: 30 additions & 10 deletions Platforms/WASI/__main__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
#!/usr/bin/env python3

__lazy_modules__ = ["_build"]
__lazy_modules__ = [
"argparse",
"os",
"pathlib",
"_build",
"_package",
"_shared",
]

import argparse
import os
import pathlib

import _build

HERE = pathlib.Path(__file__).parent
import _package
import _shared


def main():
Expand All @@ -27,6 +32,7 @@ def main():
# may want to use them.
"--config {WASMTIME_CONFIG_PATH}"
)
context = _shared.Context()

parser = argparse.ArgumentParser()
subcommands = parser.add_subparsers(dest="subcommand")
Expand Down Expand Up @@ -59,6 +65,9 @@ def main():
pythoninfo_host = subcommands.add_parser(
"pythoninfo-host", help="Display build info of the host/WASI Python"
)
package = subcommands.add_parser(
"package", help="Package the host/WASI Python into an archive"
)
subcommands.add_parser(
"clean", help="Delete files and directories created by this script"
)
Expand All @@ -84,6 +93,8 @@ def main():
"--logdir",
type=pathlib.Path,
default=None,
dest="_log_path",
metavar="LOG-DIR",
help="Directory to store log files",
)
for subcommand in (
Expand Down Expand Up @@ -113,8 +124,9 @@ def main():
subcommand.add_argument(
"--wasi-sdk",
type=pathlib.Path,
dest="wasi_sdk_path",
dest="_wasi_sdk_path",
default=None,
metavar="WASI-SDK-PATH",
help="Path to the WASI SDK; defaults to WASI_SDK_PATH environment variable "
"or the appropriate version found in /opt",
)
Expand All @@ -132,16 +144,19 @@ def main():
make_host,
build_host,
pythoninfo_host,
package,
):
subcommand.add_argument(
"--host-triple",
action="store",
default=None,
dest="_host_triple",
metavar="WASI-TRIPLE",
help="The target triple for the WASI host build; "
f"defaults to the value found in {os.fsdecode(HERE / 'config.toml')}",
f"defaults to the value found in {os.fsdecode(context.here / 'config.toml')}",
)

context = parser.parse_args()
parser.parse_args(namespace=context)

match context.subcommand:
case "configure-build-python":
Expand All @@ -166,14 +181,19 @@ def main():
# Configure and build the build Python
_build.configure_build_python(context)
_build.make_build_python(context)
_build.pythoninfo_build_python(context)
if not context.quiet:
_build.pythoninfo_build_python(context)

# Configure and build the host/WASI Python
_build.configure_wasi_python(context)
_build.make_wasi_python(context)
_build.pythoninfo_wasi_python(context)
if not context.quiet:
_build.pythoninfo_wasi_python(context)
case "clean":
_build.clean_contents(context)
case "package":
_package.gather(context)
_package.archive(context)
case None:
parser.print_help()
case _:
Expand Down
Loading
Loading