Skip to content

Commit 6e57014

Browse files
authored
Merge pull request #7 from cloudflare/gen-package-lock
Generate package_lock bazel files
2 parents a5a31da + 6de8f01 commit 6e57014

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-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, packages/dist/all_wheels.zip"
59+
artifacts: "packages/dist/*"
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: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def gen_bzl_config(tag: str, dist: Path) -> None:
4545
packages = [package["name"] for package in lock["packages"].values()]
4646
imports_to_test = import_tests.gen(packages)
4747

48-
Path("pyodide_bucket.bzl").write_text(
48+
Path(dist / "pyodide_bucket.bzl").write_text(
4949
dedent(
5050
f"""
5151
# Do not edit this file by hand. See docs/pyodide.md for info on how to generate it.
@@ -57,15 +57,22 @@ def gen_bzl_config(tag: str, dist: Path) -> None:
5757
PYODIDE_LOCK_SHA256 = "{lock_hash}"
5858
PYODIDE_PACKAGES_TAR_ZIP_SHA256 = "{zip_hash}"
5959
PYODIDE_ALL_WHEELS_ZIP_SHA256 = "{all_wheels_hash}"
60+
"""
61+
).strip()
62+
)
6063

61-
# IMPORTANT: when updating this file in git, check the diff to make sure none of the imports below are being removed unexpectedly
64+
packages_lock_name = "packages_" + tag.replace(".", "_")
65+
packages_lock_name_upper = packages_lock_name.upper()
66+
packages_lock_json = json.dumps(imports_to_test, indent=3, sort_keys=True)
67+
Path(dist / (packages_lock_name + ".bzl")).write_text(
68+
dedent(
69+
f"""
70+
# This file is automatically generated by the Pyodide build script repo
71+
# (https://github.com/cloudflare/pyodide-build-scripts) and should not be manually modified.
6272
63-
PYODIDE_IMPORTS_TO_TEST =
73+
{packages_lock_name_upper} = {packages_lock_json}
6474
"""
6575
).strip()
66-
+ " "
67-
+ json.dumps(imports_to_test, indent=3, sort_keys=True)
68-
+ "\n"
6976
)
7077

7178

0 commit comments

Comments
 (0)