22import os
33import sys
44import subprocess
5+ import urllib .request
56
67from setuptools import setup , Extension
78from 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
7688setup (
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