File tree Expand file tree Collapse file tree 4 files changed +36
-0
lines changed
Expand file tree Collapse file tree 4 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 6767 startsWith(github.ref, 'refs/heads/v3.3') ||
6868 startsWith(github.ref, 'refs/tags/v3.3') )
6969
70+ - name : Validate that LICENSE files are included in wheels
71+ run : |
72+ python ./ci/check_wheel_licenses.py
73+
7074 - uses : actions/upload-artifact@v2
7175 with :
7276 name : wheels
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+
3+ """Check that all .whl files in the dist folder have the correct LICENSE files included.
4+
5+ To run:
6+ $ python3 setup.py bdist_wheel
7+ $ ./ci/check_wheel_licenses.py
8+ """
9+
10+ from pathlib import Path
11+ import sys
12+ import zipfile
13+
14+ EXIT_SUCCESS = 0
15+ EXIT_FAILURE = 1
16+
17+ project_dir = Path (__file__ ).parent .resolve ().parent
18+ dist_dir = project_dir / 'dist'
19+ license_dir = project_dir / 'LICENSE'
20+
21+ license_file_names = [Path (path ).name for path in sorted (license_dir .glob ('*' ))]
22+ for wheel in dist_dir .glob ('*.whl' ):
23+ print (f'Checking LICENSE files in: { wheel } ' )
24+ with zipfile .ZipFile (wheel ) as f :
25+ wheel_license_file_names = [Path (path ).name for path in sorted (f .namelist ())
26+ if '.dist-info/LICENSE' in path ]
27+ if wheel_license_file_names != license_file_names :
28+ print (f'LICENSE file(s) missing:\n '
29+ f'{ wheel_license_file_names } !=\n '
30+ f'{ license_file_names } ' )
31+ sys .exit (EXIT_FAILURE )
32+ sys .exit (EXIT_SUCCESS )
You can’t perform that action at this time.
0 commit comments