Skip to content

Commit 16e02d4

Browse files
author
Rory Yorke
committed
Bundle licenses into wheels
1 parent 9d3bf77 commit 16e02d4

4 files changed

Lines changed: 66 additions & 77 deletions

File tree

COPYING

Lines changed: 0 additions & 17 deletions
This file was deleted.

gpl-2.0.txt renamed to LICENSE.txt

Lines changed: 19 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
Copyright (c) 2002-2009 NICONET e.V.
2+
Copyright 2010-2011 Enrico Avventi
3+
Copyright (C) 2012-2026 Slycot team
4+
5+
This program is free software; you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License version 2 as
7+
published by the Free Software Foundation.
8+
9+
This program is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU General Public License for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with this program; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17+
MA 02110-1301, USA.
18+
19+
120
GNU GENERAL PUBLIC LICENSE
221
Version 2, June 1991
322

@@ -278,62 +297,3 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278297
POSSIBILITY OF SUCH DAMAGES.
279298

280299
END OF TERMS AND CONDITIONS
281-
282-
How to Apply These Terms to Your New Programs
283-
284-
If you develop a new program, and you want it to be of the greatest
285-
possible use to the public, the best way to achieve this is to make it
286-
free software which everyone can redistribute and change under these terms.
287-
288-
To do so, attach the following notices to the program. It is safest
289-
to attach them to the start of each source file to most effectively
290-
convey the exclusion of warranty; and each file should have at least
291-
the "copyright" line and a pointer to where the full notice is found.
292-
293-
<one line to give the program's name and a brief idea of what it does.>
294-
Copyright (C) <year> <name of author>
295-
296-
This program is free software; you can redistribute it and/or modify
297-
it under the terms of the GNU General Public License as published by
298-
the Free Software Foundation; either version 2 of the License, or
299-
(at your option) any later version.
300-
301-
This program is distributed in the hope that it will be useful,
302-
but WITHOUT ANY WARRANTY; without even the implied warranty of
303-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304-
GNU General Public License for more details.
305-
306-
You should have received a copy of the GNU General Public License along
307-
with this program; if not, write to the Free Software Foundation, Inc.,
308-
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309-
310-
Also add information on how to contact you by electronic and paper mail.
311-
312-
If the program is interactive, make it output a short notice like this
313-
when it starts in an interactive mode:
314-
315-
Gnomovision version 69, Copyright (C) year name of author
316-
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317-
This is free software, and you are welcome to redistribute it
318-
under certain conditions; type `show c' for details.
319-
320-
The hypothetical commands `show w' and `show c' should show the appropriate
321-
parts of the General Public License. Of course, the commands you use may
322-
be called something other than `show w' and `show c'; they could even be
323-
mouse-clicks or menu items--whatever suits your program.
324-
325-
You should also get your employer (if you work as a programmer) or your
326-
school, if any, to sign a "copyright disclaimer" for the program, if
327-
necessary. Here is a sample; alter the names:
328-
329-
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330-
`Gnomovision' (which makes passes at compilers) written by James Hacker.
331-
332-
<signature of Ty Coon>, 1 April 1989
333-
Ty Coon, President of Vice
334-
335-
This General Public License does not permit incorporating your program into
336-
proprietary programs. If your program is a subroutine library, you may
337-
consider it more useful to permit linking proprietary applications with the
338-
library. If this is what you want to do, use the GNU Lesser General
339-
Public License instead of this License.

build-tools/cibw_before_build.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"""
1111

1212
import os
13+
import pathlib
1314
import shutil
1415
import subprocess
1516
import sys
@@ -44,11 +45,53 @@ def copy_libraries(project_root):
4445
shutil.copytree(src, dst)
4546

4647

48+
def copy_slicot_license(project_root):
49+
inname = os.path.join(project_root, "slycot", "src", "SLICOT-Reference", "LICENSE")
50+
outname = os.path.join(project_root, "LICENSE-SLICOT.txt")
51+
print(f'Copying license file {inname} to {outname}')
52+
shutil.copyfile(inname, outname)
53+
54+
55+
def copy_scipy_openblas32_licenses(project_root):
56+
from importlib.metadata import metadata, files
57+
58+
outname0 = os.path.join(project_root, "LICENSE-scipy-openblas32.txt")
59+
with open(outname0, "wt") as out:
60+
print(f'Creating license file {outname0} from scipy-openblas32 license data')
61+
out.write(metadata('scipy_openblas32')['License'])
62+
63+
license_files = [v
64+
for k, v in metadata('scipy_openblas32').items()
65+
if k=='License-File']
66+
if len(set(pathlib.Path(p).name for p in license_files)) != len(license_files):
67+
# distinguish by full path?
68+
raise ValueError('license files with duplicate names not handled')
69+
70+
ilicense = 0
71+
for license_file in license_files:
72+
matches = [p for p in files('scipy_openblas32') if license_file in str(p)]
73+
if len(matches) != 1:
74+
raise ValueError(f'Expect 1 match for {license_file}, found {len(matches)}')
75+
inname = matches[0].locate()
76+
with open(inname) as infile:
77+
data = infile.read()
78+
if data == metadata('scipy_openblas32')['License']:
79+
print(f'License file {inname} identical to license data, skipping')
80+
continue
81+
82+
outname = os.path.join(project_root, f"LICENSE-scipy-openblas32-{ilicense}.txt")
83+
print(f'Copying license file {inname} to {outname}')
84+
shutil.copyfile(inname, outname)
85+
ilicense += 1
86+
87+
4788
def main():
4889
version = sys.argv[1]
4990
project_root = sys.argv[2]
5091
install_openblas32(version)
5192
copy_libraries(project_root)
93+
copy_slicot_license(project_root)
94+
copy_scipy_openblas32_licenses(project_root)
5295

5396

5497
if __name__ == "__main__":

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ description = "A wrapper for the SLICOT control and systems library"
99
readme = "README.rst"
1010
authors = [{ name = "Enrico Avventi et al." }]
1111
maintainers = [{ name = "Slycot developers", email = "python-control-discuss@lists.sourceforge.net"}]
12-
license = "GPL-2.0 AND BSD-3-Clause"
12+
license = "GPL-2.0 AND BSD-3-Clause AND GPL-3.0-with-GCC-exception AND BSD-2-Clause"
13+
# the * is important: it allows adding SLICOT and OpenBLAS licenses when building wheels
14+
license-files = ["AUTHORS", "LICENSE*.txt"]
15+
1316
classifiers = [
1417
"Development Status :: 4 - Beta",
1518
"Intended Audience :: Science/Research",

0 commit comments

Comments
 (0)