8000 Backport PR #18298 on branch v3.3.x (Include license files in built distribution) by meeseeksmachine · Pull Request #18376 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Backport PR #18298 on branch v3.3.x (Include license files in built distribution) #18376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ jobs:
run: |
python -m pip install cibuildwheel==1.5.5

- name: Copy setup.cfg to configure wheel
run: |
cp setup.cfg.template setup.cfg

- name: Build wheels for CPython
run: |
python -m cibuildwheel --output-dir dist
Expand Down Expand Up @@ -65,6 +69,10 @@ jobs:
startsWith(github.ref, 'refs/heads/v3.3') ||
startsWith(github.ref, 'refs/tags/v3.3') )

- name: Validate that LICENSE files are included in wheels
run: |
python ./ci/check_wheel_licenses.py

- uses: actions/upload-artifact@v2
with:
name: wheels
Expand Down
File renamed without changes.
File renamed without changes.
36 changes: 36 additions & 0 deletions ci/check_wheel_licenses.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env python3

"""
Check that all .whl files in the dist folder have the correct LICENSE files
included.

To run:
$ cp setup.cfg.template setup.cfg
$ 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.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)
3 changes: 3 additions & 0 deletions setup.cfg.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Rename this file to setup.cfg to modify Matplotlib's build options.

[metadata]
license_files = LICENSE/*

[egg_info]

[libs]
Expand Down
0