11
11
import hashlib
12
12
from datetime import datetime
13
13
14
+ import import_tests
15
+
14
16
def normalize (name ):
15
17
return re .sub (r"[-_.]+" , "-" , name ).lower ()
16
18
@@ -27,6 +29,11 @@ def gen_bzl_config(tag, dist):
27
29
all_wheels_bytes = (dist / "all_wheels.zip" ).read_bytes ()
28
30
all_wheels_hash = hashlib .sha256 (all_wheels_bytes ).hexdigest ()
29
31
32
+ with open (dist / "pyodide-lock.json" , "r" ) as file :
33
+ lock = json .load (file )
34
+ packages = [package ["name" ] for package in lock ["packages" ].values ()]
35
+ imports_to_test = import_tests .gen (packages )
36
+
30
37
with open ("pyodide_bucket.bzl" , "w" ) as f :
31
38
f .write ("# Do not edit this file by hand. See docs/pyodide.md for info on how to generate it.\n " )
32
39
f .write ("# These variables are factored out here because they are being shared by the WORKSPACE files in\n " )
@@ -35,7 +42,9 @@ def gen_bzl_config(tag, dist):
35
42
f .write ("PYODIDE_GITHUB_RELEASE_URL = \" " + github_url + "\" \n " )
36
43
f .write ("PYODIDE_LOCK_SHA256 = \" " + lock_hash + "\" \n " )
37
44
f .write ("PYODIDE_PACKAGES_TAR_ZIP_SHA256 = \" " + zip_hash + "\" \n " )
38
- f .write ("PYODIDE_ALL_WHEELS_ZIP_SHA256 = \" " + all_wheels_hash + "\" \n " )
45
+ f .write ("PYODIDE_ALL_WHEELS_ZIP_SHA256 = \" " + all_wheels_hash + "\" \n \n " )
46
+ f .write ("# IMPORTANT: when updating this file in git, check the diff to make sure none of the imports below are being removed unexpectedly\n " )
47
+ f .write ("PYODIDE_IMPORTS_TO_TEST = " + json .dumps (imports_to_test , indent = 3 , sort_keys = True ) + "\n " )
39
48
40
49
# creates a package bundle .tar.zip file to be bundled in with edgeworker
41
50
# the resulting bundle is written to dist/pyodide_packages.tar.zip
0 commit comments