forked from matplotlib/matplotlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate that LICENSE files are included in build wheels
- Loading branch information
1 parent
de2315b
commit 68d63ce
Showing
4 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python3 | ||
|
||
"""Check that all .whl files in the dist folder have the correct LICENSE files included. | ||
To run: | ||
$ python3 setup.py bdist_wheel | ||
$ ./ci/check_wheel_licenses.py | ||
""" | ||
|
||
from pathlib import Path | ||
import sys | ||
import zipfile | ||
|
||
EXIT_SUCCESS = 0 | ||
EXIT_FAILURE = 1 | ||
|
||
project_dir = Path(__file__).parent.resolve().parent | ||
dist_dir = project_dir / 'dist' | ||
license_dir = project_dir / 'LICENSE' | ||
|
||
license_file_names = [Path(path).name for path in sorted(license_dir.glob('*'))] | ||
for wheel in dist_dir.glob('*.whl'): | ||
print(f'Checking LICENSE files in: {wheel}') | ||
with zipfile.ZipFile(wheel) as f: | ||
wheel_license_file_names = [Path(path).name for path in sorted(f.namelist()) | ||
if '.dist-info/LICENSE' in path] | ||
if wheel_license_file_names != license_file_names: | ||
print(f'LICENSE file(s) missing:\n' | ||
f'{wheel_license_file_names} !=\n' | ||
f'{license_file_names}') | ||
sys.exit(EXIT_FAILURE) | ||
sys.exit(EXIT_SUCCESS) |