|
30 | 30 | 'powerpc64le-linux': 'manylinux_2_17_ppc64le.manylinux2014_ppc64le.musllinux_1_1_ppc64le',
|
31 | 31 | }
|
32 | 32 |
|
| 33 | +_YELLOW = "\033[93m" |
| 34 | + |
33 | 35 |
|
34 | 36 | class ReproducibleWheelFile(WheelFile):
|
35 | 37 | def writestr(self, zinfo_or_arcname, data, *args, **kwargs):
|
@@ -142,6 +144,10 @@ def write_ziglang_wheel(out_dir, *, version, platform, archive):
|
142 | 144 | ]
|
143 | 145 | license_regex = re.compile('|'.join(f'^{pattern}$' for pattern in license_patterns), re.IGNORECASE)
|
144 | 146 |
|
| 147 | + # These file paths MUST remain in sync with the paths in the official |
| 148 | + # Zig tarballs and with the ones defined below in the metadata. The |
| 149 | + # script will raise an error if any of these files are not found in |
| 150 | + # the archive. |
145 | 151 | required_license_paths = [
|
146 | 152 | 'LICENSE',
|
147 | 153 | 'lib/libc/glibc/LICENSES',
|
@@ -191,14 +197,20 @@ def write_ziglang_wheel(out_dir, *, version, platform, archive):
|
191 | 197 | # 1. Check for missing required licenses paths
|
192 | 198 | missing_licenses = set(required_license_paths) - found_license_files
|
193 | 199 | if missing_licenses:
|
194 |
| - print(f"\033[93mWarning: the following required license files were not found in the Zig archive: {', '.join(sorted(missing_licenses))} " |
195 |
| - "\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") |
| 200 | + error_message = ( |
| 201 | + f"{_YELLOW}The following required license files were not found in the Zig archive: {', '.join(sorted(missing_licenses))} " |
| 202 | + 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}" |
| 203 | + ) |
| 204 | + raise RuntimeError(error_message) |
196 | 205 |
|
197 | 206 | # 2. Check for potentially missing license files
|
198 | 207 | extra_licenses = potential_extra_licenses - set(required_license_paths)
|
199 | 208 | if extra_licenses:
|
200 |
| - print(f"\033[93mWarning: found additional potential license files in the Zig archive but not included in the metadata: {', '.join(sorted(extra_licenses))} " |
201 |
| - "\nPlease consider adding these to the license paths if they should be included.\033[0m") |
| 209 | + error_message = ( |
| 210 | + f"{_YELLOW}Found additional potential license files in the Zig archive but not included in the metadata: {', '.join(sorted(extra_licenses))} " |
| 211 | + f"\nPlease consider adding these to the license paths if they should be included.{_YELLOW}" |
| 212 | + ) |
| 213 | + raise RuntimeError(error_message) |
202 | 214 |
|
203 | 215 | with open('README.pypi.md') as f:
|
204 | 216 | description = f.read()
|
|
0 commit comments