Skip to content

Commit 6a0f45a

Browse files
committed
bug fixes + do not upload large bundles to R2
1 parent f53bb77 commit 6a0f45a

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

packages/script.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,18 @@ def upload_to_r2(tag, dist = Path("dist")):
9393

9494
files_remaining = []
9595

96-
# upload entire dist directory to r2
96+
# upload entire dist directory to r2, excluding all_wheels.zip and pyodide_packages.tar.zip
9797
for root, dirs, files in os.walk(dist):
9898
for file in files:
99+
if file in {"all_wheels.zip", "pyodide_packages.tar.zip"}:
100+
continue
99101
path = Path(root) / file
100102
key = tag + "/" + str(path.relative_to(dist))
101103
files_remaining.append((path, key))
102104

103105
# attempt to upload each file 5 times. If after 5 attempts the file is still not accessible at pyodide.edgeworker.net then give up
104-
for i in range(5):
106+
ATTEMPTS = 5
107+
for i in range(ATTEMPTS):
105108
for (path, key) in files_remaining:
106109
print(f"uploading {path} to {key}")
107110
s3.upload_file(str(path), "python-package-bucket", key)
@@ -134,13 +137,14 @@ def upload_to_r2(tag, dist = Path("dist")):
134137
print(f"Failed to verify {path}: {e}. Retrying...")
135138
new_files_remaining.append((path, key))
136139

137-
if not new_files_remaining:
138-
break
140+
files_remaining = new_files_remaining
139141

140-
for (path, key) in new_files_remaining:
141-
s3.delete_object(Bucket="python-package-bucket", Key=key)
142+
if not files_remaining:
143+
break
142144

143-
files_remaining = new_files_remaining
145+
if i != ATTEMPTS - 1:
146+
for (path, key) in files_remaining:
147+
s3.delete_object(Bucket="python-package-bucket", Key=key)
144148

145149
if files_remaining:
146150
raise Exception("Failed to upload packages after 5 attempts: ", files_remaining)

0 commit comments

Comments
 (0)