Skip to content

Commit

Permalink
Merge pull request #45 from vmware-labs/11-python-fixes
Browse files Browse the repository at this point in the history
Usability fix for `python.wasm` + added `python-wasmedge.wasm` binary.
  • Loading branch information
assambar authored Jan 27, 2023
2 parents 041a4dd + a32a6ed commit c8036b4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/release-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ jobs:
# supported by GitHub (https://github.com/community/community/discussions/37883)
if: startsWith(github.event.ref, format('refs/tags/python/{0}+', matrix.version))
run: make python/v${{ matrix.version }}
- name: Build Python Wasmedge
# Only run for the Python version specified in the git tag.
#
# This if could be moved to the parent `job` section when it's
# supported by GitHub (https://github.com/community/community/discussions/37883)
if: startsWith(github.event.ref, format('refs/tags/python/{0}+', matrix.version))
run: make python/wasmedge-v${{ matrix.version }}
- name: Rename release artifacts
# Only run for the Python version specified in the git tag.
#
Expand All @@ -40,6 +47,7 @@ jobs:
shell: bash
run: |
sudo mv python/build-output/python/v${{ matrix.version }}/bin/python{,-${{ matrix.version }}}.wasm
sudo mv python/build-output/python/v${{ matrix.version }}/bin/python{,-${{ matrix.version }}}-wasmedge.wasm
- name: Bundle Python with standard libraries
# Only run for the Python version specified in the git tag.
#
Expand All @@ -48,7 +56,7 @@ jobs:
if: startsWith(github.event.ref, format('refs/tags/python/{0}+', matrix.version))
run: |
pushd python/build-output/python/v${{ matrix.version }}
sudo zip -qq -r python-aio-${{ matrix.version }}.zip bin/python-${{ matrix.version }}.wasm usr
sudo zip -qq -r python-aio-${{ matrix.version }}.zip bin usr
popd
- name: Create release
# Only run for the Python version specified in the git tag.
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ python/v*:
python/wasmedge-v3.11.1:
WASMLABS_RUNTIME=wasmedge make -C python $(subst python/wasmedge-,,$@)

.PHONY: oci-python-3.11.1
oci-python-3.11.1: python/wasmedge-v3.11.1
docker build \
--build-arg BUILD_OUTPUT_BASE=python/build-output \
Expand Down
2 changes: 1 addition & 1 deletion images/python/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM scratch
ARG BUILD_OUTPUT_BASE=build-output
ARG PYTHON_TAG=v3.11.1
ARG PYTHON_BINARY=python.wasm
ARG PYTHON_BINARY=python-wasmedge.wasm
COPY ${BUILD_OUTPUT_BASE}/python/${PYTHON_TAG}/bin/${PYTHON_BINARY} /python.wasm
COPY ${BUILD_OUTPUT_BASE}/python/${PYTHON_TAG}/usr/ /usr

Expand Down
6 changes: 3 additions & 3 deletions python/v3.11.1/wl-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ logStatus "Preparing artifacts... "
TARGET_PYTHON_BINARY=${WASMLABS_OUTPUT}/bin/python${WASMLABS_RUNTIME:+-$WASMLABS_RUNTIME}.wasm

mkdir -p ${WASMLABS_OUTPUT}/bin 2>/dev/null || exit 1
mkdir -p ${WASMLABS_OUTPUT}/usr/local/lib 2>/dev/null || exit 1
mkdir -p ${WASMLABS_OUTPUT}/usr 2>/dev/null || exit 1

cp python-optimized.wasm ${TARGET_PYTHON_BINARY} || exit 1
cp usr/local/lib/python311.zip ${WASMLABS_OUTPUT}/usr/local/lib/ || exit 1
cp -v python-optimized.wasm ${TARGET_PYTHON_BINARY} || exit 1
cp -TRv usr ${WASMLABS_OUTPUT}/usr || exit 1

logStatus "DONE. Artifacts in ${WASMLABS_OUTPUT}"

0 comments on commit c8036b4

Please sign in to comment.