Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 830f4b1

Browse filesBrowse files
dopplershiftmeeseeksmachine
authored andcommitted
Backport PR #18298: Include license files in built distribution
1 parent 63e7554 commit 830f4b1
Copy full SHA for 830f4b1

File tree

Expand file treeCollapse file tree

5 files changed

+47
-0
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+47
-0
lines changed

‎.github/workflows/cibuildwheel.yml

Copy file name to clipboardExpand all lines: .github/workflows/cibuildwheel.yml
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ jobs:
3030
run: |
3131
python -m pip install cibuildwheel==1.5.5
3232
33+
- name: Copy setup.cfg to configure wheel
34+
run: |
35+
cp setup.cfg.template setup.cfg
36+
3337
- name: Build wheels for CPython
3438
run: |
3539
python -m cibuildwheel --output-dir dist
@@ -65,6 +69,10 @@ jobs:
6569
startsWith(github.ref, 'refs/heads/v3.3') ||
6670
startsWith(github.ref, 'refs/tags/v3.3') )
6771
72+
- name: Validate that LICENSE files are included in wheels
73+
run: |
74+
python ./ci/check_wheel_licenses.py
75+
6876
- uses: actions/upload-artifact@v2
6977
with:
7078
name: wheels
File renamed without changes.
File renamed without changes.

‎ci/check_wheel_licenses.py

Copy file name to clipboard
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env python3
2+
3+
"""
4+
Check that all .whl files in the dist folder have the correct LICENSE files
5+
included.
6+
7+
To run:
8+
$ cp setup.cfg.template setup.cfg
9+
$ python3 setup.py bdist_wheel
10+
$ ./ci/check_wheel_licenses.py
11+
"""
12+
13+
from pathlib import Path
14+
import sys
15+
import zipfile
16+
17+
EXIT_SUCCESS = 0
18+
EXIT_FAILURE = 1
19+
20+
project_dir = Path(__file__).parent.resolve().parent
21+
dist_dir = project_dir / 'dist'
22+
license_dir = project_dir / 'LICENSE'
23+
24+
license_file_names = [path.name for path in sorted(license_dir.glob('*'))]
25+
for wheel in dist_dir.glob('*.whl'):
26+
print(f'Checking LICENSE files in: {wheel}')
27+
with zipfile.ZipFile(wheel) as f:
28+
wheel_license_file_names = [Path(path).name
29+
for path in sorted(f.namelist())
30+
if '.dist-info/LICENSE' in path]
31+
if wheel_license_file_names != license_file_names:
32+
print(f'LICENSE file(s) missing:\n'
33+
f'{wheel_license_file_names} !=\n'
34+
f'{license_file_names}')
35+
sys.exit(EXIT_FAILURE)
36+
sys.exit(EXIT_SUCCESS)

‎setup.cfg.template

Copy file name to clipboardExpand all lines: setup.cfg.template
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Rename this file to setup.cfg to modify Matplotlib's build options.
22

3+
[metadata]
4+
license_files = LICENSE/*
5+
36
[egg_info]
47

58
[libs]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.