Skip to content

Commit 473a517

Browse files
committed
generate all_wheels.zip
1 parent f82d0d5 commit 473a517

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

.github/workflows/build-packages.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
- name: Create GitHub Release for pyodide_bucket.bzl
5757
uses: ncipollo/release-action@v1
5858
with:
59-
artifacts: "packages/pyodide_bucket.bzl, packages/dist/pyodide-lock.json, packages/dist/pyodide_packages.tar.zip"
59+
artifacts: "packages/pyodide_bucket.bzl, packages/dist/pyodide-lock.json, packages/dist/pyodide_packages.tar.zip, packages/dist/all_wheels.zip"
6060
token: ${{ secrets.GITHUB_TOKEN }}
6161
tag: ${{ inputs.tag }}
6262
body: "Generated Bazel config file for release ${{ inputs.tag }}. Replace this file in workerd/build to update the Pyodide package bundle."

packages/script.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ def gen_bzl_config(tag, dist):
2121
bucket_url = "https://pub-45d734c4145d4285b343833ee450ef38.r2.dev/" + tag + "/"
2222
github_url = "https://github.com/cloudflare/pyodide-build-scripts/releases/download/" + tag + "/"
2323
lock_bytes = (dist / "pyodide-lock.json").read_bytes()
24-
lock_contents = (dist / "pyodide-lock.json").read_text()
2524
lock_hash = hashlib.sha256(lock_bytes).hexdigest()
2625
zip_bytes = (dist / "pyodide_packages.tar.zip").read_bytes()
2726
zip_hash = hashlib.sha256(zip_bytes).hexdigest()
27+
all_wheels_bytes = (dist / "all_wheels.zip").read_bytes()
28+
all_wheels_hash = hashlib.sha256(all_wheels_bytes).hexdigest()
2829

2930
with open("pyodide_bucket.bzl", "w") as f:
3031
f.write("# Do not edit this file by hand. See docs/pyodide.md for info on how to generate it.\n")
@@ -33,8 +34,8 @@ def gen_bzl_config(tag, dist):
3334
f.write("PYODIDE_PACKAGE_BUCKET_URL = \"" + bucket_url + "\"\n")
3435
f.write("PYODIDE_GITHUB_RELEASE_URL = \"" + github_url + "\"\n")
3536
f.write("PYODIDE_LOCK_SHA256 = \"" + lock_hash + "\"\n")
36-
f.write("PYODIDE_LOCK_CONTENTS = \"\"\"" + lock_contents + "\"\"\"\n")
3737
f.write("PYODIDE_PACKAGES_TAR_ZIP_SHA256 = \"" + zip_hash + "\"\n")
38+
f.write("PYODIDE_ALL_WHEELS_ZIP_SHA256 = \"" + all_wheels_hash + "\"\n")
3839

3940
# creates a package bundle .tar.zip file to be bundled in with edgeworker
4041
# the resulting bundle is written to dist/pyodide_packages.tar.zip
@@ -61,6 +62,11 @@ def make_bundle(tag, dist = Path("dist")):
6162
# create zip file in dist/ from tarfile
6263
with zipfile.ZipFile(dist / "pyodide_packages.tar.zip", "w", compression=zipfile.ZIP_DEFLATED) as zip:
6364
zip.write(tempdir / "pyodide_packages.tar", "pyodide_packages.tar")
65+
# create all_wheels.zip file for testing
66+
with zipfile.ZipFile(dist / "all_wheels.zip", "w", compression=zipfile.ZIP_DEFLATED) as zip:
67+
for package in lock["packages"].values():
68+
file = dist / package["file_name"]
69+
zip.write(file, f"{package['file_name']}")
6470

6571
gen_bzl_config(tag, dist)
6672

@@ -88,10 +94,10 @@ def upload_to_r2(tag, dist = Path("dist")):
8894
if status != 0:
8995
raise Exception("Failed to build recipes")
9096

91-
# get the current date in YYYYMMDD
92-
tag = datetime.today().strftime("%Y%m%d")
93-
if len(sys.argv) > 1:
94-
tag = sys.argv[1]
97+
if len(sys.argv) != 2:
98+
print("Usage: python script.py <tag>")
99+
sys.exit(1)
100+
tag = sys.argv[1]
95101

96102
make_bundle(tag)
97103
upload_to_r2(tag)

0 commit comments

Comments
 (0)