Skip to content

Commit f32d4a0

Browse files
committed
Python: Print shasum when uploading bundles
1 parent c14893f commit f32d4a0

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.github/workflows/release-python-runtime.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ jobs:
1010
- uses: actions/checkout@v4
1111
with:
1212
show-progress: false
13+
- uses: actions/setup-python@v5
14+
with:
15+
python-version: '3.13'
1316
- name: Setup Linux
1417
if: runner.os == 'Linux'
1518
run: |
@@ -37,5 +40,5 @@ jobs:
3740
bazel build @workerd//src/pyodide:python_bundles @workerd//src/pyodide:bundle_version_info --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev
3841
# boto3 v1.36.0 fails with:
3942
# NotImplemented error occurred in CreateMultipartUpload operation: Header 'x-amz-checksum-algorithm' with value 'CRC32' not implemented
40-
pip install 'boto3<1.36.0'
43+
pip install 'boto3<1.36.0' requests
4144
python3 src/pyodide/upload_bundles.py

src/pyodide/upload_bundles.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import json
22
import subprocess
33
import sys
4+
from base64 import b64encode
45
from copy import deepcopy
56
from functools import cache
7+
from hashlib import file_digest
68
from os import environ
79
from pathlib import Path
810

@@ -80,6 +82,15 @@ def main():
8082
info["backport"] = b
8183
key = bundle_key(**info)
8284
print(f"Uploading version {ver} backport {b}")
85+
shasum = (
86+
"sha256-"
87+
+ b64encode(file_digest(path.open("rb"), "sha256").digest()).decode()
88+
)
89+
i = " " * 8
90+
print("Update python_metadata.bzl with:\n")
91+
print(i + f'"backport": "{b}",')
92+
print(i + f'"integrity": "{shasum}",')
93+
print()
8394
s3.upload_file(str(path), "pyodide-capnp-bin", key)
8495
return 0
8596

0 commit comments

Comments
 (0)