Skip to content

Commit 136fc79

Browse files
committed
Handle Windows directory separators
1 parent c5ad381 commit 136fc79

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

bin/cibw_repair_wheel_licenses.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,20 @@ def arg_to_paths(license_file_arg: str) -> tuple[Path, Path]:
8484
index1 = glob1_str.index('*')
8585
part1_glob = glob1_str[:index1]
8686
part2_glob = glob1_str[index1+1:]
87-
path1_str = str(path1)
87+
path1_str = str(path1).replace('\\', '/')
8888
if len(part2_glob) != 0:
8989
wildcard = path1_str[len(part1_glob):-len(part2_glob)]
9090
else:
9191
wildcard = path1_str[len(part1_glob):]
92-
assert path1_str.startswith(part1_glob)
93-
assert path1_str.endswith(part2_glob)
94-
assert path1_str == part1_glob + wildcard + part2_glob
92+
assert path1_str.startswith(part1_glob), (
93+
f"{path1_str} does not start with {part1_glob}"
94+
)
95+
assert path1_str.endswith(part2_glob), (
96+
f"{path1_str} does not end with {part2_glob}"
97+
)
98+
assert path1_str == part1_glob + wildcard + part2_glob, (
99+
f"{path1_str} != {part1_glob} + {wildcard} + {part2_glob}"
100+
)
95101
path2_str = glob2_str.replace('*', wildcard)
96102

97103
return path1, Path(path2_str)

0 commit comments

Comments
 (0)