Skip to content

Commit ee511df

Browse files
Add 3rd party licenses to generated wheel
1 parent c9ccabc commit ee511df

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ tests/*.macro
1818
tests/*.root
1919
tests/*.csv
2020
tests/*.xml
21+
22+
# Generated 3rd party LICENSE file
23+
LICENSE-3RD-PARTY

Manifest.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
include README.md LICENSE pybind11/LICENSE
2+
exclude LICENSE-3RD-PARTY
23
graft pybind11/include
34
graft pybind11/tools
45
recursive-include source *

setup.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import sys
44
import subprocess
5+
import urllib.request
56

67
from setuptools import setup, Extension
78
from setuptools.command.build_ext import build_ext
@@ -69,9 +70,20 @@ def build_extension(self, ext):
6970
["cmake", "--build", "."] + build_args, cwd=self.build_temp
7071
)
7172

72-
readme = open("README.md", "r")
73-
long_desc = readme.read()
74-
readme.close()
73+
74+
with open("README.md", "r") as readme:
75+
long_desc = readme.read()
76+
77+
# Amalgamate 3rd party licenses
78+
with open("pybind11/LICENSE", "r") as license_file:
79+
licenses = license_file.read() + "\n\n\n"
80+
81+
with urllib.request.urlopen(
82+
"https://raw.githubusercontent.com/Geant4/geant4/v10.7.1/LICENSE") as resp:
83+
licenses += resp.read().decode("utf-8")
84+
85+
with open("LICENSE-3RD-PARTY", "w") as license_file:
86+
license_file.write(licenses)
7587

7688
setup(
7789
name="geant4_pybind",
@@ -83,7 +95,7 @@ def build_extension(self, ext):
8395
long_description_content_type="text/markdown",
8496
url="https://github.com/HaarigerHarald/geant4_pybind",
8597
license="Public Domain",
86-
python_requires='>=3.5, <4',
98+
python_requires=">=3.5, <4",
8799
ext_modules=[CMakeExtension("geant4_pybind")],
88100
cmdclass={"build_ext": CMakeBuild},
89101
zip_safe=False

0 commit comments

Comments
 (0)