Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GH-144533: Use wasmtime's --argv0 to auto-discover sysconfig in WASI builds#145328

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
savannahostrowski merged 3 commits intopython:mainfromsavannahostrowski:wasi-argv0
Feb 28, 2026
Merged
Show file tree
Hide file tree
Changes fromall commits
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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
Use wasmtime's ``--argv0`` to auto-discover sysconfig in WASI builds
19 changes: 3 additions & 16 deletionsPlatforms/WASI/__main__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -317,21 +317,8 @@ def configure_wasi_python(context, working_dir):

wasi_build_dir = working_dir.relative_to(CHECKOUT)

python_build_dir = BUILD_DIR / "build"
lib_dirs = list(python_build_dir.glob("lib.*"))
assert len(lib_dirs) == 1, (
f"Expected a single lib.* directory in {python_build_dir}"
)
lib_dir = os.fsdecode(lib_dirs[0])
python_version = lib_dir.rpartition("-")[-1]
sysconfig_data_dir = (
f"{wasi_build_dir}/build/lib.wasi-wasm32-{python_version}"
)

# Use PYTHONPATH to include sysconfig data which must be anchored to the
# WASI guest's `/` directory.
args = {
"PYTHONPATH": f"/{sysconfig_data_dir}",
"ARGV0": f"/{wasi_build_dir}/python.wasm",
"PYTHON_WASM": working_dir / "python.wasm",
}
# Check dynamically for wasmtime in case it was specified manually via
Expand DownExpand Up@@ -421,8 +408,8 @@ def main():
default_host_triple = config["targets"]["host-triple"]
default_host_runner = (
f"{WASMTIME_HOST_RUNNER_VAR} run "
#For setting PYTHONPATH tothe sysconfig data directory.
"--env PYTHONPATH={PYTHONPATH} "
#Set argv0 so that getpath.py can auto-discoverthe sysconfig data directory
"--argv0 {ARGV0} "
# Map the checkout to / to load the stdlib from /Lib.
f"--dir {os.fsdecode(CHECKOUT)}::/ "
# Flags involving --optimize, --codegen, --debug, --wasm, and --wasi can be kept
Expand Down
Loading

[8]ページ先頭

©2009-2026 Movatter.jp