Skip to content

Commit 8d3aaa8

Browse files
Make both missing + extra licenses RuntimeError
1 parent 7c0d654 commit 8d3aaa8

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

make_wheels.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
'powerpc64le-linux': 'manylinux_2_17_ppc64le.manylinux2014_ppc64le.musllinux_1_1_ppc64le',
3030
}
3131

32+
_YELLOW = "\033[93m"
33+
3234

3335
class ReproducibleWheelFile(WheelFile):
3436
def writestr(self, zinfo_or_arcname, data, *args, **kwargs):
@@ -141,6 +143,10 @@ def write_ziglang_wheel(out_dir, *, version, platform, archive):
141143
]
142144
license_regex = re.compile('|'.join(f'^{pattern}$' for pattern in license_patterns), re.IGNORECASE)
143145

146+
# These file paths MUST remain in sync with the paths in the official
147+
# Zig tarballs and with the ones defined below in the metadata. The
148+
# script will raise an error if any of these files are not found in
149+
# the archive.
144150
required_license_paths = [
145151
'LICENSE',
146152
'lib/libc/glibc/LICENSES',
@@ -190,14 +196,14 @@ def write_ziglang_wheel(out_dir, *, version, platform, archive):
190196
# 1. Check for missing required licenses paths
191197
missing_licenses = set(required_license_paths) - found_license_files
192198
if missing_licenses:
193-
print(f"\033[93mWarning: the following required license files were not found in the Zig archive: {', '.join(sorted(missing_licenses))} "
194-
"\nThis may indicate a change in Zig's license file structure or an error in the listing of license files and/or paths.\033[0m")
199+
raise RuntimeError(f"{_YELLOW}The following required license files were not found in the Zig archive: {', '.join(sorted(missing_licenses))} "
200+
f"\nThis may indicate a change in Zig's license file structure or an error in the listing of license files and/or paths.{_YELLOW}")
195201

196202
# 2. Check for potentially missing license files
197203
extra_licenses = potential_extra_licenses - set(required_license_paths)
198204
if extra_licenses:
199-
raise RuntimeError(f"\033[93mFound additional potential license files in the Zig archive but not included in the metadata: {', '.join(sorted(extra_licenses))} "
200-
"\nPlease consider adding these to the license paths if they should be included.\033[0m")
205+
raise RuntimeError(f"f{_YELLOW}Found additional potential license files in the Zig archive but not included in the metadata: {', '.join(sorted(extra_licenses))} "
206+
f"\nPlease consider adding these to the license paths if they should be included.{_YELLOW}")
201207

202208
with open('README.pypi.md') as f:
203209
description = f.read()

0 commit comments

Comments
 (0)