Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
148 changes: 145 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions guests/python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ uuid.workspace = true
wasip2.workspace = true

[build-dependencies]
flate2 = "1.0.35"
sha2 = "0.10.8"
tar.workspace = true
ureq = "2.12.1"
walkdir = "2.5.0"

[lints]
Expand Down
41 changes: 1 addition & 40 deletions guests/python/Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ export PYO3_CROSS_LIB_DIR := DOWNLOADS_DIR / "python-sdk"
PYTHON_TMP_VENV := DOWNLOADS_DIR / "venv"
PYTHON_SITE_PACKAGES := PYO3_CROSS_LIB_DIR / "lib" / "python" + PYO3_CROSS_PYTHON_VERSION / "site-packages"

export WASI_SDK_LINK_PATH := DOWNLOADS_DIR / "wasi-sysroot" / "lib" / "wasm32-wasip2"

# download pre-built Python WASM SDK
[private]
download-python-sdk:
Expand Down Expand Up @@ -85,43 +83,6 @@ download-python-sdk:
set +x
echo ::endgroup::

# download WASI SDK because we need some libraries during the static linking phase
[private]
download-wasi-sdk:
#!/usr/bin/env bash
set -euo pipefail

echo ::group::guests::python::download-wasi-sdk
set -x

mkdir -p downloads
pushd downloads >/dev/null

# skip if already downloaded
if [ -d wasi-sysroot ]; then
echo "wasi sdk already present"
set +x
echo ::endgroup::
exit 0
fi

curl \
--fail \
--show-error \
--silent \
--proto '=https' \
--tlsv1.2 \
--location \
--output "wasi-sysroot.tar.gz" \
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-{{WASI_SDK_VERSION_MAJOR}}/wasi-sysroot-{{WASI_SDK_VERSION_MAJOR}}.{{WASI_SDK_VERSION_MINOR}}.tar.gz"

echo "{{SHA256_WASI_SDK_SYSROOT}} wasi-sysroot.tar.gz" | sha256sum -c
tar xf wasi-sysroot.tar.gz
mv wasi-sysroot-{{WASI_SDK_VERSION_MAJOR}}.{{WASI_SDK_VERSION_MINOR}} wasi-sysroot

set +x
echo ::endgroup::

[private]
python-site-packages: download-python-sdk
#!/usr/bin/env bash
Expand Down Expand Up @@ -158,7 +119,7 @@ python-site-packages: download-python-sdk
echo ::endgroup::

[private]
build-lib profile: download-python-sdk download-wasi-sdk python-site-packages
build-lib profile: download-python-sdk python-site-packages
@echo ::group::guests::python::build-lib {{profile}}
cargo build --target=wasm32-wasip2 --profile={{replace(profile, "debug", "dev")}}
@echo ::endgroup::
Expand Down
Loading