FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.15] gh-151929: Add pythoninfo commands to Platforms/WASI (GH-152136) by miss-islington · Pull Request #152222 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) .yml  (1) All 2 file types selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
11 changes: 6 additions & 5 deletions .github/workflows/reusable-wasi.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jobs:
timeout-minutes: 60
env:
WASMTIME_VERSION: 38.0.3
CROSS_BUILD_PYTHON: cross-build/build
CROSS_BUILD_WASI: cross-build/wasm32-wasip1
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand Down Expand Up @@ -54,14 +53,16 @@ jobs:
run: python3 Platforms/WASI configure-build-python -- --config-cache --with-pydebug
- name: "Make build Python"
run: python3 Platforms/WASI make-build-python
- name: "Configure host"
- name: "Display build info of the build Python"
run: python3 Platforms/WASI pythoninfo-build
- name: "Configure host/WASI Python"
# `--with-pydebug` inferred from configure-build-python
run: python3 Platforms/WASI configure-host -- --config-cache
env:
WASI_SDK_PATH: ${{ steps.install-wasi-sdk.outputs.wasi-sdk-path }}
- name: "Make host"
- name: "Make host/WASI Python"
run: python3 Platforms/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 Platforms/WASI pythoninfo-host
- name: "Test"
run: make --directory "${CROSS_BUILD_WASI}" test
27 changes: 26 additions & 1 deletion Platforms/WASI/__main__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ def main():
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 "
Expand All @@ -53,6 +56,9 @@ def main():
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"
)
Expand All @@ -61,8 +67,10 @@ def main():
configure_build,
make_build,
build_python,
pythoninfo_build,
configure_host,
make_host,
pythoninfo_host,
build_host,
):
subcommand.add_argument(
Expand Down Expand Up @@ -118,7 +126,13 @@ def main():
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",
Expand All @@ -137,20 +151,31 @@ def main():
case "build-python":
_build.configure_build_python(context)
_build.make_build_python(context)
case "pythoninfo-build":
_build.pythoninfo_build_python(context)
case "configure-host":
_build.configure_wasi_python(context)
case "make-host":
_build.make_wasi_python(context)
case "build-host":
_build.configure_wasi_python(context)
_build.make_wasi_python(context)
case "pythoninfo-host":
_build.pythoninfo_wasi_python(context)
case "build":
# Configure and build the build Python
_build.configure_build_python(context)
_build.make_build_python(context)
_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)
case "clean":
_build.clean_contents(context)
case None:
parser.print_help()
case _:
raise ValueError(f"Unknown subcommand {context.subcommand!r}")

Expand Down
12 changes: 12 additions & 0 deletions Platforms/WASI/_build.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -418,3 +418,15 @@ def clean_contents(context):
if LOCAL_SETUP.exists():
if LOCAL_SETUP.read_bytes() == LOCAL_SETUP_MARKER:
log("🧹", f"Deleting generated {LOCAL_SETUP} ...")


@subdir(BUILD_DIR)
def pythoninfo_build_python(context, working_dir):
"""Display build info of the build Python."""
call(["make", "pythoninfo"], context=context)


@subdir(lambda context: CROSS_BUILD_DIR / host_triple(context))
def pythoninfo_wasi_python(context, working_dir):
"""Display build info of the host/WASI Python."""
call(["make", "pythoninfo"], context=context)
Loading

Back | FazBrowse Home | New Git URL