@@ -21,10 +21,11 @@ def gen_bzl_config(tag, dist):
21
21
bucket_url = "https://pub-45d734c4145d4285b343833ee450ef38.r2.dev/" + tag + "/"
22
22
github_url = "https://github.com/cloudflare/pyodide-build-scripts/releases/download/" + tag + "/"
23
23
lock_bytes = (dist / "pyodide-lock.json" ).read_bytes ()
24
- lock_contents = (dist / "pyodide-lock.json" ).read_text ()
25
24
lock_hash = hashlib .sha256 (lock_bytes ).hexdigest ()
26
25
zip_bytes = (dist / "pyodide_packages.tar.zip" ).read_bytes ()
27
26
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 ()
28
29
29
30
with open ("pyodide_bucket.bzl" , "w" ) as f :
30
31
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):
33
34
f .write ("PYODIDE_PACKAGE_BUCKET_URL = \" " + bucket_url + "\" \n " )
34
35
f .write ("PYODIDE_GITHUB_RELEASE_URL = \" " + github_url + "\" \n " )
35
36
f .write ("PYODIDE_LOCK_SHA256 = \" " + lock_hash + "\" \n " )
36
- f .write ("PYODIDE_LOCK_CONTENTS = \" \" \" " + lock_contents + "\" \" \" \n " )
37
37
f .write ("PYODIDE_PACKAGES_TAR_ZIP_SHA256 = \" " + zip_hash + "\" \n " )
38
+ f .write ("PYODIDE_ALL_WHEELS_ZIP_SHA256 = \" " + all_wheels_hash + "\" \n " )
38
39
39
40
# creates a package bundle .tar.zip file to be bundled in with edgeworker
40
41
# the resulting bundle is written to dist/pyodide_packages.tar.zip
@@ -61,6 +62,11 @@ def make_bundle(tag, dist = Path("dist")):
61
62
# create zip file in dist/ from tarfile
62
63
with zipfile .ZipFile (dist / "pyodide_packages.tar.zip" , "w" , compression = zipfile .ZIP_DEFLATED ) as zip :
63
64
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' ]} " )
64
70
65
71
gen_bzl_config (tag , dist )
66
72
@@ -88,10 +94,10 @@ def upload_to_r2(tag, dist = Path("dist")):
88
94
if status != 0 :
89
95
raise Exception ("Failed to build recipes" )
90
96
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 ]
95
101
96
102
make_bundle (tag )
97
103
upload_to_r2 (tag )
0 commit comments