Skip to content

Commit 232271a

Browse files
committed
fix: Added normalize function for the wheels to correspond with PEP503
1 parent 8d4b610 commit 232271a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

upload_wheels.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,21 @@
2525

2626
wheels_subdirs = os.listdir(WHEELS_DIR)
2727

28+
29+
def normalize(name):
30+
return re.sub(r"[-_.]+", "-", name).lower()
31+
32+
2833
for subdir in wheels_subdirs:
2934
wheel_files = os.listdir(f"{WHEELS_DIR}{os.sep}{subdir}")
3035

3136
for wheel in wheel_files:
32-
pattern = re.compile(r"(\w*)-(\d+)")
37+
pattern = re.compile(r"^(.+?)-(\d+)")
3338
match = pattern.search(wheel)
3439
if match:
3540
wheel_name = match.group(1)
3641

37-
wheel_name = wheel_name.lower()
38-
wheel_name = wheel_name.replace("_", "-")
42+
wheel_name = normalize(wheel_name)
3943

4044
BUCKET.upload_file(f"{WHEELS_DIR}{os.sep}{subdir}{os.sep}{wheel}", f"pypi/{wheel_name}/{wheel}")
4145
print(f"Uploaded {wheel}")

0 commit comments

Comments
 (0)