summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@gmail.com>2019-05-03 16:44:23 +0200
committerRalf Gommers <ralf.gommers@gmail.com>2019-05-04 21:06:07 +0200
commita08fb60447be61b9136ba64947b79e987f696001 (patch)
treed2e0923e98a0e8d2b8f634b0d378842016c32f67
parentf64ec0ca21466d3d461b88e232451c750982e9e6 (diff)
downloadnumpy-a08fb60447be61b9136ba64947b79e987f696001.tar.gz
LICENSE: split license file in standard BSD 3-clause and bundled.
Reason: the GitHub license detection method relies on the LICENSE file matching for at least 95% with a standard license. Adding even one more sentence changes the license displayed in the GitHub UI and also in the GitHub API that can be queried from BSD to "other". See https://github.com/numpy/numpy/issues/13447 for more details. Note that this split license is what GitHub recommends to do, and is also what we do for wheels, where we append to the license file at build time.
-rw-r--r--LICENSE.txt30
-rw-r--r--LICENSE_bundled.txt27
-rwxr-xr-xsetup.py35
3 files changed, 61 insertions, 31 deletions
diff --git a/LICENSE.txt b/LICENSE.txt
index b9731f734..5eae3201a 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -28,33 +28,3 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-
-The NumPy repository and source distributions bundle several libraries that are
-compatibly licensed. We list these here.
-
-Name: Numpydoc
-Files: doc/sphinxext/numpydoc/*
-License: 2-clause BSD
- For details, see doc/sphinxext/LICENSE.txt
-
-Name: scipy-sphinx-theme
-Files: doc/scipy-sphinx-theme/*
-License: 3-clause BSD, PSF and Apache 2.0
- For details, see doc/scipy-sphinx-theme/LICENSE.txt
-
-Name: lapack-lite
-Files: numpy/linalg/lapack_lite/*
-License: 3-clause BSD
- For details, see numpy/linalg/lapack_lite/LICENSE.txt
-
-Name: tempita
-Files: tools/npy_tempita/*
-License: BSD derived
- For details, see tools/npy_tempita/license.txt
-
-Name: dragon4
-Files: numpy/core/src/multiarray/dragon4.c
-License: One of a kind
- For license text, see numpy/core/src/multiarray/dragon4.c
diff --git a/LICENSE_bundled.txt b/LICENSE_bundled.txt
new file mode 100644
index 000000000..03d22521a
--- /dev/null
+++ b/LICENSE_bundled.txt
@@ -0,0 +1,27 @@
+The NumPy repository and source distributions bundle several libraries that are
+compatibly licensed. We list these here.
+
+Name: Numpydoc
+Files: doc/sphinxext/numpydoc/*
+License: 2-clause BSD
+ For details, see doc/sphinxext/LICENSE.txt
+
+Name: scipy-sphinx-theme
+Files: doc/scipy-sphinx-theme/*
+License: 3-clause BSD, PSF and Apache 2.0
+ For details, see doc/scipy-sphinx-theme/LICENSE.txt
+
+Name: lapack-lite
+Files: numpy/linalg/lapack_lite/*
+License: 3-clause BSD
+ For details, see numpy/linalg/lapack_lite/LICENSE.txt
+
+Name: tempita
+Files: tools/npy_tempita/*
+License: BSD derived
+ For details, see tools/npy_tempita/license.txt
+
+Name: dragon4
+Files: numpy/core/src/multiarray/dragon4.c
+License: One of a kind
+ For license text, see numpy/core/src/multiarray/dragon4.c
diff --git a/setup.py b/setup.py
index 1b7a60eac..b878900b1 100755
--- a/setup.py
+++ b/setup.py
@@ -186,12 +186,45 @@ def check_submodules():
raise ValueError('Submodule not clean: %s' % line)
+class concat_license_files():
+ """Merge LICENSE.txt and LICENSE_bundled.txt for sdist creation
+
+ Done this way to keep LICENSE.txt in repo as exact BSD 3-clause (see
+ gh-13447). This makes GitHub state correctly how NumPy is licensed.
+ """
+ def __init__(self):
+ self.f1 = 'LICENSE.txt'
+ self.f2 = 'LICENSE_bundled.txt'
+
+ def __enter__(self):
+ """Concatenate files and remove LICENSE_bundled.txt"""
+ with open(self.f1, 'r') as f1:
+ self.bsd_text = f1.read()
+
+ with open(self.f1, 'a') as f1:
+ with open(self.f2, 'r') as f2:
+ self.bundled_text = f2.read()
+ f1.write('\n\n')
+ f1.write(self.bundled_text)
+
+ os.remove(self.f2)
+
+ def __exit__(self, exception_type, exception_value, traceback):
+ """Restore content of both files"""
+ with open(self.f1, 'w') as f:
+ f.write(self.bsd_text)
+
+ with open(self.f2, 'w') as f:
+ f.write(self.bundled_text)
+
+
from distutils.command.sdist import sdist
class sdist_checked(sdist):
""" check submodules on sdist to prevent incomplete tarballs """
def run(self):
check_submodules()
- sdist.run(self)
+ with concat_license_files():
+ sdist.run(self)
def generate_cython():