From 12327baab73517dc3c73c9232e15e47e90679e00 Mon Sep 17 00:00:00 2001 From: Meekail Zain <34613774+Micky774@users.noreply.github.com> Date: Tue, 27 Sep 2022 11:44:25 -0400 Subject: [PATCH 01/30] FIX: Updated dtype resolution in `_stack_along_minor_axis` (#16628) Co-authored-by: Julien Jerphanion Co-authored-by: Pamphile Roy Co-authored-by: Thomas J. Fan --- scipy/sparse/_construct.py | 13 ++++++-- scipy/sparse/tests/test_csr.py | 58 ++++++++++++++++++++++++++++++++-- 2 files changed, 66 insertions(+), 5 deletions(-) diff --git a/scipy/sparse/_construct.py b/scipy/sparse/_construct.py index 93d03e30d4e1..a87517338ae2 100644 --- a/scipy/sparse/_construct.py +++ b/scipy/sparse/_construct.py @@ -465,8 +465,16 @@ def _stack_along_minor_axis(blocks, axis): # Do the stacking indptr_list = [b.indptr for b in blocks] data_cat = np.concatenate([b.data for b in blocks]) - idx_dtype = get_index_dtype(arrays=indptr_list, - maxval=max(data_cat.size, constant_dim)) + + # Need to check if any indices/indptr, would be too large post- + # concatenation for np.int32: + # - The max value of indices is the output array's stacking-axis length - 1 + # - The max value in indptr is the number of non-zero entries. This is + # exceedingly unlikely to require int64, but is checked out of an + # abundance of caution. + sum_dim = sum(b.shape[axis] for b in blocks) + nnz = sum(len(b.indices) for b in blocks) + idx_dtype = get_index_dtype(maxval=max(sum_dim - 1, nnz)) stack_dim_cat = np.array([b.shape[axis] for b in blocks], dtype=idx_dtype) if data_cat.size > 0: indptr_cat = np.concatenate(indptr_list).astype(idx_dtype) @@ -483,7 +491,6 @@ def _stack_along_minor_axis(blocks, axis): indices = np.empty(0, dtype=idx_dtype) data = np.empty(0, dtype=data_cat.dtype) - sum_dim = stack_dim_cat.sum() if axis == 0: return csc_matrix((data, indices, indptr), shape=(sum_dim, constant_dim)) diff --git a/scipy/sparse/tests/test_csr.py b/scipy/sparse/tests/test_csr.py index 4a7e39fb34b0..5a05767fa5bb 100644 --- a/scipy/sparse/tests/test_csr.py +++ b/scipy/sparse/tests/test_csr.py @@ -1,7 +1,6 @@ import numpy as np from numpy.testing import assert_array_almost_equal, assert_ -from scipy.sparse import csr_matrix - +from scipy.sparse import csr_matrix, hstack import pytest @@ -113,3 +112,58 @@ def test_csr_bool_indexing(): assert (slice_list2 == slice_array2).all() assert (slice_list3 == slice_array3).all() + +def test_csr_hstack_int64(): + """ + Tests if hstack properly promotes to indices and indptr arrays to np.int64 + when using np.int32 during concatenation would result in either array + overflowing. + """ + max_int32 = np.iinfo(np.int32).max + + # First case: indices would overflow with int32 + data = [1.0] + row = [0] + + max_indices_1 = max_int32 - 1 + max_indices_2 = 3 + + # Individual indices arrays are representable with int32 + col_1 = [max_indices_1 - 1] + col_2 = [max_indices_2 - 1] + + X_1 = csr_matrix((data, (row, col_1))) + X_2 = csr_matrix((data, (row, col_2))) + + assert max(max_indices_1 - 1, max_indices_2 - 1) < max_int32 + assert X_1.indices.dtype == X_1.indptr.dtype == np.int32 + assert X_2.indices.dtype == X_2.indptr.dtype == np.int32 + + # ... but when concatenating their CSR matrices, the resulting indices + # array can't be represented with int32 and must be promoted to int64. + X_hs = hstack([X_1, X_2], format="csr") + + assert X_hs.indices.max() == max_indices_1 + max_indices_2 - 1 + assert max_indices_1 + max_indices_2 - 1 > max_int32 + assert X_hs.indices.dtype == X_hs.indptr.dtype == np.int64 + + # Even if the matrices are empty, we must account for their size + # contribution so that we may safely set the final elements. + X_1_empty = csr_matrix(X_1.shape) + X_2_empty = csr_matrix(X_2.shape) + X_hs_empty = hstack([X_1_empty, X_2_empty], format="csr") + + assert X_hs_empty.shape == X_hs.shape + assert X_hs_empty.indices.dtype == np.int64 + + # Should be just small enough to stay in int32 after stack. Note that + # we theoretically could support indices.max() == max_int32, but due to an + # edge-case in the underlying sparsetools code + # (namely the `coo_tocsr` routine), + # we require that max(X_hs_32.shape) < max_int32 as well. + # Hence we can only support max_int32 - 1. + col_3 = [max_int32 - max_indices_1 - 1] + X_3 = csr_matrix((data, (row, col_3))) + X_hs_32 = hstack([X_1, X_3], format="csr") + assert X_hs_32.indices.dtype == np.int32 + assert X_hs_32.indices.max() == max_int32 - 1 From 0204a3d4998ab95444896963aa406805cd21e39f Mon Sep 17 00:00:00 2001 From: Andrew Nelson Date: Tue, 23 Aug 2022 23:10:43 +1000 Subject: [PATCH 02/30] ENH: cibuildwheel infrastructure (#16842) We're interested in moving to the modern `cibuildwheel` machinery for the release/wheel build process, following NumPy/pandas, etc. [skip actions] [skip circleci] [skip ci] [skip azp] --- .github/workflows/wheels.yml | 215 ++++++ pyproject.toml | 34 +- tools/wheels/LICENSE_linux.txt | 880 +++++++++++++++++++++++ tools/wheels/LICENSE_osx.txt | 789 +++++++++++++++++++++ tools/wheels/LICENSE_win32.txt | 881 ++++++++++++++++++++++++ tools/wheels/check_license.py | 56 ++ tools/wheels/cibw_before_build_linux.sh | 13 + tools/wheels/cibw_before_build_macos.sh | 76 ++ tools/wheels/cibw_before_build_win.sh | 36 + tools/wheels/cibw_test_command.sh | 12 + tools/wheels/cross_arm64.txt | 19 + tools/wheels/gfortran_utils.sh | 171 +++++ tools/wheels/repair_windows.sh | 32 + tools/wheels/test.f | 3 + tools/wheels/test_requirements.txt | 12 + tools/wheels/upload_wheels.sh | 45 ++ 16 files changed, 3272 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/wheels.yml create mode 100644 tools/wheels/LICENSE_linux.txt create mode 100644 tools/wheels/LICENSE_osx.txt create mode 100644 tools/wheels/LICENSE_win32.txt create mode 100644 tools/wheels/check_license.py create mode 100644 tools/wheels/cibw_before_build_linux.sh create mode 100644 tools/wheels/cibw_before_build_macos.sh create mode 100644 tools/wheels/cibw_before_build_win.sh create mode 100644 tools/wheels/cibw_test_command.sh create mode 100644 tools/wheels/cross_arm64.txt create mode 100644 tools/wheels/gfortran_utils.sh create mode 100644 tools/wheels/repair_windows.sh create mode 100644 tools/wheels/test.f create mode 100644 tools/wheels/test_requirements.txt create mode 100644 tools/wheels/upload_wheels.sh diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml new file mode 100644 index 000000000000..cfdc144df9c3 --- /dev/null +++ b/.github/workflows/wheels.yml @@ -0,0 +1,215 @@ +# Workflow to build and test wheels. +# To work on the wheel building infrastructure on a fork, comment out: +# +# if: github.repository == 'scipy/scipy' +# +# in the get_commit_message job include [wheel build] in your commit +# message to trigger the build. All files related to wheel building are located +# at tools/wheels/ +name: Wheel builder + +on: + schedule: + # ┌───────────── minute (0 - 59) + # │ ┌───────────── hour (0 - 23) + # │ │ ┌───────────── day of the month (1 - 31) + # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) + # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) + # │ │ │ │ │ + - cron: "9 9 * * 6" + # push: + pull_request: + types: [labeled, opened, synchronize, reopened] + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + get_commit_message: + name: Get commit message + runs-on: ubuntu-latest + # TODO re-enable + # if: github.repository == 'scipy/scipy' + outputs: + message: ${{ steps.commit_message.outputs.message }} + steps: + - name: Checkout scipy + uses: actions/checkout@v3 + # Gets the correct commit message for pull request + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Get commit message + id: commit_message + run: | + set -xe + COMMIT_MSG=$(git log --no-merges -1 --oneline) + echo "::set-output name=message::$COMMIT_MSG" + echo github.ref ${{ github.ref }} + + build_wheels: + name: Build wheel for ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }} ${{ matrix.buildplat[2] }} + needs: get_commit_message + if: >- + contains(needs.get_commit_message.outputs.message, '[wheel build]') || + github.event_name == 'schedule' || + github.event_name == 'workflow_dispatch' || + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0'))) + runs-on: ${{ matrix.buildplat[0] }} + + strategy: + # Ensure that a wheel builder finishes even if another fails + fail-fast: false + matrix: + # Github Actions doesn't support pairing matrix values together, let's improvise + # https://github.com/github/feedback/discussions/7835#discussioncomment-1769026 + buildplat: + # should also be able to do multi-archs on a single entry, e.g. + # [windows-2019, win*, "AMD64 x86"]. However, those two require a different compiler setup + # so easier to separate out here. + - [ubuntu-20.04, manylinux, x86_64] + - [ubuntu-20.04, manylinux, aarch64] + + # When the macos-10.15 image is retired the gfortran/openblas chain + # may have to be reworked because the gfortran-4.9.0 compiler currently + # used in CI doesn't work in the macos-11.0 image. This will require a more + # recent gfortran (gfortran-9 is present on the macOS-11.0 image), and + # will probably require that the prebuilt openBLAS is updated. + # xref https://github.com/andyfaff/scipy/pull/28#issuecomment-1203496836 + - [macos-10.15, macosx, x86_64] + - [macos-12, macosx, arm64] + - [windows-2019, win, AMD64] + + python: [["cp38", "3.8"], ["cp39", "3.9"], ["cp310", "3.10"], ["cp311", "3.11.0-alpha - 3.11.0"]] + # python[0] is used to specify the python versions made by cibuildwheel + # python[1] is installed by actions/setup-python for the separate + # macosx_arm64 build. Once cibuildwheel can do the macosx_arm64 cross build + # we can get rid of this duplication and just have ["cp38", "cp39"]. + # The actions/setup-python can only use the form ["3.8']. + env: + IS_32_BIT: ${{ matrix.buildplat[2] == 'x86' }} + IS_PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }} + IS_SCHEDULE_DISPATCH: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} + + steps: + - name: Checkout scipy + uses: actions/checkout@v3 + with: + submodules: true + fetch-depth: 0 + + - uses: actions/setup-python@v4.2.0 + with: + python-version: ${{ matrix.python[1]}} + + - name: win_amd64 - install rtools + run: | + # mingw-w64 + choco install rtools --no-progress + echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH + if: ${{ runner.os == 'Windows' && env.IS_32_BIT == 'false' }} + +# - name: win32 - configure mingw for 32-bit builds +# run: | +# # taken from numpy wheels.yml script +# # Force 32-bit mingw. v 8.1.0 is the current version used to build +# # the 32 bit openBLAS library (not sure if that matters) +# choco uninstall mingw +# choco install -y mingw --forcex86 --force --version=8.1.0 +# echo "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw32\bin;" >> $env:GITHUB_PATH +# echo $(gfortran --version) +# echo $(gcc --version) +# if: ${{ runner.os == 'Windows' && env.IS_32_BIT == 'true' }} + + - name: Set up QEMU + if: ${{ runner.os == 'Linux' && matrix.buildplat[2] == 'aarch64' }} + uses: docker/setup-qemu-action@v1 + with: + platforms: all + + - name: Build wheels + uses: pypa/cibuildwheel@v2.9.0 + # Build all wheels here, but the macosx_arm64 job in its own entry. + # cibuildwheel is currently unable to pass configuration flags to + # CIBW_BUILD_FRONTEND https://github.com/pypa/cibuildwheel/issues/1227 + # (pip/build). Cross compilation with meson requires an initial + # configuration step to create a build directory. The subsequent wheel + # build then needs to use that directory. This can be done with pip + # using a command like: + # python -m pip wheel --config-settings builddir=build . + if: >- + ( ! contains(matrix.buildplat[2], 'arm64' ) ) + env: + CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}* + CIBW_ARCHS: ${{ matrix.buildplat[2] }} + CIBW_ENVIRONMENT_PASS_LINUX: RUNNER_OS + + - name: Build macosx_arm64 + if: ${{ matrix.buildplat[1] == 'macosx' && matrix.buildplat[2] == 'arm64' }} + run: | + export PLAT="arm64" + export _PYTHON_HOST_PLATFORM="macosx-12.0-arm64" + export CROSS_COMPILE=1 + + # Need macOS >= 11 for arm compilation. + export MACOSX_DEPLOYMENT_TARGET=11.0 + + # SDK root needs to be set early, installation of gfortran/openblas + # needs to go in the correct location. + export SDKROOT=/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk + export ARCHFLAGS=" -arch arm64 " + + # install dependencies for the build machine + pip install meson cython pybind11 pythran ninja oldest-supported-numpy build delocate meson-python + + # sets up gfortran compiler/openblas, sets compiler flags. + bash tools/wheels/cibw_before_build_macos.sh $(pwd) + export PKG_CONFIG_PATH=/opt/arm64-builds/lib/pkgconfig + export PKG_CONFIG=/usr/local/bin/pkg-config + export CFLAGS=" -arch arm64 $CFLAGS" + export CXXFLAGS=" -arch arm64 $CXXFLAGS" + export LD_LIBRARY_PATH="/opt/arm64-builds/lib:$FC_LIBDIR:$LD_LIBRARY_PATH" + meson setup --cross-file $(pwd)/tools/wheels/cross_arm64.txt build + + # use the pip frontend because the build front end does not end up + # obeying the configuration flags it's passed. + # For example: `python -m build -Cbuilddir=dir` does not end up using + # dir as the meson build directory. This is an issue because + # the cross-compile specification is contained in that directory. + + python -m pip wheel -w dist -vvv --config-settings builddir=build . + rm dist/numpy*.whl + + # The `.so` are all converted to `-rpath/libgfortran` by + # gfortran/meson, with all absolute paths removed. + # Enables delocate to find the libopenblas/libgfortran libraries. + export DYLD_LIBRARY_PATH=/opt/gfortran-darwin-arm64/lib/gcc/arm64-apple-darwin20.0.0/10.2.1:/opt/arm64-builds/lib + + delocate-listdeps dist/scipy*.whl + delocate-wheel --require-archs=arm64 -k -w wheelhouse dist/scipy*.whl + + - uses: actions/upload-artifact@v3 + with: + path: ./wheelhouse/*.whl + name: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }} + + # TODO uncomment when those responsible for uploading + # nightly/release wheels want to make this script live. + + # - name: Upload wheels + # if: success() + # shell: bash + # env: + # SCIPY_STAGING_UPLOAD_TOKEN: ${{ secrets.SCIPY_STAGING_UPLOAD_TOKEN }} + # SCIPY_NIGHTLY_UPLOAD_TOKEN: ${{ secrets.SCIPY_NIGHTLY_UPLOAD_TOKEN }} + # run: | + # source tools/wheels/upload_wheels.sh + # set_upload_vars + # # trigger an upload to + # # https://anaconda.org/scipy-wheels-nightly/scipy + # # for cron jobs or "Run workflow" (restricted to main branch). + # # Tags will upload to + # # https://anaconda.org/multibuild-wheels-staging/scipy + # # The tokens were originally generated at anaconda.org + # upload_wheels diff --git a/pyproject.toml b/pyproject.toml index bd607fb88bc6..339d7d72bee4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,7 @@ requires = [ # Note that 1.21.3 was the first version with a complete set of 3.10 wheels, # however macOS was broken and it's safe C API/ABI-wise to build against 1.21.6 # (see oldest-supported-numpy issues gh-28 and gh-45) - "numpy==1.21.6; python_version=='3.10' and (platform_machine!='win32' and platform_machine!='loongarch64') and platform_python_implementation != 'PyPy'", + "numpy==1.21.6; python_version=='3.10' and (platform_system!='Windows' and platform_machine!='loongarch64') and platform_python_implementation != 'PyPy'", "numpy==1.23.2; python_version=='3.11' and platform_python_implementation != 'PyPy'", # For Python versions which aren't yet officially supported, @@ -132,7 +132,37 @@ source = "https://github.com/scipy/scipy" download = "https://github.com/scipy/scipy/releases" tracker = "https://github.com/scipy/scipy/issues" - [tool.doit] dodoFile = "do.py" +[tool.cibuildwheel] +skip = "cp36-* cp37-* pp* *_ppc64le *_i686 *_s390x *-musllinux*" +build-verbosity = "3" +before-test = "pip install -r {project}/tools/wheels/test_requirements.txt" +test-command = "bash {project}/tools/wheels/cibw_test_command.sh {project}" + +[tool.cibuildwheel.linux] +manylinux-x86_64-image = "manylinux2014" +manylinux-aarch64-image = "manylinux2014" +before-build = "bash {project}/tools/wheels/cibw_before_build_linux.sh {project}" +test-skip = "*_aarch64" + +[tool.cibuildwheel.macos] +before-build = "bash {project}/tools/wheels/cibw_before_build_macos.sh {project}" +test-skip = "*_arm64 *_universal2:arm64" + +[tool.cibuildwheel.windows] +before-build = "bash {project}/tools/wheels/cibw_before_build_win.sh {project}" +repair-wheel-command = "bash ./tools/wheels/repair_windows.sh {wheel} {dest_dir}" + +[[tool.cibuildwheel.overrides]] +select = "*-win32" + +[[tool.cibuildwheel.overrides]] +select = "*-win_amd64" +# can use pkg-config detection for win_amd64 because the installed rtools +# provide a working pkg-config. +# An alternative is to set CMAKE_PREFIX_PATH="c:/opt/openblas/if_32/32" +# Don't use double backslash for path separators, they don't get passed +# to the build correctly +environment = { PKG_CONFIG_PATH="c:/opt/openblas/if_32/64/lib/pkgconfig" } diff --git a/tools/wheels/LICENSE_linux.txt b/tools/wheels/LICENSE_linux.txt new file mode 100644 index 000000000000..e4f810cd9cc1 --- /dev/null +++ b/tools/wheels/LICENSE_linux.txt @@ -0,0 +1,880 @@ + +---- + +This binary distribution of SciPy also bundles the following software: + + +Name: OpenBLAS +Files: .libs/libopenb*.so +Description: bundled as a dynamically linked library +Availability: https://github.com/xianyi/OpenBLAS/ +License: 3-clause BSD + Copyright (c) 2011-2014, The OpenBLAS Project + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. Neither the name of the OpenBLAS project nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, 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. + + +Name: LAPACK +Files: .libs/libopenb*.so +Description: bundled in OpenBLAS +Availability: https://github.com/xianyi/OpenBLAS/ +License 3-clause BSD + Copyright (c) 1992-2013 The University of Tennessee and The University + of Tennessee Research Foundation. All rights + reserved. + Copyright (c) 2000-2013 The University of California Berkeley. All + rights reserved. + Copyright (c) 2006-2013 The University of Colorado Denver. All rights + reserved. + + $COPYRIGHT$ + + Additional copyrights may follow + + $HEADER$ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer listed + in this license in the documentation and/or other materials + provided with the distribution. + + - Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + The copyright holders provide no reassurances that the source code + provided does not infringe any patent, copyright, or any other + intellectual property rights of third parties. The copyright holders + disclaim any liability to any recipient for claims brought against + recipient by any third party for infringement of that parties + intellectual property rights. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + 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. + + +Name: GCC runtime library +Files: .libs/libgfortran*.so +Description: dynamically linked to files compiled with gcc +Availability: https://gcc.gnu.org/viewcvs/gcc/ +License: GPLv3 + runtime exception + Copyright (C) 2002-2017 Free Software Foundation, Inc. + + Libgfortran is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + Libgfortran is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . + +---- + +Full text of license texts referred to above follows (that they are +listed below does not necessarily imply the conditions apply to the +present binary release): + +---- + +GCC RUNTIME LIBRARY EXCEPTION + +Version 3.1, 31 March 2009 + +Copyright (C) 2009 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +This GCC Runtime Library Exception ("Exception") is an additional +permission under section 7 of the GNU General Public License, version +3 ("GPLv3"). It applies to a given file (the "Runtime Library") that +bears a notice placed by the copyright holder of the file stating that +the file is governed by GPLv3 along with this Exception. + +When you use GCC to compile a program, GCC may combine portions of +certain GCC header files and runtime libraries with the compiled +program. The purpose of this Exception is to allow compilation of +non-GPL (including proprietary) programs to use, in this way, the +header files and runtime libraries covered by this Exception. + +0. Definitions. + +A file is an "Independent Module" if it either requires the Runtime +Library for execution after a Compilation Process, or makes use of an +interface provided by the Runtime Library, but is not otherwise based +on the Runtime Library. + +"GCC" means a version of the GNU Compiler Collection, with or without +modifications, governed by version 3 (or a specified later version) of +the GNU General Public License (GPL) with the option of using any +subsequent versions published by the FSF. + +"GPL-compatible Software" is software whose conditions of propagation, +modification and use would permit combination with GCC in accord with +the license of GCC. + +"Target Code" refers to output from any compiler for a real or virtual +target processor architecture, in executable form or suitable for +input to an assembler, loader, linker and/or execution +phase. Notwithstanding that, Target Code does not include data in any +format that is used as a compiler intermediate representation, or used +for producing a compiler intermediate representation. + +The "Compilation Process" transforms code entirely represented in +non-intermediate languages designed for human-written code, and/or in +Java Virtual Machine byte code, into Target Code. Thus, for example, +use of source code generators and preprocessors need not be considered +part of the Compilation Process, since the Compilation Process can be +understood as starting with the output of the generators or +preprocessors. + +A Compilation Process is "Eligible" if it is done using GCC, alone or +with other GPL-compatible software, or if it is done without using any +work based on GCC. For example, using non-GPL-compatible Software to +optimize any GCC intermediate representations would not qualify as an +Eligible Compilation Process. + +1. Grant of Additional Permission. + +You have permission to propagate a work of Target Code formed by +combining the Runtime Library with Independent Modules, even if such +propagation would otherwise violate the terms of GPLv3, provided that +all Target Code was generated by Eligible Compilation Processes. You +may then convey such a combination under terms of your choice, +consistent with the licensing of the Independent Modules. + +2. No Weakening of GCC Copyleft. + +The availability of this Exception does not imply any general +presumption that third-party software is unaffected by the copyleft +requirements of the license of GCC. + +---- + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/tools/wheels/LICENSE_osx.txt b/tools/wheels/LICENSE_osx.txt new file mode 100644 index 000000000000..63a5497ed7c6 --- /dev/null +++ b/tools/wheels/LICENSE_osx.txt @@ -0,0 +1,789 @@ + +---- + +This binary distribution of SciPy also bundles the following software: + + +Name: GCC runtime library +Files: .dylibs/* +Description: dynamically linked to files compiled with gcc +Availability: https://gcc.gnu.org/viewcvs/gcc/ +License: GPLv3 + runtime exception + Copyright (C) 2002-2017 Free Software Foundation, Inc. + + Libgfortran is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + Libgfortran is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . + +---- + +Full text of license texts referred to above follows (that they are +listed below does not necessarily imply the conditions apply to the +present binary release): + +---- + +GCC RUNTIME LIBRARY EXCEPTION + +Version 3.1, 31 March 2009 + +Copyright (C) 2009 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +This GCC Runtime Library Exception ("Exception") is an additional +permission under section 7 of the GNU General Public License, version +3 ("GPLv3"). It applies to a given file (the "Runtime Library") that +bears a notice placed by the copyright holder of the file stating that +the file is governed by GPLv3 along with this Exception. + +When you use GCC to compile a program, GCC may combine portions of +certain GCC header files and runtime libraries with the compiled +program. The purpose of this Exception is to allow compilation of +non-GPL (including proprietary) programs to use, in this way, the +header files and runtime libraries covered by this Exception. + +0. Definitions. + +A file is an "Independent Module" if it either requires the Runtime +Library for execution after a Compilation Process, or makes use of an +interface provided by the Runtime Library, but is not otherwise based +on the Runtime Library. + +"GCC" means a version of the GNU Compiler Collection, with or without +modifications, governed by version 3 (or a specified later version) of +the GNU General Public License (GPL) with the option of using any +subsequent versions published by the FSF. + +"GPL-compatible Software" is software whose conditions of propagation, +modification and use would permit combination with GCC in accord with +the license of GCC. + +"Target Code" refers to output from any compiler for a real or virtual +target processor architecture, in executable form or suitable for +input to an assembler, loader, linker and/or execution +phase. Notwithstanding that, Target Code does not include data in any +format that is used as a compiler intermediate representation, or used +for producing a compiler intermediate representation. + +The "Compilation Process" transforms code entirely represented in +non-intermediate languages designed for human-written code, and/or in +Java Virtual Machine byte code, into Target Code. Thus, for example, +use of source code generators and preprocessors need not be considered +part of the Compilation Process, since the Compilation Process can be +understood as starting with the output of the generators or +preprocessors. + +A Compilation Process is "Eligible" if it is done using GCC, alone or +with other GPL-compatible software, or if it is done without using any +work based on GCC. For example, using non-GPL-compatible Software to +optimize any GCC intermediate representations would not qualify as an +Eligible Compilation Process. + +1. Grant of Additional Permission. + +You have permission to propagate a work of Target Code formed by +combining the Runtime Library with Independent Modules, even if such +propagation would otherwise violate the terms of GPLv3, provided that +all Target Code was generated by Eligible Compilation Processes. You +may then convey such a combination under terms of your choice, +consistent with the licensing of the Independent Modules. + +2. No Weakening of GCC Copyleft. + +The availability of this Exception does not imply any general +presumption that third-party software is unaffected by the copyleft +requirements of the license of GCC. + +---- + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/tools/wheels/LICENSE_win32.txt b/tools/wheels/LICENSE_win32.txt new file mode 100644 index 000000000000..c93727261e45 --- /dev/null +++ b/tools/wheels/LICENSE_win32.txt @@ -0,0 +1,881 @@ + +---- + +This binary distribution of SciPy also bundles the following software: + + +Name: OpenBLAS +Files: extra-dll\libopenb*.dll +Description: bundled as a dynamically linked library +Availability: https://github.com/xianyi/OpenBLAS/ +License: 3-clause BSD + Copyright (c) 2011-2014, The OpenBLAS Project + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. Neither the name of the OpenBLAS project nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, 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. + + +Name: LAPACK +Files: extra-dll\libopenb*.dll +Description: bundled in OpenBLAS +Availability: https://github.com/xianyi/OpenBLAS/ +License 3-clause BSD + Copyright (c) 1992-2013 The University of Tennessee and The University + of Tennessee Research Foundation. All rights + reserved. + Copyright (c) 2000-2013 The University of California Berkeley. All + rights reserved. + Copyright (c) 2006-2013 The University of Colorado Denver. All rights + reserved. + + $COPYRIGHT$ + + Additional copyrights may follow + + $HEADER$ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer listed + in this license in the documentation and/or other materials + provided with the distribution. + + - Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + The copyright holders provide no reassurances that the source code + provided does not infringe any patent, copyright, or any other + intellectual property rights of third parties. The copyright holders + disclaim any liability to any recipient for claims brought against + recipient by any third party for infringement of that parties + intellectual property rights. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + 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. + + +Name: GCC runtime library +Files: extra-dll\*.dll +Description: statically linked, in DLL files compiled with gfortran only +Availability: https://gcc.gnu.org/viewcvs/gcc/ +License: GPLv3 + runtime exception + Copyright (C) 2002-2017 Free Software Foundation, Inc. + + Libgfortran is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + Libgfortran is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . + + +---- + +Full text of license texts referred to above follows (that they are +listed below does not necessarily imply the conditions apply to the +present binary release): + +---- + +GCC RUNTIME LIBRARY EXCEPTION + +Version 3.1, 31 March 2009 + +Copyright (C) 2009 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +This GCC Runtime Library Exception ("Exception") is an additional +permission under section 7 of the GNU General Public License, version +3 ("GPLv3"). It applies to a given file (the "Runtime Library") that +bears a notice placed by the copyright holder of the file stating that +the file is governed by GPLv3 along with this Exception. + +When you use GCC to compile a program, GCC may combine portions of +certain GCC header files and runtime libraries with the compiled +program. The purpose of this Exception is to allow compilation of +non-GPL (including proprietary) programs to use, in this way, the +header files and runtime libraries covered by this Exception. + +0. Definitions. + +A file is an "Independent Module" if it either requires the Runtime +Library for execution after a Compilation Process, or makes use of an +interface provided by the Runtime Library, but is not otherwise based +on the Runtime Library. + +"GCC" means a version of the GNU Compiler Collection, with or without +modifications, governed by version 3 (or a specified later version) of +the GNU General Public License (GPL) with the option of using any +subsequent versions published by the FSF. + +"GPL-compatible Software" is software whose conditions of propagation, +modification and use would permit combination with GCC in accord with +the license of GCC. + +"Target Code" refers to output from any compiler for a real or virtual +target processor architecture, in executable form or suitable for +input to an assembler, loader, linker and/or execution +phase. Notwithstanding that, Target Code does not include data in any +format that is used as a compiler intermediate representation, or used +for producing a compiler intermediate representation. + +The "Compilation Process" transforms code entirely represented in +non-intermediate languages designed for human-written code, and/or in +Java Virtual Machine byte code, into Target Code. Thus, for example, +use of source code generators and preprocessors need not be considered +part of the Compilation Process, since the Compilation Process can be +understood as starting with the output of the generators or +preprocessors. + +A Compilation Process is "Eligible" if it is done using GCC, alone or +with other GPL-compatible software, or if it is done without using any +work based on GCC. For example, using non-GPL-compatible Software to +optimize any GCC intermediate representations would not qualify as an +Eligible Compilation Process. + +1. Grant of Additional Permission. + +You have permission to propagate a work of Target Code formed by +combining the Runtime Library with Independent Modules, even if such +propagation would otherwise violate the terms of GPLv3, provided that +all Target Code was generated by Eligible Compilation Processes. You +may then convey such a combination under terms of your choice, +consistent with the licensing of the Independent Modules. + +2. No Weakening of GCC Copyleft. + +The availability of this Exception does not imply any general +presumption that third-party software is unaffected by the copyleft +requirements of the license of GCC. + +---- + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/tools/wheels/check_license.py b/tools/wheels/check_license.py new file mode 100644 index 000000000000..54815a395681 --- /dev/null +++ b/tools/wheels/check_license.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +""" +check_license.py [MODULE] + +Check the presence of a LICENSE.txt in the installed module directory, +and that it appears to contain text prevalent for a SciPy binary +distribution. + +""" +import os +import sys +import io +import re +import argparse + + +def check_text(text): + ok = "Copyright (c)" in text and re.search( + r"This binary distribution of \w+ also bundles the following software", + text, + re.IGNORECASE + ) + return ok + + +def main(): + p = argparse.ArgumentParser(usage=__doc__.rstrip()) + p.add_argument("module", nargs="?", default="scipy") + args = p.parse_args() + + # Drop '' from sys.path + sys.path.pop(0) + + # Find module path + __import__(args.module) + mod = sys.modules[args.module] + + # Check license text + license_txt = os.path.join(os.path.dirname(mod.__file__), "LICENSE.txt") + with io.open(license_txt, "r", encoding="utf-8") as f: + text = f.read() + + ok = check_text(text) + if not ok: + print( + "ERROR: License text {} does not contain expected " + "text fragments\n".format(license_txt) + ) + print(text) + sys.exit(1) + + sys.exit(0) + + +if __name__ == "__main__": + main() diff --git a/tools/wheels/cibw_before_build_linux.sh b/tools/wheels/cibw_before_build_linux.sh new file mode 100644 index 000000000000..f2f8f27692c6 --- /dev/null +++ b/tools/wheels/cibw_before_build_linux.sh @@ -0,0 +1,13 @@ +set -xe + +PROJECT_DIR="$1" +PLATFORM=$(PYTHONPATH=tools python -c "import openblas_support; print(openblas_support.get_plat())") + +printenv +# Update license +cat $PROJECT_DIR/tools/wheels/LICENSE_linux.txt >> $PROJECT_DIR/LICENSE.txt + +# Install Openblas +basedir=$(python tools/openblas_support.py) +cp -r $basedir/lib/* /usr/local/lib +cp $basedir/include/* /usr/local/include diff --git a/tools/wheels/cibw_before_build_macos.sh b/tools/wheels/cibw_before_build_macos.sh new file mode 100644 index 000000000000..82fc782aa651 --- /dev/null +++ b/tools/wheels/cibw_before_build_macos.sh @@ -0,0 +1,76 @@ +set -xe + +PROJECT_DIR="$1" +PLATFORM=$(PYTHONPATH=tools python -c "import openblas_support; print(openblas_support.get_plat())") +echo $PLATFORM + +# Update license +cat $PROJECT_DIR/tools/wheels/LICENSE_osx.txt >> $PROJECT_DIR/LICENSE.txt + +# Install Openblas +basedir=$(python tools/openblas_support.py) +cp -r $basedir/lib/* /usr/local/lib +cp $basedir/include/* /usr/local/include + +if [[ $RUNNER_OS == "macOS" && $PLATFORM == "macosx-arm64" ]]; then + # this version of openblas has the pkg-config file included. The version + # obtained from the openblas_support.py doesn't. + # Problems were experienced with meson->cmake detection of openblas when + # trying to cross compile. + curl -L https://anaconda.org/multibuild-wheels-staging/openblas-libs/v0.3.20-140-gbfd9c1b5/download/openblas-v0.3.20-140-gbfd9c1b5-macosx_11_0_arm64-gf_f26990f.tar.gz -o openblas.tar.gz + sudo tar -xv -C / -f openblas.tar.gz + + sudo mkdir -p /opt/arm64-builds/lib /opt/arm64-builds/include + sudo chown -R $USER /opt/arm64-builds + cp -r $basedir/lib/* /opt/arm64-builds/lib + cp $basedir/include/* /opt/arm64-builds/include +fi + +######################################################################################### +# Install GFortran + +if [[ $PLATFORM == "macosx-x86_64" ]]; then + #GFORTRAN=$(type -p gfortran-9) + #sudo ln -s $GFORTRAN /usr/local/bin/gfortran + # same version of gfortran as the openblas-libs and scipy-wheel builds + curl -L https://github.com/MacPython/gfortran-install/raw/master/archives/gfortran-4.9.0-Mavericks.dmg -o gfortran.dmg + GFORTRAN_SHA256=$(shasum -a 256 gfortran.dmg) + KNOWN_SHA256="d2d5ca5ba8332d63bbe23a07201c4a0a5d7e09ee56f0298a96775f928c3c4b30 gfortran.dmg" + if [ "$GFORTRAN_SHA256" != "$KNOWN_SHA256" ]; then + echo sha256 mismatch + exit 1 + fi + + hdiutil attach -mountpoint /Volumes/gfortran gfortran.dmg + sudo installer -pkg /Volumes/gfortran/gfortran.pkg -target / + otool -L /usr/local/gfortran/lib/libgfortran.3.dylib +fi + +# arm64 stuff from gfortran_utils +if [[ $PLATFORM == "macosx-arm64" ]]; then + source $PROJECT_DIR/tools/wheels/gfortran_utils.sh + export MACOSX_DEPLOYMENT_TARGET=11.0 + + # The install script requires the PLAT variable in order to set + # the FC variable + export PLAT=arm64 + install_arm64_cross_gfortran + export FC=$FC_ARM64 + export PATH=$FC_LOC:$PATH + # force a dynamic link, there may be a more elegant way of doing this. + rm /opt/arm64-builds/lib/*.a + + # required so that gfortran knows where to find the linking libraries. + export SDKROOT=/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk + # export SDKROOT=$(xcrun --show-sdk-path) + export FFLAGS=" -arch arm64 $FFLAGS" + export LDFLAGS=" $FC_ARM64_LDFLAGS $LDFLAGS -L/opt/arm64-builds/lib -arch arm64" + sudo ln -s $FC $FC_LOC/gfortran + echo $(type -p gfortran) + + # having a test fortran program has helped in debugging problems with the + # compiler environment. + $FC $FFLAGS $PROJECT_DIR/tools/wheels/test.f $LDFLAGS + ls -al *.out + otool -L a.out +fi diff --git a/tools/wheels/cibw_before_build_win.sh b/tools/wheels/cibw_before_build_win.sh new file mode 100644 index 000000000000..17e54086377d --- /dev/null +++ b/tools/wheels/cibw_before_build_win.sh @@ -0,0 +1,36 @@ +set -xe + +PROJECT_DIR="$1" +PLATFORM=$(PYTHONPATH=tools python -c "import openblas_support; print(openblas_support.get_plat())") + +printenv +# Update license +cat $PROJECT_DIR/tools/wheels/LICENSE_win32.txt >> $PROJECT_DIR/LICENSE.txt + +# Install Openblas +PYTHONPATH=tools python -c "import openblas_support; openblas_support.make_init('scipy')" +mkdir -p /c/opt/openblas/if_32/32/lib/pkgconfig +mkdir -p /c/opt/openblas/if_32/64/lib/pkgconfig + +# delvewheel is the equivalent of delocate/auditwheel for windows. +python -m pip install delvewheel + +# make the DLL available for tools/wheels/repair_windows.sh. If you change +# this location you need to alter that script. +mkdir -p /c/opt/openblas/openblas_dll +which strip + +# The 32/64 bit Fortran wheels are currently coming from different locations. +if [[ $PLATFORM == 'win-32' ]]; then + # 32-bit openBLAS + # Download 32 bit openBLAS and put it into c/opt/32/lib + target=$(python -c "import tools.openblas_support as obs; plat=obs.get_plat(); ilp64=obs.get_ilp64(); target=f'openblas_{plat}.zip'; obs.download_openblas(target, plat, ilp64);print(target)") + unzip $target -d /c/opt/openblas/if_32/ + cp /c/opt/openblas/if_32/32/bin/*.dll /c/opt/openblas/openblas_dll + # rm /c/opt/openblas/if_32/32/lib/*.dll.a +else + # 64-bit openBLAS + curl -L https://github.com/scipy/scipy-ci-artifacts/raw/main/openblas_32_if.zip -o openblas_32_if.zip + unzip openblas_32_if.zip -d /c + cp /c/opt/openblas/if_32/64/bin/*.dll /c/opt/openblas/openblas_dll +fi diff --git a/tools/wheels/cibw_test_command.sh b/tools/wheels/cibw_test_command.sh new file mode 100644 index 000000000000..519b13cdef53 --- /dev/null +++ b/tools/wheels/cibw_test_command.sh @@ -0,0 +1,12 @@ +set -xe + +PROJECT_DIR="$1" + +# python $PROJECT_DIR/tools/wheels/check_license.py +if [[ $(uname) == "Linux" || $(uname) == "Darwin" ]] ; then + python $PROJECT_DIR/tools/openblas_support.py --check_version +fi +echo $? + +python -c "import sys; import scipy; sys.exit(not scipy.test())" +echo $? diff --git a/tools/wheels/cross_arm64.txt b/tools/wheels/cross_arm64.txt new file mode 100644 index 000000000000..6e63e96e2b48 --- /dev/null +++ b/tools/wheels/cross_arm64.txt @@ -0,0 +1,19 @@ +# meson cross-compile file for macOS x86_64 build --> arm64 host. + +[binaries] + +# specification of the -arch arm64 options for clang are necessary because +# I don't think meson pays attention to the CFLAGS when cross-compiling. I +# found some `.so` were turning up with an x86_64 architecture. + +c = ['clang', '-arch', 'arm64'] +cpp = ['clang++', '-arch', 'arm64'] +strip = ['strip'] +fortran = ['/opt/gfortran-darwin-arm64/bin/arm64-apple-darwin20.0.0-gfortran'] +pkg-config = '/usr/local/bin/pkg-config' + +[host_machine] +system = 'Darwin' +cpu_family = 'aarch64' +cpu = 'arm64' +endian = 'little' diff --git a/tools/wheels/gfortran_utils.sh b/tools/wheels/gfortran_utils.sh new file mode 100644 index 000000000000..5bc7d19063d7 --- /dev/null +++ b/tools/wheels/gfortran_utils.sh @@ -0,0 +1,171 @@ +# This file is vendored from github.com/MacPython/gfortran-install It is +# licensed under BSD-2 which is copied as a comment below + +# Copyright 2016-2021 Matthew Brett, Isuru Fernando, Matti Picus + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: + +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. + +# Redistributions in binary form must reproduce the above copyright notice, this +# list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. + +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, 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. + +# Bash utilities for use with gfortran + +GF_LIB_URL="https://3f23b170c54c2533c070-1c8a9b3114517dc5fe17b7c3f8c63a43.ssl.cf2.rackcdn.com" +ARCHIVE_SDIR="${ARCHIVE_SDIR:-archives}" + +GF_UTIL_DIR=$(dirname "${BASH_SOURCE[0]}") + +function get_distutils_platform { + # Report platform as in form of distutils get_platform. + # This is like the platform tag that pip will use. + # Modify fat architecture tags on macOS to reflect compiled architecture + + # Deprecate this function once get_distutils_platform_ex is used in all + # downstream projects + local plat=$1 + case $plat in + i686|x86_64|arm64|universal2|intel|aarch64|s390x|ppc64le) ;; + *) echo Did not recognize plat $plat; return 1 ;; + esac + local uname=${2:-$(uname)} + if [ "$uname" != "Darwin" ]; then + if [ "$plat" == "intel" ]; then + echo plat=intel not allowed for Manylinux + return 1 + fi + echo "manylinux1_$plat" + return + fi + # macOS 32-bit arch is i386 + [ "$plat" == "i686" ] && plat="i386" + local target=$(echo $MACOSX_DEPLOYMENT_TARGET | tr .- _) + echo "macosx_${target}_${plat}" +} + +function get_distutils_platform_ex { + # Report platform as in form of distutils get_platform. + # This is like the platform tag that pip will use. + # Modify fat architecture tags on macOS to reflect compiled architecture + # For non-darwin, report manylinux version + local plat=$1 + local mb_ml_ver=${MB_ML_VER:-1} + case $plat in + i686|x86_64|arm64|universal2|intel|aarch64|s390x|ppc64le) ;; + *) echo Did not recognize plat $plat; return 1 ;; + esac + local uname=${2:-$(uname)} + if [ "$uname" != "Darwin" ]; then + if [ "$plat" == "intel" ]; then + echo plat=intel not allowed for Manylinux + return 1 + fi + echo "manylinux${mb_ml_ver}_${plat}" + return + fi + # macOS 32-bit arch is i386 + [ "$plat" == "i686" ] && plat="i386" + local target=$(echo $MACOSX_DEPLOYMENT_TARGET | tr .- _) + echo "macosx_${target}_${plat}" +} + +function get_macosx_target { + # Report MACOSX_DEPLOYMENT_TARGET as given by distutils get_platform. + python -c "import sysconfig as s; print(s.get_config_vars()['MACOSX_DEPLOYMENT_TARGET'])" +} + +function check_gfortran { + # Check that gfortran exists on the path + if [ -z "$(which gfortran)" ]; then + echo Missing gfortran + exit 1 + fi +} + +function get_gf_lib_for_suf { + local suffix=$1 + local prefix=$2 + local plat=${3:-$PLAT} + local uname=${4:-$(uname)} + if [ -z "$prefix" ]; then echo Prefix not defined; exit 1; fi + local plat_tag=$(get_distutils_platform_ex $plat $uname) + if [ -n "$suffix" ]; then suffix="-$suffix"; fi + local fname="$prefix-${plat_tag}${suffix}.tar.gz" + local out_fname="${ARCHIVE_SDIR}/$fname" + if [ ! -e "$out_fname" ]; then + curl -L "${GF_LIB_URL}/$fname" > $out_fname || (echo "Fetch of $out_fname failed"; exit 1) + fi + [ -s $out_fname ] || (echo "$out_fname is empty"; exit 24) + echo "$out_fname" +} + +if [ "$(uname)" == "Darwin" ]; then + mac_target=${MACOSX_DEPLOYMENT_TARGET:-$(get_macosx_target)} + export MACOSX_DEPLOYMENT_TARGET=$mac_target + GFORTRAN_DMG="${GF_UTIL_DIR}/archives/gfortran-4.9.0-Mavericks.dmg" + export GFORTRAN_SHA="$(shasum $GFORTRAN_DMG)" + + function install_arm64_cross_gfortran { + curl -L -O https://github.com/isuruf/gcc/releases/download/gcc-10-arm-20210728/gfortran-darwin-arm64.tar.gz + export GFORTRAN_SHA=4a1354e61294d5163609e83b6b2b082bd9a9bbdf + if [[ "$(shasum gfortran-darwin-arm64.tar.gz)" != "${GFORTRAN_SHA} gfortran-darwin-arm64.tar.gz" ]]; then + echo "shasum mismatch for gfortran-darwin-arm64" + exit 1 + fi + sudo mkdir -p /opt/ + sudo cp "gfortran-darwin-arm64.tar.gz" /opt/gfortran-darwin-arm64.tar.gz + pushd /opt + sudo tar -xvf gfortran-darwin-arm64.tar.gz + sudo rm gfortran-darwin-arm64.tar.gz + popd + export FC_ARM64="$(find /opt/gfortran-darwin-arm64/bin -name "*-gfortran")" + export FC_LOC=/opt/gfortran-darwin-arm64/bin + local libgfortran="$(find /opt/gfortran-darwin-arm64/lib -name libgfortran.dylib)" + local libdir=$(dirname $libgfortran) + + export FC_LIBDIR=$libdir + export FC_ARM64_LDFLAGS="-L$libdir -Wl,-rpath,$libdir" + echo $FC_ARM64_LDFLAGS + if [[ "${PLAT:-}" == "arm64" ]]; then + export FC=$FC_ARM64 + fi + } + function install_gfortran { + hdiutil attach -mountpoint /Volumes/gfortran $GFORTRAN_DMG + sudo installer -pkg /Volumes/gfortran/gfortran.pkg -target / + check_gfortran + if [[ "${PLAT:-}" == "universal2" || "${PLAT:-}" == "arm64" ]]; then + install_arm64_cross_gfortran + fi + } + + function get_gf_lib { + # Get lib with gfortran suffix + get_gf_lib_for_suf "gf_${GFORTRAN_SHA:0:7}" $@ + } +else + function install_gfortran { + # No-op - already installed on manylinux image + check_gfortran + } + + function get_gf_lib { + # Get library with no suffix + get_gf_lib_for_suf "" $@ + } +fi diff --git a/tools/wheels/repair_windows.sh b/tools/wheels/repair_windows.sh new file mode 100644 index 000000000000..42cba05c8ba6 --- /dev/null +++ b/tools/wheels/repair_windows.sh @@ -0,0 +1,32 @@ +set -xe + +WHEEL="$1" +DEST_DIR="$2" + +# create a temporary directory in the destination folder and unpack the wheel +# into there +pushd $DEST_DIR +mkdir -p tmp +pushd tmp +wheel unpack $WHEEL +pushd scipy* + +# To avoid DLL hell, the file name of libopenblas that's being vendored with +# the wheel has to be name-mangled. delvewheel is unable to name-mangle PYD +# containing extra data at the end of the binary, which frequently occurs when +# building with mingw. +# We therefore find each PYD in the directory structure and strip them. + +for f in $(find ./scipy* -name '*.pyd'); do strip $f; done + + +# now repack the wheel and overwrite the original +wheel pack . +mv -fv *.whl $WHEEL + +cd $DEST_DIR +rm -rf tmp + +# the libopenblas.dll is placed into this directory in the cibw_before_build +# script. +delvewheel repair --add-path /c/opt/openblas/openblas_dll -w $DEST_DIR $WHEEL diff --git a/tools/wheels/test.f b/tools/wheels/test.f new file mode 100644 index 000000000000..7b539dfd926b --- /dev/null +++ b/tools/wheels/test.f @@ -0,0 +1,3 @@ + program first + print *,'This is my first program' + end program first diff --git a/tools/wheels/test_requirements.txt b/tools/wheels/test_requirements.txt new file mode 100644 index 000000000000..e1147a884784 --- /dev/null +++ b/tools/wheels/test_requirements.txt @@ -0,0 +1,12 @@ +numpy +pytest +pytest-cov +pytest-xdist +asv +mpmath +threadpoolctl +pooch +# these two are currently commented out because there are wheels missing +# that makes the test script fail +# gmpy2 +# scikit-umfpack diff --git a/tools/wheels/upload_wheels.sh b/tools/wheels/upload_wheels.sh new file mode 100644 index 000000000000..e6fe2a3153d3 --- /dev/null +++ b/tools/wheels/upload_wheels.sh @@ -0,0 +1,45 @@ +# Copied from numpy version +# https://github.com/numpy/numpy/blob/main/tools/wheels/upload_wheels.sh + + +set_upload_vars() { + echo "IS_PUSH is $IS_PUSH" + echo "IS_SCHEDULE_DISPATCH is $IS_SCHEDULE_DISPATCH" + if [[ "$IS_PUSH" == "true" ]]; then + echo push and tag event + export ANACONDA_ORG="multibuild-wheels-staging" + export TOKEN="$SCIPY_STAGING_UPLOAD_TOKEN" + export ANACONDA_UPLOAD="true" + elif [[ "$IS_SCHEDULE_DISPATCH" == "true" ]]; then + echo scheduled or dispatched event + export ANACONDA_ORG="scipy-wheels-nightly" + export TOKEN="$SCIPY_NIGHTLY_UPLOAD_TOKEN" + export ANACONDA_UPLOAD="true" + else + echo non-dispatch event + export ANACONDA_UPLOAD="false" + fi +} +upload_wheels() { + echo ${PWD} + if [[ ${ANACONDA_UPLOAD} == true ]]; then + if [ -z ${TOKEN} ]; then + echo no token set, not uploading + else + python -m pip install \ + git+https://github.com/Anaconda-Platform/anaconda-client.git@be1e14936a8e947da94d026c990715f0596d7043 + # sdists are located under dist folder + if compgen -G "./dist/*.gz"; then + echo "Found sdist" + anaconda -q -t ${TOKEN} upload --skip -u ${ANACONDA_ORG} ./dist/*.gz + elif compgen -G "./wheelhouse/*.whl"; then + echo "Found wheel" + anaconda -q -t ${TOKEN} upload --skip -u ${ANACONDA_ORG} ./wheelhouse/*.whl + else + echo "Files do not exist" + return 1 + fi + echo "PyPI-style index: https://pypi.anaconda.org/$ANACONDA_ORG/simple" + fi + fi +} \ No newline at end of file From 461b992cd0d36430b47c7db6d6291cf1372c193a Mon Sep 17 00:00:00 2001 From: Andrew Nelson Date: Sat, 27 Aug 2022 08:48:54 +1000 Subject: [PATCH 03/30] MAINT: minimize, restore squeezed ((1.0)) --- scipy/optimize/_minimize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scipy/optimize/_minimize.py b/scipy/optimize/_minimize.py index 06e3f9cb88ae..8d7fdc0fdda3 100644 --- a/scipy/optimize/_minimize.py +++ b/scipy/optimize/_minimize.py @@ -520,7 +520,7 @@ def minimize(fun, x0, args=(), method=None, jac=None, hess=None, 'Currently, singleton dimensions will be removed from ' '`x0`, but an error will be raised in SciPy 1.11.0.') warn(message, DeprecationWarning, stacklevel=2) - x0 = np.squeeze(x0) + x0 = np.atleast_1d(np.squeeze(x0)) if x0.dtype.kind in np.typecodes["AllInteger"]: x0 = np.asarray(x0, dtype=float) From 705ee88b01cc8786b99efab072dc767c0f48c3c8 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Tue, 30 Aug 2022 11:58:35 -0700 Subject: [PATCH 04/30] Cast linear_sum_assignment to PyCFunction --- scipy/optimize/_lsap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scipy/optimize/_lsap.c b/scipy/optimize/_lsap.c index 0d47275921cb..26f2f27125f5 100644 --- a/scipy/optimize/_lsap.c +++ b/scipy/optimize/_lsap.c @@ -103,7 +103,7 @@ linear_sum_assignment(PyObject* self, PyObject* args, PyObject* kwargs) static PyMethodDef lsap_methods[] = { { "linear_sum_assignment", - linear_sum_assignment, + (PyCFunction)linear_sum_assignment, METH_VARARGS | METH_KEYWORDS, "Solve the linear sum assignment problem.\n" "\n" From da01adaead72e4463c60f27ccd73370eb12e60c4 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Wed, 31 Aug 2022 23:44:44 +0300 Subject: [PATCH 05/30] BLD: use compiler flags in a more portable way. Closes gh-16935 --- meson.build | 20 ++++-- scipy/_lib/_uarray/meson.build | 2 +- scipy/_lib/meson.build | 3 +- scipy/integrate/meson.build | 17 ++--- scipy/interpolate/meson.build | 20 ++---- scipy/io/meson.build | 9 +-- scipy/linalg/meson.build | 14 ++-- scipy/meson.build | 84 +++++++++++++++++++++--- scipy/odr/meson.build | 2 +- scipy/optimize/_highs/meson.build | 51 ++++---------- scipy/optimize/meson.build | 15 +---- scipy/signal/meson.build | 12 +--- scipy/sparse/linalg/_dsolve/meson.build | 23 +++---- scipy/sparse/linalg/_isolve/meson.build | 7 -- scipy/sparse/linalg/_propack/meson.build | 19 +++--- scipy/spatial/meson.build | 2 +- scipy/spatial/transform/meson.build | 2 +- scipy/special/meson.build | 18 ++--- scipy/stats/meson.build | 14 +--- 19 files changed, 157 insertions(+), 177 deletions(-) diff --git a/meson.build b/meson.build index 8e5541489d9a..f12055d20deb 100644 --- a/meson.build +++ b/meson.build @@ -11,10 +11,6 @@ project( 'buildtype=debugoptimized', 'c_std=c99', 'cpp_std=c++14', - # TODO: the below -Wno flags are all needed to silence warnings in - # f2py-generated code. This should be fixed in f2py itself. - 'c_args=-Wno-unused-function -Wno-conversion -Wno-misleading-indentation -Wno-incompatible-pointer-types', - 'fortran_args=-Wno-conversion', 'fortran_std=legacy', 'blas=openblas', 'lapack=openblas' @@ -23,12 +19,24 @@ project( cc = meson.get_compiler('c') cpp = meson.get_compiler('cpp') + # This argument is called -Wno-unused-but-set-variable by GCC, however Clang # doesn't recognize that. if cc.has_argument('-Wno-unused-but-set-variable') add_global_arguments('-Wno-unused-but-set-variable', language : 'c') endif +# TODO: the below -Wno flags are all needed to silence warnings in +# f2py-generated code. This should be fixed in f2py itself. +_global_c_args = cc.get_supported_arguments( + '-Wno-unused-but-set-variable', + '-Wno-unused-function', + '-Wno-conversion', + '-Wno-misleading-indentation', + '-Wno-incompatible-pointer-types', +) +add_project_arguments(_global_c_args, language : 'c') + # We need -lm for all C code (assuming it uses math functions, which is safe to # assume for SciPy). For C++ it isn't needed, because libstdc++/libc++ is # guaranteed to depend on it. For Fortran code, Meson already adds `-lm`. @@ -39,6 +47,10 @@ endif # Adding at project level causes many spurious -lgfortran flags. add_languages('fortran', native: false) +ff = meson.get_compiler('fortran') +if ff.has_argument('-Wno-conversion') + add_project_arguments('-Wno-conversion', language: 'fortran') +endif cython = find_program('cython') pythran = find_program('pythran') diff --git a/scipy/_lib/_uarray/meson.build b/scipy/_lib/_uarray/meson.build index dd66899fc654..56bc328fcfa0 100644 --- a/scipy/_lib/_uarray/meson.build +++ b/scipy/_lib/_uarray/meson.build @@ -1,7 +1,7 @@ py3.extension_module('_uarray', ['_uarray_dispatch.cxx', 'vectorcall.cxx'], - cpp_args: ['-Wno-terminate', '-Wno-unused-function'], dependencies: py3_dep, + cpp_args: [_cpp_Wno_terminate, _cpp_Wno_unused_function], install: true, subdir: 'scipy/_lib/_uarray' ) diff --git a/scipy/_lib/meson.build b/scipy/_lib/meson.build index b5cff6b5f242..b0e7ae9c39d1 100644 --- a/scipy/_lib/meson.build +++ b/scipy/_lib/meson.build @@ -20,10 +20,9 @@ lib_cython_gen = generator(cython_cli, output : '@BASENAME@.c', depends : [_cython_tree, _lib_pxd]) - py3.extension_module('_ccallback_c', lib_cython_gen.process('_ccallback_c.pyx'), - c_args: ['-Wno-discarded-qualifiers', cython_c_args], + c_args: [cython_c_args, Wno_discarded_qualifiers], include_directories: 'src', dependencies: py3_dep, install: true, diff --git a/scipy/integrate/meson.build b/scipy/integrate/meson.build index 651890758473..6b53ee7e0b7f 100644 --- a/scipy/integrate/meson.build +++ b/scipy/integrate/meson.build @@ -1,10 +1,3 @@ -fortran_ignore_warnings = [ - '-Wno-tabs', '-Wno-conversion', - '-Wno-argument-mismatch', '-Wno-unused-dummy-argument', - '-Wno-maybe-uninitialized', '-Wno-unused-label', - '-Wno-unused-variable' -] - mach_src = [ 'mach/d1mach.f', 'mach/xerror.f' @@ -92,19 +85,16 @@ quadpack_lib = static_library('quadpack_lib', lsoda_lib = static_library('lsoda_lib', lsoda_src, - c_args: '-Wno-unused-variable', fortran_args: fortran_ignore_warnings ) vode_lib = static_library('vode_lib', vode_src, - c_args: '-Wno-unused-variable', fortran_args: fortran_ignore_warnings ) dop_lib = static_library('dop_lib', dop_src, - c_args: '-Wno-unused-variable', fortran_args: fortran_ignore_warnings ) @@ -141,7 +131,7 @@ vode_module = custom_target('vode_module', py3.extension_module('_vode', [vode_module, fortranobject_c], link_with: [vode_lib], - c_args: [numpy_nodepr_api, '-Wno-unused-variable'], + c_args: [numpy_nodepr_api, Wno_unused_variable], include_directories: [inc_np, inc_f2py], dependencies: [py3_dep, lapack], install: true, @@ -160,6 +150,7 @@ py3.extension_module('_lsoda', link_with: [lsoda_lib, mach_lib], c_args: [numpy_nodepr_api, '-Wno-unused-variable'], dependencies: [py3_dep, lapack], + c_args: [numpy_nodepr_api, Wno_unused_variable], include_directories: [inc_np, inc_f2py], install: true, link_language: 'fortran', @@ -175,7 +166,7 @@ _dop_module = custom_target('_dop_module', py3.extension_module('_dop', [_dop_module, fortranobject_c], link_with: [dop_lib], - c_args: [numpy_nodepr_api, '-Wno-unused-variable'], + c_args: [numpy_nodepr_api, Wno_unused_variable], dependencies: [py3_dep], include_directories: [inc_np, inc_f2py], install: true, @@ -200,7 +191,7 @@ py3.extension_module('_test_odeint_banded', ['tests/banded5x5.f', fortranobject_c, _test_odeint_banded_module], c_args: numpy_nodepr_api, link_with: [lsoda_lib, mach_lib], - fortran_args: '-Wno-unused-dummy-argument', + fortran_args: _fflag_Wno_unused_dummy_argument, include_directories: [inc_np, inc_f2py], dependencies: [py3_dep, lapack], install: true, diff --git a/scipy/interpolate/meson.build b/scipy/interpolate/meson.build index 5b0bd440aa2a..352facf38cfc 100644 --- a/scipy/interpolate/meson.build +++ b/scipy/interpolate/meson.build @@ -90,12 +90,12 @@ fitpack_src = [ # TODO: Add flags for 64 bit ints fitpack_lib = static_library('fitpack_lib', fitpack_src, - fortran_args: '-Wno-maybe-uninitialized' + fortran_args: _fflag_Wno_maybe_uninitialized ) interpnd = py3.extension_module('interpnd', spt_cython_gen.process('interpnd.pyx'), - c_args: ['-Wno-discarded-qualifiers', cython_c_args], + c_args: [Wno_discarded_qualifiers, cython_c_args], include_directories: [incdir_numpy], dependencies: [py3_dep], install: true, @@ -141,7 +141,7 @@ dfitpack_module = custom_target('dfitpack_module', # TODO: Add flags for 64 bit ints dfitpack = py3.extension_module('dfitpack', [dfitpack_module, fortranobject_c], - c_args: [numpy_nodepr_api, '-Wno-unused-variable'], + c_args: [numpy_nodepr_api, Wno_unused_variable], include_directories: [incdir_numpy, incdir_f2py], dependencies: [py3_dep, lapack], link_with: [fitpack_lib], @@ -151,11 +151,6 @@ dfitpack = py3.extension_module('dfitpack', ) if use_pythran - if cc.has_argument('-Wno-unused-but-set-variable') - Wno_unused_but_set = ['-Wno-unused-but-set-variable'] - else - Wno_unused_but_set = [] - endif _rbfinterp_pythran = custom_target('_rbfinterp_pythran', output: ['_rbfinterp_pythran.cpp'], input: '_rbfinterp_pythran.py', @@ -163,13 +158,8 @@ if use_pythran ) _rbfinterp_pythran = py3.extension_module('_rbfinterp_pythran', - [_rbfinterp_pythran], - cpp_args: [ - '-Wno-unused-function', '-Wno-unused-variable', - '-Wno-deprecated-declarations', - '-Wno-cpp', '-Wno-int-in-bool-context', - Wno_unused_but_set - ] + cpp_args_pythran, + _rbfinterp_pythran, + cpp_args: cpp_args_pythran, include_directories: [incdir_pythran, incdir_numpy], dependencies: [py3_dep], install: true, diff --git a/scipy/io/meson.build b/scipy/io/meson.build index 6c0a82b77f87..e4b4add07393 100644 --- a/scipy/io/meson.build +++ b/scipy/io/meson.build @@ -1,10 +1,3 @@ -fortran_ignore_warnings = [ - '-Wno-tabs', '-Wno-conversion', - '-Wno-argument-mismatch', '-Wno-unused-dummy-argument', - '-Wno-maybe-uninitialized', '-Wno-unused-label', - '-Wno-unused-variable' -] - _test_fortran_module = custom_target('_test_fortran_module', output: ['_test_fortranmodule.c'], input: '_test_fortran.pyf', @@ -17,7 +10,7 @@ _test_fortran = py3.extension_module('_test_fortran', fortranobject_c, '_test_fortran.f' ], - c_args: [numpy_nodepr_api, '-Wno-unused-variable'], + c_args: [numpy_nodepr_api, Wno_unused_variable], fortran_args: fortran_ignore_warnings, include_directories: [incdir_numpy, incdir_f2py], dependencies: [py3_dep, lapack], diff --git a/scipy/linalg/meson.build b/scipy/linalg/meson.build index 4cb4a3634220..0dbd334137d0 100644 --- a/scipy/linalg/meson.build +++ b/scipy/linalg/meson.build @@ -77,16 +77,15 @@ flapack_module = custom_target('flapack_module', command: [py3, generate_f2pymod, '@INPUT@', '-o', '@OUTDIR@'] ) +# Note that -Wno-empty-body is Clang-specific and comes from `callstatement`s +# in flapack_other.pyf.src py3.extension_module('_flapack', [ flapack_module, fortranobject_c, g77_abi_wrappers, ], - c_args: [ - numpy_nodepr_api, - '-Wno-empty-body', # comes from `callstatement`s in flapack_other.pyf.src - ], + c_args: [numpy_nodepr_api, Wno_empty_body], include_directories: [inc_np, inc_f2py], dependencies: [py3_dep, lapack], install: true, @@ -162,10 +161,7 @@ py3.extension_module('_interpolative', fortranobject_c ], c_args: numpy_nodepr_api, - fortran_args: [ - '-Wno-tabs', '-Wno-conversion', '-Wno-argument-mismatch', - '-Wno-unused-dummy-argument', '-Wno-maybe-uninitialized' - ], + fortran_args: fortran_ignore_warnings, include_directories: [inc_np, inc_f2py], dependencies: [py3_dep, lapack], install: true, @@ -266,7 +262,7 @@ py3.extension_module('_matfuncs_expm', _cythonized_array_utils = py3.extension_module('_cythonized_array_utils', linalg_init_utils_cython_gen.process('_cythonized_array_utils.pyx'), - c_args: [cython_c_args, c_undefined_ok], + c_args: [cython_c_args, Wno_maybe_uninitialized], dependencies: [py3_dep], include_directories: [inc_np], install: true, diff --git a/scipy/meson.build b/scipy/meson.build index 086a44779d25..1e570a2fb85d 100644 --- a/scipy/meson.build +++ b/scipy/meson.build @@ -7,17 +7,17 @@ if is_windows # For mingw-w64, link statically against the UCRT. gcc_link_args = ['-lucrt', '-static'] if is_mingw - add_global_link_arguments(gcc_link_args, language: ['c', 'cpp']) + add_project_link_arguments(gcc_link_args, language: ['c', 'cpp']) # Force gcc to float64 long doubles for compatibility with MSVC # builds, for C only. - add_global_arguments('-mlong-double-64', language: 'c') + add_project_arguments('-mlong-double-64', language: 'c') # Make fprintf("%zd") work (see https://github.com/rgommers/scipy/issues/118) - add_global_arguments('-D__USE_MINGW_ANSI_STDIO=1', language: ['c', 'cpp']) + add_project_arguments('-D__USE_MINGW_ANSI_STDIO=1', language: ['c', 'cpp']) # Manual add of MS_WIN64 macro when not using MSVC. # https://bugs.python.org/issue28267 bitness = run_command('_build_utils/gcc_build_bitness.py').stdout().strip() if bitness == '64' - add_global_arguments('-DMS_WIN64', language: ['c', 'cpp', 'fortran']) + add_project_arguments('-DMS_WIN64', language: ['c', 'cpp', 'fortran']) endif # Silence warnings emitted by PyOS_snprintf for (%zd), see # https://github.com/rgommers/scipy/issues/118. @@ -25,14 +25,13 @@ if is_windows cython_c_args += ['-Wno-format-extra-args', '-Wno-format'] endif if meson.get_compiler('fortran').get_id() == 'gcc' - add_global_link_arguments(gcc_link_args, language: ['fortran']) + add_project_link_arguments(gcc_link_args, language: ['fortran']) # Flag needed to work around BLAS and LAPACK Gfortran dependence on # undocumented C feature when passing single character string # arguments. # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90329 # https://github.com/wch/r-source/blob/838f9d5a7be08f2a8c08e47bcd28756f5d0aac90/src/gnuwin32/MkRules.rules#L121 - add_global_arguments('-fno-optimize-sibling-calls', - language: ['fortran']) + add_project_arguments('-fno-optimize-sibling-calls', language: ['fortran']) endif endif @@ -91,6 +90,7 @@ else inc_pythran = [] endif +# Note: warning flags are added to this further down cpp_args_pythran = [ '-DENABLE_PYTHON_MODULE', '-D__PYTHRAN__=3', @@ -212,7 +212,75 @@ cython_gen_cpp = generator(cython_cli, output : '@BASENAME@.cpp', depends : [_cython_tree]) -c_undefined_ok = ['-Wno-maybe-uninitialized'] +# Check if compiler flags are supported. This is necessary to ensure that SciPy +# can be built with any supported compiler. We need so many warning flags +# because we want to be able to build with `-Werror` in CI; that ensures that +# for new code we add, there are no unexpected new issues introduced. +# +# Cleaning up code so we no longer need some of these warning flags is useful, +# but not a priority. +# +# The standard convention used here is: +# - for C, drop the leading dash and turn remaining dashes into underscores +# - for C++, prepend `_cpp` and turn remaining dashes into underscores +# - for Fortran, prepend `_fflags` and turn remaining dashes into underscores + +# C warning flags +Wno_maybe_uninitialized = cc.get_supported_arguments('-Wno-maybe-uninitialized') +Wno_discarded_qualifiers = cc.get_supported_arguments('-Wno-discarded-qualifiers') +Wno_empty_body = cc.get_supported_arguments('-Wno-empty-body') +Wno_implicit_function_declaration = cc.get_supported_arguments('-Wno-implicit-function-declaration') +Wno_parentheses = cc.get_supported_arguments('-Wno-parentheses') +Wno_switch = cc.get_supported_arguments('-Wno-switch') +Wno_unused_label = cc.get_supported_arguments('-Wno-unused-label') +Wno_unused_variable = cc.get_supported_arguments('-Wno-unused-variable') + +# C++ warning flags +_cpp_Wno_cpp = cpp.get_supported_arguments('-Wno-cpp') +_cpp_Wno_deprecated_declarations = cpp.get_supported_arguments('-Wno-deprecated-declarations') +_cpp_Wno_class_memaccess = cpp.get_supported_arguments('-Wno-class-memaccess') +_cpp_Wno_format_truncation = cpp.get_supported_arguments('-Wno-format-truncation') +_cpp_Wno_non_virtual_dtor = cpp.get_supported_arguments('-Wno-non-virtual-dtor') +_cpp_Wno_sign_compare = cpp.get_supported_arguments('-Wno-sign-compare') +_cpp_Wno_switch = cpp.get_supported_arguments('-Wno-switch') +_cpp_Wno_terminate = cpp.get_supported_arguments('-Wno-terminate') +_cpp_Wno_unused_but_set_variable = cpp.get_supported_arguments('-Wno-unused-but-set-variable') +_cpp_Wno_unused_function = cpp.get_supported_arguments('-Wno-unused-function') +_cpp_Wno_unused_local_typedefs = cpp.get_supported_arguments('-Wno-unused-local-typedefs') +_cpp_Wno_unused_variable = cpp.get_supported_arguments('-Wno-unused-variable') +_cpp_Wno_int_in_bool_context = cpp.get_supported_arguments('-Wno-int-in-bool-context') + +cpp_args_pythran += [ + _cpp_Wno_cpp, + _cpp_Wno_deprecated_declarations, + _cpp_Wno_unused_but_set_variable, + _cpp_Wno_unused_function, + _cpp_Wno_unused_variable, + _cpp_Wno_int_in_bool_context, +] + +# Fortran warning flags +_fflag_Wno_argument_mismatch = ff.get_supported_arguments('-Wno-argument-mismatch') +_fflag_Wno_conversion = ff.get_supported_arguments('-Wno-conversion') +_fflag_Wno_intrinsic_shadow = ff.get_supported_arguments('-Wno-intrinsic-shadow') +_fflag_Wno_maybe_uninitialized = ff.get_supported_arguments('-Wno-maybe-uninitialized') +_fflag_Wno_uninitialized = ff.get_supported_arguments('-Wno-uninitialized') +_fflag_Wno_unused_dummy_argument = ff.get_supported_arguments('-Wno-unused-dummy-argument') +_fflag_Wno_unused_label = ff.get_supported_arguments('-Wno-unused-label') +_fflag_Wno_unused_variable = ff.get_supported_arguments('-Wno-unused-variable') +_fflag_Wno_tabs = ff.get_supported_arguments('-Wno-tabs') +# The default list of warnings to ignore from Fortran code. There is a lot of +# old, vendored code that is very bad and we want to compile it silently (at +# least with GCC and Clang) +fortran_ignore_warnings = ff.get_supported_arguments( + _fflag_Wno_argument_mismatch, + _fflag_Wno_conversion, + _fflag_Wno_maybe_uninitialized, + _fflag_Wno_unused_dummy_argument, + _fflag_Wno_unused_label, + _fflag_Wno_unused_variable, + _fflag_Wno_tabs, +) # Suppress warning for deprecated Numpy API. # (Suppress warning messages emitted by #warning directives). diff --git a/scipy/odr/meson.build b/scipy/odr/meson.build index 5098b9637bd4..31e291035278 100644 --- a/scipy/odr/meson.build +++ b/scipy/odr/meson.build @@ -5,7 +5,7 @@ odrpack = static_library('odrpack', 'odrpack/d_odr.f', 'odrpack/dlunoc.f' ], - fortran_args: '-Wno-conversion', # silence "conversion from REAL(8) to INTEGER(4)" + fortran_args: _fflag_Wno_conversion, # silence "conversion from REAL(8) to INTEGER(4)" ) py3.extension_module('__odrpack', diff --git a/scipy/optimize/_highs/meson.build b/scipy/optimize/_highs/meson.build index 6cb930a92cf1..26e78677ad40 100644 --- a/scipy/optimize/_highs/meson.build +++ b/scipy/optimize/_highs/meson.build @@ -50,29 +50,18 @@ basiclu_lib = static_library('basiclu', '../../_lib/highs/src', '../../_lib/highs/src/ipm/basiclu/include' ], - c_args: [ - '-Wno-unused-variable', highs_define_macros - ] + c_args: [Wno_unused_variable, highs_define_macros] ) -# Deal with non-portable (or GCC-specific) compiler flags -if cc.has_argument('-Wno-unused-but-set-variable') - Wno_unused_but_set = ['-Wno-unused-but-set-variable'] -else - Wno_unused_but_set = [] -endif - highs_flags = [ - '-Wno-sign-compare', - '-Wno-switch', - '-Wno-non-virtual-dtor', + _cpp_Wno_class_memaccess, + _cpp_Wno_format_truncation, + _cpp_Wno_non_virtual_dtor, + _cpp_Wno_sign_compare, + _cpp_Wno_switch, + _cpp_Wno_unused_but_set_variable, + _cpp_Wno_unused_variable, ] -if cpp.has_argument('-Wno-format-truncation') - highs_flags += '-Wno-format-truncation' -endif -if cpp.has_argument('-Wno-class-memaccess') # added in GCC 8 - highs_flags += '-Wno-class-memaccess' -endif ipx_lib = static_library('ipx', [ @@ -115,11 +104,7 @@ ipx_lib = static_library('ipx', '../../_lib/highs/extern/', 'cython/src/' ], - cpp_args: [ - '-Wno-unused-variable', - highs_flags, - highs_define_macros - ] + cpp_args: [highs_flags, highs_define_macros] ) highs_lib = static_library('highs', @@ -235,11 +220,7 @@ highs_lib = static_library('highs', '../../_lib/highs/src/lp_data/', '../../_lib/highs/src/util/', ], - cpp_args: [ - '-Wno-unused-variable', - highs_flags, - highs_define_macros - ] + cpp_args: [highs_flags, highs_define_macros] ) _highs_wrapper = py3.extension_module('_highs_wrapper', @@ -255,17 +236,7 @@ _highs_wrapper = py3.extension_module('_highs_wrapper', ], link_with: [highs_lib, ipx_lib, basiclu_lib], dependencies: [py3_dep], - cpp_args: [ - '-Wno-unused-variable', - '-Wno-sign-compare', - '-Wno-switch', - '-Wno-format-truncation', - '-Wno-non-virtual-dtor', - '-Wno-class-memaccess', - Wno_unused_but_set, - highs_define_macros, - cython_c_args, - ], + cpp_args: [highs_flags, highs_define_macros, cython_c_args], install: true, subdir: 'scipy/optimize/_highs' ) diff --git a/scipy/optimize/meson.build b/scipy/optimize/meson.build index e4718ac4e13e..aeed5d622fb2 100644 --- a/scipy/optimize/meson.build +++ b/scipy/optimize/meson.build @@ -1,10 +1,4 @@ include_dirs = [inc_np, '../_lib/src'] -fortran_ignore_warnings = [ - '-Wno-tabs', '-Wno-conversion', - '-Wno-argument-mismatch', '-Wno-unused-dummy-argument', - '-Wno-maybe-uninitialized', '-Wno-unused-label', - '-Wno-unused-variable' -] _direct = py3.extension_module('_direct', ['_direct/direct_wrap.c', @@ -140,7 +134,8 @@ cobyla_module = custom_target('cobyla_module', _cobyla = py3.extension_module('_cobyla', [cobyla_module, fortranobject_c, 'cobyla/cobyla2.f', 'cobyla/trstlp.f'], - c_args: [numpy_nodepr_api, '-Wno-unused-variable'], + c_args: [numpy_nodepr_api, Wno_unused_variable], + [cobyla_module, 'cobyla/cobyla2.f', 'cobyla/trstlp.f'], fortran_args: fortran_ignore_warnings, include_directories: [inc_np, inc_f2py], dependencies: [py3_dep], @@ -215,11 +210,7 @@ if use_pythran _group_columns = py3.extension_module('_group_columns', [_group_columns], - cpp_args: [ - '-Wno-unused-function', '-Wno-unused-variable', - '-Wno-deprecated-declarations', - '-Wno-cpp', '-Wno-int-in-bool-context' - ] + cpp_args_pythran, + cpp_args: cpp_args_pythran, include_directories: [incdir_pythran, incdir_numpy], dependencies: [py3_dep], install: true, diff --git a/scipy/signal/meson.build b/scipy/signal/meson.build index 4c7cfb82fe0f..e232dafd90ef 100644 --- a/scipy/signal/meson.build +++ b/scipy/signal/meson.build @@ -35,11 +35,7 @@ if use_pythran _max_len_seq_inner = py3.extension_module('_max_len_seq_inner', [_max_len_seq_inner], - cpp_args: [ - '-Wno-unused-function', '-Wno-unused-variable', - '-Wno-deprecated-declarations', '-Wno-unused-local-typedefs', - '-Wno-cpp', '-Wno-int-in-bool-context' - ] + cpp_args_pythran, + cpp_args: [cpp_args_pythran, _cpp_Wno_unused_local_typedefs], include_directories: [incdir_pythran, incdir_numpy], dependencies: [py3_dep], install: true, @@ -54,11 +50,7 @@ if use_pythran _spectral = py3.extension_module('_spectral', [_spectral], - cpp_args: [ - '-Wno-unused-function', '-Wno-unused-variable', - '-Wno-deprecated-declarations', - '-Wno-cpp', '-Wno-int-in-bool-context' - ] + cpp_args_pythran, + cpp_args: cpp_args_pythran, include_directories: [incdir_pythran, incdir_numpy], dependencies: [py3_dep], install: true, diff --git a/scipy/sparse/linalg/_dsolve/meson.build b/scipy/sparse/linalg/_dsolve/meson.build index bd3c9daf5356..fe0232250382 100644 --- a/scipy/sparse/linalg/_dsolve/meson.build +++ b/scipy/sparse/linalg/_dsolve/meson.build @@ -1,11 +1,14 @@ +_superlu_lib_c_args = ['-DUSE_VENDOR_BLAS=1'] if is_windows - c_args = ['-DNO_TIMER=1'] -else - c_args = [] + _superlu_lib_c_args += ['-DNO_TIMER=1'] endif - -c_args += ['-DUSE_VENDOR_BLAS=1'] - +_superlu_lib_c_args += cc.get_supported_arguments( + Wno_unused_variable, + Wno_parentheses, + Wno_unused_label, + Wno_implicit_function_declaration, + Wno_switch, +) superlu_lib = static_library('superlu_lib', [ 'SuperLU/SRC/ccolumn_bmod.c', @@ -186,13 +189,7 @@ superlu_lib = static_library('superlu_lib', 'SuperLU/SRC/zsp_blas3.c', 'SuperLU/SRC/zutil.c' ], - c_args: [ - '-Wno-unused-variable', - '-Wno-parentheses', - '-Wno-unused-label', - '-Wno-implicit-function-declaration', - '-Wno-switch' - ], + c_args: _superlu_lib_c_args, include_directories: ['SuperLU/SRC'] ) diff --git a/scipy/sparse/linalg/_isolve/meson.build b/scipy/sparse/linalg/_isolve/meson.build index c2a8a2395980..31e24bb7ef83 100644 --- a/scipy/sparse/linalg/_isolve/meson.build +++ b/scipy/sparse/linalg/_isolve/meson.build @@ -1,10 +1,3 @@ -fortran_ignore_warnings = [ - '-Wno-tabs', '-Wno-conversion', - '-Wno-argument-mismatch', '-Wno-unused-dummy-argument', - '-Wno-maybe-uninitialized', '-Wno-unused-label', - '-Wno-unused-variable' -] - # Note: 3 source files in iterative/ are unused methods = [ 'iterative/BiCGREVCOM.f.src', diff --git a/scipy/sparse/linalg/_propack/meson.build b/scipy/sparse/linalg/_propack/meson.build index 2156710ec6fc..45e8b097dd49 100644 --- a/scipy/sparse/linalg/_propack/meson.build +++ b/scipy/sparse/linalg/_propack/meson.build @@ -1,11 +1,3 @@ -fortran_ignore_warnings = [ - '-Wno-tabs', '-Wno-conversion', - '-Wno-argument-mismatch', '-Wno-unused-dummy-argument', - '-Wno-maybe-uninitialized', '-Wno-unused-label', - '-Wno-unused-variable', - '-Wno-uninitialized', '-Wno-intrinsic-shadow' -] - s_src = [ 'PROPACK/single/printstat.F', 'PROPACK/single/sblasext.F', @@ -91,7 +83,11 @@ elements = [ foreach ele: elements propack_lib = static_library('lib_' + ele[0], ele[1], c_args: ['_OPENMP'], - fortran_args: fortran_ignore_warnings + fortran_args: [ + fortran_ignore_warnings, + _fflag_Wno_intrinsic_shadow, + _fflag_Wno_uninitialized, + ], ) propack_module = custom_target('propack_module' + ele[0], @@ -103,9 +99,10 @@ foreach ele: elements propacklib = py3.extension_module(ele[0], [propack_module, fortranobject_c], link_with: propack_lib, - c_args: ['-U_OPENMP', '-Wno-maybe-uninitialized', '-Wno-cpp'], - dependencies: [py3_dep, lapack], + c_args: ['-U_OPENMP', _cpp_Wno_cpp], + fortran_args: _fflag_Wno_maybe_uninitialized, include_directories: [inc_np, inc_f2py], + dependencies: [py3_dep, lapack], install: true, link_language: 'fortran', subdir: 'scipy/sparse/linalg/_propack' diff --git a/scipy/spatial/meson.build b/scipy/spatial/meson.build index 4503bd994155..2973df7160cf 100644 --- a/scipy/spatial/meson.build +++ b/scipy/spatial/meson.build @@ -90,7 +90,7 @@ _distance_pybind = py3.extension_module('_distance_pybind', _voronoi = py3.extension_module('_voronoi', [cython_gen.process('_voronoi.pyx')], - c_args: [cython_c_args, c_undefined_ok], + c_args: [cython_c_args, Wno_maybe_uninitialized], include_directories: [incdir_numpy], dependencies: [py3_dep], install: true, diff --git a/scipy/spatial/transform/meson.build b/scipy/spatial/transform/meson.build index 7bf887b8c772..9dc31238952b 100644 --- a/scipy/spatial/transform/meson.build +++ b/scipy/spatial/transform/meson.build @@ -1,6 +1,6 @@ rotation = py3.extension_module('_rotation', [cython_gen.process('_rotation.pyx')], - c_args: [cython_c_args, c_undefined_ok], + c_args: [cython_c_args, Wno_maybe_uninitialized], include_directories: [incdir_numpy], dependencies: [py3_dep], install: true, diff --git a/scipy/special/meson.build b/scipy/special/meson.build index 72beba8764f0..af3f84388710 100644 --- a/scipy/special/meson.build +++ b/scipy/special/meson.build @@ -289,26 +289,26 @@ cephes_lib = static_library('cephes', amos_lib = static_library('amos', amos_sources, - fortran_args: '-Wno-maybe-uninitialized' + fortran_args: _fflag_Wno_maybe_uninitialized ) cdflib_lib = static_library('cdflib', cdflib_sources, fortran_args: [ - '-Wno-maybe-uninitialized', - '-Wno-unused-label', - '-Wno-intrinsic-shadow' + _fflag_Wno_maybe_uninitialized, + _fflag_Wno_unused_label, + _fflag_Wno_intrinsic_shadow ] ) mach_lib = static_library('mach', mach_sources, - fortran_args: ['-Wno-unused-dummy-argument', '-Wno-maybe-uninitialized'] + fortran_args: [_fflag_Wno_unused_dummy_argument, _fflag_Wno_maybe_uninitialized] ) specfun_lib = static_library('specfun', 'specfun/specfun.f', - fortran_args: '-Wno-maybe-uninitialized' + fortran_args: _fflag_Wno_maybe_uninitialized ) specfun_module = custom_target('specfun_module', @@ -366,7 +366,7 @@ py3.extension_module('_ufuncs', ufuncs_sources, uf_cython_gen.process(cython_special[0]), # _ufuncs.pyx ], - c_args: [cython_c_args, use_math_defines, c_undefined_ok], + c_args: [cython_c_args, Wno_maybe_uninitialized], include_directories: [inc_np, '../_lib', '../_build_utils/src'], dependencies: [ py3_dep, @@ -416,7 +416,7 @@ py3.extension_module('_ufuncs_cxx', py3.extension_module('_ellip_harm_2', [uf_cython_gen.process('_ellip_harm_2.pyx'), 'sf_error.c'], - c_args: [cython_c_args, c_undefined_ok], + c_args: [cython_c_args, Wno_maybe_uninitialized], include_directories: [inc_np, '../_lib', '../_build_utils/src'], dependencies: [py3_dep, lapack], install: true, @@ -432,7 +432,7 @@ py3.extension_module('cython_special', 'specfun_wrappers.c', 'sf_error.c' ], - c_args: [cython_c_args, use_math_defines, c_undefined_ok], + c_args: [cython_c_args, Wno_maybe_uninitialized], include_directories: [inc_np, '../_lib', '../_build_utils/src', 'cephes'], dependencies: [py3_dep, npymath_lib, lapack], link_with: [ diff --git a/scipy/stats/meson.build b/scipy/stats/meson.build index 9539a26cbd66..2bc83919a097 100644 --- a/scipy/stats/meson.build +++ b/scipy/stats/meson.build @@ -1,10 +1,3 @@ -fortran_ignore_warnings = [ - '-Wno-tabs', '-Wno-conversion', - '-Wno-argument-mismatch', '-Wno-unused-dummy-argument', - '-Wno-maybe-uninitialized', '-Wno-unused-label', - '-Wno-unused-variable' -] - _stats_pxd = custom_target('_stats_pxd', output: [ '__init__.py', @@ -36,7 +29,7 @@ statlib_lib = static_library('statlib_lib', 'statlib/spearman.f', 'statlib/swilk.f' ], - fortran_args: '-Wno-unused-variable' + fortran_args: _fflag_Wno_unused_variable ) statlib_module = custom_target('statlib_module', @@ -169,10 +162,7 @@ if use_pythran _group_columns = py3.extension_module('_hypotests_pythran', _hypotests_pythran, - cpp_args: [ - '-Wno-unused-function', '-Wno-unused-variable', - '-Wno-deprecated-declarations', '-Wno-int-in-bool-context' - ] + cpp_args_pythran, + cpp_args: cpp_args_pythran, include_directories: [incdir_pythran, incdir_numpy], dependencies: [py3_dep], install: true, From 670782a2803cb7c7797d35c003082b29dde56029 Mon Sep 17 00:00:00 2001 From: Matt Haberland Date: Thu, 15 Sep 2022 01:53:46 -0700 Subject: [PATCH 06/30] MAINT: stats.mode: fix bug with `axis!=1`, `nan_policy='omit'`, `keepdims=False` (#16954) --- scipy/stats/_mstats_basic.py | 2 ++ scipy/stats/tests/test_stats.py | 20 +++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/scipy/stats/_mstats_basic.py b/scipy/stats/_mstats_basic.py index 8b95eaac405a..df7015e1b776 100644 --- a/scipy/stats/_mstats_basic.py +++ b/scipy/stats/_mstats_basic.py @@ -346,6 +346,8 @@ def _mode1D(a): slices[axis] = 1 counts = output[tuple(slices)].reshape(newshape) output = (modes, counts) + else: + output = np.moveaxis(output, axis, 0) return ModeResult(*output) diff --git a/scipy/stats/tests/test_stats.py b/scipy/stats/tests/test_stats.py index c8eaaeee0762..7945613656f9 100644 --- a/scipy/stats/tests/test_stats.py +++ b/scipy/stats/tests/test_stats.py @@ -2349,15 +2349,16 @@ def test_keepdims(self): # test nan_policy='omit' a = [[1, np.nan, np.nan, np.nan, 1], - [np.nan, np.nan, np.nan, np.nan, 2]] + [np.nan, np.nan, np.nan, np.nan, 2], + [1, 2, np.nan, 5, 5]] res = stats.mode(a, axis=1, keepdims=False, nan_policy='omit') - assert_array_equal(res.mode, [1, 2]) - assert_array_equal(res.count, [2, 1]) + assert_array_equal(res.mode, [1, 2, 5]) + assert_array_equal(res.count, [2, 1, 2]) res = stats.mode(a, axis=1, keepdims=True, nan_policy='omit') - assert_array_equal(res.mode, [[1], [2]]) - assert_array_equal(res.count, [[2], [1]]) + assert_array_equal(res.mode, [[1], [2], [5]]) + assert_array_equal(res.count, [[2], [1], [2]]) a = np.array(a) res = stats.mode(a, axis=None, keepdims=False, nan_policy='omit') @@ -2370,6 +2371,15 @@ def test_keepdims(self): assert_array_equal(res, ref) assert res.mode.shape == ref.mode.shape == (1,) + def test_gh16952(self): + # Check that bug reported in gh-16952 is resolved + shape = (4, 3) + data = np.ones(shape) + data[0, 0] = np.nan + res = stats.mode(a=data, axis=1, keepdims=False, nan_policy="omit") + assert_array_equal(res.mode, [1, 1, 1, 1]) + assert_array_equal(res.count, [2, 3, 3, 3]) + def test_mode_futurewarning(): a = [1, 2, 5, 3, 5] From 0df827a96da1608aaf6941cbee5afb0c51e6602f Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Tue, 6 Sep 2022 12:55:57 +0300 Subject: [PATCH 07/30] BLD: fix usage of `get_install_data`, which defaults to purelib This resulted in `{py_purelib}/` entries in `/meson-info/intro-install_plan.json`, and there should be zero of those. [skip azp] [skip circle] --- meson.build | 2 ++ scipy/linalg/meson.build | 6 +++--- scipy/meson.build | 4 ++-- scipy/special/meson.build | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index f12055d20deb..71230afa5f3e 100644 --- a/meson.build +++ b/meson.build @@ -60,6 +60,8 @@ copier = find_program(['cp', 'scipy/_build_utils/copyfiles.py']) # https://mesonbuild.com/Python-module.html py_mod = import('python') +# NOTE: with Meson >=0.64.0 we can add `pure: false` here and remove that line +# everywhere else, see https://github.com/mesonbuild/meson/pull/10783. py3 = py_mod.find_installation() # SciPy 1.9.0-specific error message, see the same message in # `scipy/__init__.py` and gh-14986 diff --git a/scipy/linalg/meson.build b/scipy/linalg/meson.build index 0dbd334137d0..3957545e54f3 100644 --- a/scipy/linalg/meson.build +++ b/scipy/linalg/meson.build @@ -28,7 +28,7 @@ cython_linalg = custom_target('cython_linalg', # TODO - we only want to install the .pxd files! See comments for # `pxd_files` further down. install: true, - install_dir: py3.get_install_dir() / 'scipy/linalg' + install_dir: py3.get_install_dir(pure: false) / 'scipy/linalg' ) # pyx -> c, pyx -> cpp generators, depending on __init__.py here. @@ -327,7 +327,7 @@ py3.install_sources( # https://mesonbuild.com/Installing.html says is for build targets to # use: # `custom_target(..., install: true, install_dir: ...) -# # should use `py3.get_install_dir() / 'scipy/linalg'` ? +# # should use `py3.get_install_dir(pure: false) / 'scipy/linalg'` ? # see https://github.com/mesonbuild/meson/issues/3206 # # For the below code to work, the script generating the files should use @@ -345,7 +345,7 @@ py3.install_sources( # output : ['cython_blas2.pxd', 'cython_lapack2.pxd'], # command : ['cp', '@INPUT0@', '@OUTPUT0@', '&&', 'cp', '@INPUT1@', '@OUTPUT1@'], # install : true, -# install_dir: py3.get_install_dir() / 'scipy/linalg' +# install_dir: py3.get_install_dir(pure: false) / 'scipy/linalg' #) subdir('tests') diff --git a/scipy/meson.build b/scipy/meson.build index 1e570a2fb85d..386b3528afe7 100644 --- a/scipy/meson.build +++ b/scipy/meson.build @@ -147,7 +147,7 @@ generate_config = custom_target( output: '__config__.py', input: '../tools/config_utils.py', command: [py3, '@INPUT@', '@OUTPUT@'], - install_dir: py3.get_install_dir() / 'scipy' + install_dir: py3.get_install_dir(pure: false) / 'scipy' ) generate_version = custom_target( @@ -158,7 +158,7 @@ generate_version = custom_target( output: 'version.py', input: '../tools/version_utils.py', command: [py3, '@INPUT@', '--source-root', '@SOURCE_ROOT@'], - install_dir: py3.get_install_dir() / 'scipy' + install_dir: py3.get_install_dir(pure: false) / 'scipy' ) python_sources = [ diff --git a/scipy/special/meson.build b/scipy/special/meson.build index af3f84388710..8407bc04ef42 100644 --- a/scipy/special/meson.build +++ b/scipy/special/meson.build @@ -347,7 +347,7 @@ cython_special = custom_target('cython_special', input: ['_generate_pyx.py', 'functions.json', '_add_newdocs.py'], command: [py3, '@INPUT0@', '-o', '@OUTDIR@'], install: true, - install_dir: py3.get_install_dir() / 'scipy/special' + install_dir: py3.get_install_dir(pure: false) / 'scipy/special' ) # pyx -> c, pyx -> cpp generators, depending on copied pxi, pxd files. @@ -494,7 +494,7 @@ foreach npz_file: npz_files '--use-timestamp', npz_file[2], '-o', '@OUTDIR@' ], install: true, - install_dir: py3.get_install_dir() / 'scipy/special/tests/data' + install_dir: py3.get_install_dir(pure: false) / 'scipy/special/tests/data' ) endforeach From 08cc962503d60f8667f3f53cce18dc0743dd40f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Est=C3=A8ve?= Date: Wed, 7 Sep 2022 09:31:40 +0200 Subject: [PATCH 08/30] DOC: Update numpy supported versions for 1.9.2 --- doc/source/dev/toolchain.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/source/dev/toolchain.rst b/doc/source/dev/toolchain.rst index ddffcec7aaac..b8b841871b0d 100644 --- a/doc/source/dev/toolchain.rst +++ b/doc/source/dev/toolchain.rst @@ -78,6 +78,8 @@ The table shows the NumPy versions suitable for each major Python version. 1.7.0/1 >=3.7, <3.10 >=1.16.5, <1.23.0 1.7.2-x >=3.7, <3.11 >=1.16.5, <1.24.0 1.8 >=3.8, <3.11 >=1.17.3, <1.24.0 + 1.9.0/1 >=3.8, <3.12 >=1.18.5, <1.25.0 + 1.9.2 >=3.8, <3.12 >=1.18.5, <1.26.0 ================= ======================== ======================= In specific cases, such as a particular architecture, these requirements From 74d8dfeac6008b04929ca1d25ecdff7195c33729 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Sun, 4 Sep 2022 21:48:07 +0300 Subject: [PATCH 09/30] BUG: missed one more gcc-specific flag, clean it up Issue materialized with MSVC as: ``` cl : Command line error D8021 : invalid numeric argument '/Wno-cpp' ``` [skip actions] [skip circle] From b18c9be0da8317524884105f0ce1477465d48aa8 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Mon, 5 Sep 2022 00:42:12 +0300 Subject: [PATCH 10/30] BLD: compensate for funky ifort name mangling on Windows [skip circle] --- meson.build | 8 ++++++++ scipy/meson.build | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 71230afa5f3e..f7814decefba 100644 --- a/meson.build +++ b/meson.build @@ -52,6 +52,14 @@ if ff.has_argument('-Wno-conversion') add_project_arguments('-Wno-conversion', language: 'fortran') endif +is_windows = host_machine.system() == 'windows' + +# Intel Fortran on Windows does things differently, so deal with that +if is_windows and ff.get_id() == 'intel-cl' + _ifort_flags = ff.get_supported_arguments('/MD', '/names:lowercase', '/assume:underscore') + add_project_arguments(_ifort_flags, language: 'fortran') +endif + cython = find_program('cython') pythran = find_program('pythran') generate_f2pymod = files('tools/generate_f2pymod.py') diff --git a/scipy/meson.build b/scipy/meson.build index 386b3528afe7..79ec5de8a7e1 100644 --- a/scipy/meson.build +++ b/scipy/meson.build @@ -1,5 +1,4 @@ # Platform detection -is_windows = host_machine.system() == 'windows' is_mingw = is_windows and cc.get_id() == 'gcc' cython_c_args = [] From 6ee00910f236029a5a4bd40e982fd74578e6e244 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Sun, 4 Sep 2022 23:38:12 +0300 Subject: [PATCH 11/30] BLD: use native threads on Windows, not pthreads [skip actions] [skip circle] --- scipy/fft/_pocketfft/meson.build | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/scipy/fft/_pocketfft/meson.build b/scipy/fft/_pocketfft/meson.build index 4147c8c7853d..6015cf538dbc 100644 --- a/scipy/fft/_pocketfft/meson.build +++ b/scipy/fft/_pocketfft/meson.build @@ -5,15 +5,27 @@ win_gcc = is_windows and meson.get_compiler('cpp').get_id() == 'gcc' pocketfft_threads = [] fft_deps = [py3_dep] -if not win_gcc +if is_windows + if win_gcc + # Disable threading completely, because of freezes using threading for + # mingw-w64 gcc: https://github.com/mreineck/pocketfft/issues/1 + pocketfft_threads += ['-DPOCKETFFT_NO_MULTITHREADING'] + else + if thread_dep.found() + # Use native Windows threading for MSVC/Clang. `pthreads` is probably not + # installed, and native threading is always available. It is not easy to + # distinguish this better, Meson builtin functionality for that is in + # progress (see comment on gh-16957). The code in `pocketfft_hdronly.h` + # will include `` anyway. + fft_deps += [thread_dep] + pocketfft_threads += [] + endif + endif +else if thread_dep.found() - pocketfft_threads += ['-DPOCKETFFT_PTHREADS'] fft_deps += [thread_dep] + pocketfft_threads += ['-DPOCKETFFT_PTHREADS'] endif -else - # Freezes using threading for mingw-w64 gcc: - # https://github.com/mreineck/pocketfft/issues/1 - pocketfft_threads += ['-DPOCKETFFT_NO_MULTITHREADING'] endif py3.extension_module('pypocketfft', From 0fd485ec53c61e4c6af63cc3143987aa742f894b Mon Sep 17 00:00:00 2001 From: Andrew Nelson Date: Mon, 12 Sep 2022 14:57:22 +1000 Subject: [PATCH 12/30] TST: cibuildwheel test manylinux_aarch64 --- .github/workflows/wheels.yml | 8 ++++++-- pyproject.toml | 11 +++++++++-- tools/wheels/cibw_test_command_manylinux_aarch64.sh | 13 +++++++++++++ tools/wheels/test_requirements.txt | 12 ------------ 4 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 tools/wheels/cibw_test_command_manylinux_aarch64.sh delete mode 100644 tools/wheels/test_requirements.txt diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index cfdc144df9c3..42af7065ac71 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -45,14 +45,18 @@ jobs: run: | set -xe COMMIT_MSG=$(git log --no-merges -1 --oneline) - echo "::set-output name=message::$COMMIT_MSG" + RUN="0" + if [[ "$COMMIT_MSG" == *"[wheel build]"* ]]; then + RUN="1" + fi + echo "::set-output name=message::$RUN" echo github.ref ${{ github.ref }} build_wheels: name: Build wheel for ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }} ${{ matrix.buildplat[2] }} needs: get_commit_message if: >- - contains(needs.get_commit_message.outputs.message, '[wheel build]') || + contains(needs.get_commit_message.outputs.message, '1') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0'))) diff --git a/pyproject.toml b/pyproject.toml index 339d7d72bee4..351cd5618c0a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -138,14 +138,15 @@ dodoFile = "do.py" [tool.cibuildwheel] skip = "cp36-* cp37-* pp* *_ppc64le *_i686 *_s390x *-musllinux*" build-verbosity = "3" -before-test = "pip install -r {project}/tools/wheels/test_requirements.txt" +# gmpy2 and scikit-umfpack are usually added for testing. However, there are +# currently wheels missing that make the test script fail. +test-requires = ["pytest", "pytest-cov", "pytest-xdist", "asv", "mpmath", "threadpoolctl", "pooch"] test-command = "bash {project}/tools/wheels/cibw_test_command.sh {project}" [tool.cibuildwheel.linux] manylinux-x86_64-image = "manylinux2014" manylinux-aarch64-image = "manylinux2014" before-build = "bash {project}/tools/wheels/cibw_before_build_linux.sh {project}" -test-skip = "*_aarch64" [tool.cibuildwheel.macos] before-build = "bash {project}/tools/wheels/cibw_before_build_macos.sh {project}" @@ -166,3 +167,9 @@ select = "*-win_amd64" # Don't use double backslash for path separators, they don't get passed # to the build correctly environment = { PKG_CONFIG_PATH="c:/opt/openblas/if_32/64/lib/pkgconfig" } + +[[tool.cibuildwheel.overrides]] +select = "*-manylinux_aarch64" +before-test = "" +test-requires = ["pytest", "threadpoolctl"] +test-command = "bash {project}/tools/wheels/cibw_test_command_manylinux_aarch64.sh {project}" diff --git a/tools/wheels/cibw_test_command_manylinux_aarch64.sh b/tools/wheels/cibw_test_command_manylinux_aarch64.sh new file mode 100644 index 000000000000..8daeca55a37f --- /dev/null +++ b/tools/wheels/cibw_test_command_manylinux_aarch64.sh @@ -0,0 +1,13 @@ +set -xe + +PROJECT_DIR="$1" + +# python $PROJECT_DIR/tools/wheels/check_license.py +if [[ $(uname) == "Linux" || $(uname) == "Darwin" ]] ; then + python $PROJECT_DIR/tools/openblas_support.py --check_version +fi +echo $? + +# only run a reduced set of tests for cross-compiled manylinux_aarch64 +python -c "import sys; import scipy.linalg; import scipy.optimize; sys.exit(not scipy.linalg.test())" +echo $? diff --git a/tools/wheels/test_requirements.txt b/tools/wheels/test_requirements.txt deleted file mode 100644 index e1147a884784..000000000000 --- a/tools/wheels/test_requirements.txt +++ /dev/null @@ -1,12 +0,0 @@ -numpy -pytest -pytest-cov -pytest-xdist -asv -mpmath -threadpoolctl -pooch -# these two are currently commented out because there are wheels missing -# that makes the test script fail -# gmpy2 -# scikit-umfpack From caa9915193ec6beec4f9ce14a92aaad1a152d6e0 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Mon, 12 Sep 2022 12:30:19 +0300 Subject: [PATCH 13/30] BLD: make MKL detection more robust, add notes on TODOs If the detection happens via CMake, that results in an upper-case result for `blas.name()`. So deal with any case, and also that of using `-Dblas=mkl_rt`. Note that this does not fix things for using CMake, because that defaults to the ILP64 interface (xref gh-16988). Add notes on what is left for MKL support Also add g77 ABI wrapper and fix a typo in f2py signature file in `_propack` Note that this is an incomplete fix, because PROPACK is in a bad state, as discussed in the issue linked in the code comment. --- scipy/meson.build | 7 ++++++- scipy/sparse/linalg/_propack/dpropack.pyf | 2 +- scipy/sparse/linalg/_propack/meson.build | 7 +++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/scipy/meson.build b/scipy/meson.build index 79ec5de8a7e1..d896ff44e80e 100644 --- a/scipy/meson.build +++ b/scipy/meson.build @@ -129,7 +129,12 @@ endif blas = dependency(blas_name) lapack = dependency(lapack_name) -if blas.name() == 'mkl' or lapack.name() == 'mkl' or get_option('use-g77-abi') +# FIXME: conda-forge sets MKL_INTERFACE_LAYER=LP64,GNU, see gh-11812. +# This needs work on gh-16200 to make MKL robust. We should be +# requesting `mkl-dynamic-lp64-seq` here. And then there's work needed +# in general to enable the ILP64 interface (also for OpenBLAS). +uses_mkl = blas.name().to_lower().startswith('mkl') or lapack.name().to_lower().startswith('mkl') +if uses_mkl or get_option('use-g77-abi') g77_abi_wrappers = files([ '_build_utils/src/wrap_g77_abi_f.f', '_build_utils/src/wrap_g77_abi_c.c' diff --git a/scipy/sparse/linalg/_propack/dpropack.pyf b/scipy/sparse/linalg/_propack/dpropack.pyf index 5dd7ee49c700..cd11ef69474c 100644 --- a/scipy/sparse/linalg/_propack/dpropack.pyf +++ b/scipy/sparse/linalg/_propack/dpropack.pyf @@ -10,7 +10,7 @@ python module __user__routines double precision depend(m,n),check(len(y)>=(transa[0] == 'n' ? m : n)),dimension((transa[0] == 'n' ? m : n)) :: y integer dimension(*) :: iparm double precision dimension(*) :: dparm - end function saprod + end function daprod end interface end python module __user__routines diff --git a/scipy/sparse/linalg/_propack/meson.build b/scipy/sparse/linalg/_propack/meson.build index 45e8b097dd49..70951925d523 100644 --- a/scipy/sparse/linalg/_propack/meson.build +++ b/scipy/sparse/linalg/_propack/meson.build @@ -81,8 +81,11 @@ elements = [ ] foreach ele: elements - propack_lib = static_library('lib_' + ele[0], ele[1], - c_args: ['_OPENMP'], + # FIXME: this doesn't match `setup.py` for g77 ABI issue. That is pretty much + # broken anyway, see for example gh-15108. + propack_lib = static_library('lib_' + ele[0], + [ele[1], g77_abi_wrappers], + c_args: ['-D_OPENMP'], # FIXME: this is needed now, but not good! fortran_args: [ fortran_ignore_warnings, _fflag_Wno_intrinsic_shadow, From 466cb94ed15ff21543b21e599098ccdb30a2ddef Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Mon, 12 Sep 2022 12:43:59 +0300 Subject: [PATCH 14/30] DOC: fix a formatting issue in the building FAQ doc page [ci skip] --- doc/source/dev/contributor/building_faq.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/dev/contributor/building_faq.rst b/doc/source/dev/contributor/building_faq.rst index 9fa62c8c9655..28fb05ff8196 100644 --- a/doc/source/dev/contributor/building_faq.rst +++ b/doc/source/dev/contributor/building_faq.rst @@ -93,7 +93,7 @@ library is MKL and if so, use the CBLAS API instead of the BLAS API. If autodetection fails or if the user wants to override this autodetection mechanism, use the following: -_For ``meson`` based builds (new in 1.9.0):_ +*For ``meson`` based builds (new in 1.9.0):* Use the ``-Duse-g77-abi=true`` build option. E.g.,:: @@ -106,7 +106,7 @@ example):: $ meson setup builddir -Duse-g77-abi=true -Dblas=blas -Dlapack=lapack -Dpython.install_env=auto $ meson install -C builddir -_For ``distutils`` based builds:_ +*For ``distutils`` based builds:* Set the environment variable ``SCIPY_USE_G77_ABI_WRAPPER`` to 0 or 1 to disable or enable using CBLAS API. From 9447b60b1837819c312180247a798d815e52ad86 Mon Sep 17 00:00:00 2001 From: Ewout ter Hoeven Date: Mon, 19 Sep 2022 16:23:39 +0200 Subject: [PATCH 15/30] CI: Update cibuildwheel to 2.10.1 Update the cibuildwheel version used in the wheels.yml configuration from 2.9.0 to 2.10.1. This is mainly usefull for the updated CPython 3.11 version (from 3.11.0rc1 to v3.11.0rc2). [wheel build] --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 42af7065ac71..37124a6d8884 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -133,7 +133,7 @@ jobs: platforms: all - name: Build wheels - uses: pypa/cibuildwheel@v2.9.0 + uses: pypa/cibuildwheel@v2.10.1 # Build all wheels here, but the macosx_arm64 job in its own entry. # cibuildwheel is currently unable to pass configuration flags to # CIBW_BUILD_FRONTEND https://github.com/pypa/cibuildwheel/issues/1227 From 7c97930c8e62e0edbf428874eb74de150679b5b1 Mon Sep 17 00:00:00 2001 From: Naoto Mizuno Date: Wed, 21 Sep 2022 21:06:30 +0900 Subject: [PATCH 16/30] BUG: Fix numerical precision error of truncnorm.logcdf Resolve the large precision error of truncnorm.logcdf with upper tail argument. mass_case_central of _log_gauss_mass was inaccurate due to catastrophic cancellation in logsumexp. --- scipy/stats/_continuous_distns.py | 4 +--- scipy/stats/tests/test_distributions.py | 9 +++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/scipy/stats/_continuous_distns.py b/scipy/stats/_continuous_distns.py index d30c12c5adb6..82289ae0de06 100644 --- a/scipy/stats/_continuous_distns.py +++ b/scipy/stats/_continuous_distns.py @@ -7991,9 +7991,7 @@ def mass_case_right(a, b): return mass_case_left(-b, -a) def mass_case_central(a, b): - left_mass = mass_case_left(a, 0.5) - right_mass = mass_case_right(0.5, b) - return _log_sum(left_mass, right_mass) + return sc.log1p(-sc.ndtr(a) - sc.ndtr(-b)) # _lazyselect not working; don't care to debug it out = np.full_like(a, fill_value=np.nan, dtype=np.complex128) diff --git a/scipy/stats/tests/test_distributions.py b/scipy/stats/tests/test_distributions.py index b01cf452a1e8..c15c8d163212 100644 --- a/scipy/stats/tests/test_distributions.py +++ b/scipy/stats/tests/test_distributions.py @@ -1101,6 +1101,15 @@ def test_rvs_Generator(self): stats.truncnorm.rvs(-10, -5, size=5, random_state=np.random.default_rng()) + def test_logcdf_tail(self): + a = [-np.inf, -np.inf, -8] + b = [np.inf, np.inf, 8] + x = [10, 7.5, 7.5] + expected = [-7.619853024160525e-24, + -3.190891672910947e-14, + -3.128682067168231e-14] + assert_allclose(stats.truncnorm(a, b).logcdf(x), expected) + class TestGenLogistic: From b04b7eb06d6683c8b7b2543a10d5fc455a949a4a Mon Sep 17 00:00:00 2001 From: Matt Haberland Date: Fri, 23 Sep 2022 08:44:17 -0700 Subject: [PATCH 17/30] MAINT: stats.truncnorm.logcdf/logsf: fix another catastropic cancellation --- scipy/stats/_continuous_distns.py | 30 +++++++++++++++++----- scipy/stats/tests/test_continuous_basic.py | 8 +++--- scipy/stats/tests/test_distributions.py | 16 +++++++----- 3 files changed, 37 insertions(+), 17 deletions(-) diff --git a/scipy/stats/_continuous_distns.py b/scipy/stats/_continuous_distns.py index 82289ae0de06..48645ba11dbc 100644 --- a/scipy/stats/_continuous_distns.py +++ b/scipy/stats/_continuous_distns.py @@ -7968,8 +7968,6 @@ def _log_sum(log_p, log_q): # same as above, but using -exp(x) = exp(x + πi) def _log_diff(log_p, log_q): - # need to broadcast in case a or b is 0.5; logsumexp doesn't - log_p, log_q = np.broadcast_arrays(log_p, log_q) return sc.logsumexp([log_p, log_q+np.pi*1j], axis=0) @@ -7980,8 +7978,8 @@ def _log_gauss_mass(a, b): # Calculations in right tail are inaccurate, so we'll exploit the # symmetry and work only in the left tail - case_left = b <= 0.5 - case_right = a > 0.5 + case_left = b <= 0 + case_right = a > 0 case_central = ~(case_left | case_right) def mass_case_left(a, b): @@ -7991,6 +7989,16 @@ def mass_case_right(a, b): return mass_case_left(-b, -a) def mass_case_central(a, b): + # Previously, this was implemented as: + # left_mass = mass_case_left(a, 0) + # right_mass = mass_case_right(0, b) + # return _log_sum(left_mass, right_mass) + # Catastrophic cancellation occurs as np.exp(log_mass) approaches 1. + # Correct for this with an alternative formulation. + # We're not concerned with underflow here: if only one term + # underflows, it was insignificant; if both terms underflow, + # the result can't accurately be represented in logspace anyway + # because sc.log1p(x) ~ x for small x. return sc.log1p(-sc.ndtr(a) - sc.ndtr(-b)) # _lazyselect not working; don't care to debug it @@ -8051,13 +8059,23 @@ def _cdf(self, x, a, b): return np.exp(self._logcdf(x, a, b)) def _logcdf(self, x, a, b): - return _log_gauss_mass(a, x) - _log_gauss_mass(a, b) + x, a, b = np.broadcast_arrays(x, a, b) + logcdf = _log_gauss_mass(a, x) - _log_gauss_mass(a, b) + i = logcdf > -0.1 # avoid catastrophic cancellation + if np.any(i): + logcdf[i] = np.log1p(-np.exp(self._logsf(x[i], a[i], b[i]))) + return logcdf def _sf(self, x, a, b): return np.exp(self._logsf(x, a, b)) def _logsf(self, x, a, b): - return _log_gauss_mass(x, b) - _log_gauss_mass(a, b) + x, a, b = np.broadcast_arrays(x, a, b) + logsf = _log_gauss_mass(x, b) - _log_gauss_mass(a, b) + i = logsf > -0.1 # avoid catastrophic cancellation + if np.any(i): + logsf[i] = np.log1p(-np.exp(self._logcdf(x[i], a[i], b[i]))) + return logsf def _ppf(self, q, a, b): q, a, b = np.broadcast_arrays(q, a, b) diff --git a/scipy/stats/tests/test_continuous_basic.py b/scipy/stats/tests/test_continuous_basic.py index 4c46dec2604f..79819d881623 100644 --- a/scipy/stats/tests/test_continuous_basic.py +++ b/scipy/stats/tests/test_continuous_basic.py @@ -386,18 +386,18 @@ def test_nomodify_gh9900_regression(): # Use the right-half truncated normal # Check that the cdf and _cdf return the same result. npt.assert_almost_equal(tn.cdf(1, 0, np.inf), 0.6826894921370859) - npt.assert_almost_equal(tn._cdf(1, 0, np.inf), 0.6826894921370859) + npt.assert_almost_equal(tn._cdf([1], [0], [np.inf]), 0.6826894921370859) # Now use the left-half truncated normal npt.assert_almost_equal(tn.cdf(-1, -np.inf, 0), 0.31731050786291415) - npt.assert_almost_equal(tn._cdf(-1, -np.inf, 0), 0.31731050786291415) + npt.assert_almost_equal(tn._cdf([-1], [-np.inf], [0]), 0.31731050786291415) # Check that the right-half truncated normal _cdf hasn't changed - npt.assert_almost_equal(tn._cdf(1, 0, np.inf), 0.6826894921370859) # NOT 1.6826894921370859 + npt.assert_almost_equal(tn._cdf([1], [0], [np.inf]), 0.6826894921370859) # noqa, NOT 1.6826894921370859 npt.assert_almost_equal(tn.cdf(1, 0, np.inf), 0.6826894921370859) # Check that the left-half truncated normal _cdf hasn't changed - npt.assert_almost_equal(tn._cdf(-1, -np.inf, 0), 0.31731050786291415) # Not -0.6826894921370859 + npt.assert_almost_equal(tn._cdf([-1], [-np.inf], [0]), 0.31731050786291415) # noqa, Not -0.6826894921370859 npt.assert_almost_equal(tn.cdf(1, -np.inf, 0), 1) # Not 1.6826894921370859 npt.assert_almost_equal(tn.cdf(-1, -np.inf, 0), 0.31731050786291415) # Not -0.6826894921370859 diff --git a/scipy/stats/tests/test_distributions.py b/scipy/stats/tests/test_distributions.py index c15c8d163212..2e663a0acb34 100644 --- a/scipy/stats/tests/test_distributions.py +++ b/scipy/stats/tests/test_distributions.py @@ -1101,14 +1101,16 @@ def test_rvs_Generator(self): stats.truncnorm.rvs(-10, -5, size=5, random_state=np.random.default_rng()) - def test_logcdf_tail(self): - a = [-np.inf, -np.inf, -8] - b = [np.inf, np.inf, 8] - x = [10, 7.5, 7.5] - expected = [-7.619853024160525e-24, - -3.190891672910947e-14, - -3.128682067168231e-14] + def test_logcdf_gh17064(self): + # regression test for gh-17064 - avoid roundoff error for logcdfs ~0 + a = np.array([-np.inf, -np.inf, -8, -np.inf, 10]) + b = np.array([np.inf, np.inf, 8, 10, np.inf]) + x = np.array([10, 7.5, 7.5, 9, 20]) + expected = [-7.619853024160525e-24, -3.190891672910947e-14, + -3.128682067168231e-14, -1.1285122074235991e-19, + -3.61374964828753e-66] assert_allclose(stats.truncnorm(a, b).logcdf(x), expected) + assert_allclose(stats.truncnorm(-b, -a).logsf(-x), expected) class TestGenLogistic: From e07933844894dcf8ffc2b39bd0cea4fa13c3fc30 Mon Sep 17 00:00:00 2001 From: Nicholas McKibben Date: Mon, 26 Sep 2022 21:57:09 -0700 Subject: [PATCH 18/30] FIX: ensure a hold on GIL before raising warnings/errors (#17096) FIX: ensure a hold on GIL before raising warnings/errors --- scipy/stats/_boost/include/func_defs.hpp | 6 +++++- scipy/stats/tests/test_distributions.py | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/scipy/stats/_boost/include/func_defs.hpp b/scipy/stats/_boost/include/func_defs.hpp index c7f1818497f5..b7e3a54207c7 100644 --- a/scipy/stats/_boost/include/func_defs.hpp +++ b/scipy/stats/_boost/include/func_defs.hpp @@ -29,7 +29,9 @@ boost::math::policies::user_evaluation_error(const char* function, const char* m // "message" may have %1%, but arguments don't always contain all // required information, so don't call boost::format for now msg += message; - PyErr_WarnEx(NULL, msg.c_str(), 1); + PyGILState_STATE save = PyGILState_Ensure(); + PyErr_WarnEx(PyExc_RuntimeWarning, msg.c_str(), 1); + PyGILState_Release(save); return val; } @@ -42,7 +44,9 @@ boost::math::policies::user_overflow_error(const char* function, const char* mes // From Boost docs: "overflow and underflow messages do not contain this %1% specifier // (since the value of value is immaterial in these cases)." msg += message; + PyGILState_STATE save = PyGILState_Ensure(); PyErr_SetString(PyExc_OverflowError, msg.c_str()); + PyGILState_Release(save); return 0; } diff --git a/scipy/stats/tests/test_distributions.py b/scipy/stats/tests/test_distributions.py index 2e663a0acb34..1f037034b7a1 100644 --- a/scipy/stats/tests/test_distributions.py +++ b/scipy/stats/tests/test_distributions.py @@ -6616,6 +6616,19 @@ def test_ncf_cdf_spotcheck(): assert_allclose(check_val, np.round(scipy_val, decimals=6)) +@pytest.mark.skipif(sys.maxsize <= 2**32, + reason="On some 32-bit the warning is not raised") +def test_ncf_ppf_issue_17026(): + # Regression test for gh-17026 + x = np.linspace(0, 1, 600) + x[0] = 1e-16 + par = (0.1, 2, 5, 0, 1) + with pytest.warns(RuntimeWarning): + q = stats.ncf.ppf(x, *par) + q0 = [stats.ncf.ppf(xi, *par) for xi in x] + assert_allclose(q, q0) + + class TestHistogram: def setup_method(self): np.random.seed(1234) From 58c8b79e176d418fe22b4c1163049d7fb8d374c7 Mon Sep 17 00:00:00 2001 From: Matt Haberland Date: Fri, 30 Sep 2022 21:13:11 -0700 Subject: [PATCH 19/30] TST: stats.studentized_range: fix incorrect test --- scipy/stats/tests/test_distributions.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scipy/stats/tests/test_distributions.py b/scipy/stats/tests/test_distributions.py index 1f037034b7a1..4d49034009bb 100644 --- a/scipy/stats/tests/test_distributions.py +++ b/scipy/stats/tests/test_distributions.py @@ -5455,7 +5455,7 @@ class TestStudentizedRange: vs = [1, 3, 10, 20, 120, np.inf] ks = [2, 8, 14, 20] - data = zip(product(ps, vs, ks), qs) + data = list(zip(product(ps, vs, ks), qs)) # A small selection of large-v cases generated with R's `ptukey` # Each case is in the format (q, k, v, r_result) @@ -5476,8 +5476,9 @@ def test_cdf_against_tables(self): @pytest.mark.slow def test_ppf_against_tables(self): for pvk, q_expected in self.data: - res_q = stats.studentized_range.ppf(*pvk) - assert_allclose(res_q, q_expected, rtol=1e-4) + p, v, k = pvk + res_q = stats.studentized_range.ppf(p, k, v) + assert_allclose(res_q, q_expected, rtol=5e-4) path_prefix = os.path.dirname(__file__) relative_path = "data/studentized_range_mpmath_ref.json" From 7b76dba0c98aa2231fd88f6386fd8b1624015b04 Mon Sep 17 00:00:00 2001 From: Ewout ter Hoeven Date: Sun, 2 Oct 2022 17:46:34 +0200 Subject: [PATCH 20/30] MAINT: pyproject.toml: Update build system requirements Require "meson-python>=0.9.0", "Cython>=0.29.32", "pybind11>=2.10.0" and "pythran>=0.12.0" to build SciPy. These updated build-system requirements allow for consistent builds. The updated meson-python and Cython helps with Python 3.11 builds. Probably a backport candidate to the 1.9 branch if Python 3.11 wheels are to be released on this branch. (note that build-system requirements are only needed to build SciPy from source, not to run it after a regular pip install, and thus can be set fairly aggressive). [wheel build] --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 351cd5618c0a..19ee4b5e5dab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,11 +10,11 @@ [build-system] build-backend = 'mesonpy' requires = [ - "meson-python>=0.8.1", # we need more fixes in meson-python, so no upper bound now + "meson-python>=0.9.0", # we need more fixes in meson-python, so no upper bound now "meson==0.62.2", # workaround for wheel build issue, see https://github.com/FFY00/meson-python/issues/95 - "Cython>=0.29.21,<3.0", + "Cython>=0.29.32,<3.0", "pybind11>=2.4.3,<2.11.0", - "pythran>=0.9.12,<0.12.0", + "pythran>=0.9.12,<0.13.0", # `wheel` is needed for non-isolated builds, given that `meson-python` # doesn't list it as a runtime requirement (at least in 0.5.0) "wheel<0.38.0", From 9c923e60142f68e7eb2b364b46d322bf96ac4a20 Mon Sep 17 00:00:00 2001 From: Tyler Reddy Date: Sun, 2 Oct 2022 14:40:53 -0600 Subject: [PATCH 21/30] DOC: update 1.9.2 relnotes. --- doc/release/1.9.2-notes.rst | 47 ++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/doc/release/1.9.2-notes.rst b/doc/release/1.9.2-notes.rst index 31bc0a741d89..2cdbde8a54dc 100644 --- a/doc/release/1.9.2-notes.rst +++ b/doc/release/1.9.2-notes.rst @@ -5,15 +5,60 @@ SciPy 1.9.2 Release Notes .. contents:: SciPy 1.9.2 is a bug-fix release with no new features -compared to 1.9.1. +compared to 1.9.1. It also provides wheel for Python 3.11 +on several platforms. Authors ======= +* Hood Chatham (1) +* Thomas J. Fan (1) +* Ralf Gommers (7) +* Matt Haberland (3) +* Julien Jerphanion (1) +* Loïc Estève (1) +* Nicholas McKibben (1) +* Naoto Mizuno (1) +* Andrew Nelson (3) +* Tyler Reddy (21) +* Pamphile Roy (1) +* Ewout ter Hoeven (2) +* Meekail Zain (1) + + +A total of 13 people contributed to this release. +People with a "+" by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. Issues closed for 1.9.2 ----------------------- +* `#16569 `__: BUG: \`sparse.hstack\` returns incorrect result when the stack... +* `#16898 `__: BUG: optimize.minimize backwards compatability in scipy 1.9 +* `#16935 `__: BUG: using msvc + meson to build scipy --> cl cannot be used... +* `#16952 `__: BUG: error from \`scipy.stats.mode\` with \`NaN\`s, \`axis !=... +* `#16964 `__: BUG: scipy 1.7.3 wheels on PyPI require numpy<1.23 in contradiction... +* `#17026 `__: BUG: ncf_gen::ppf(..) causes segfault +* `#17124 `__: BUG: OSX-64 Test failure test_ppf_against_tables getting NaN Pull requests for 1.9.2 ----------------------- + +* `#16628 `__: FIX: Updated dtype resolution in \`_stack_along_minor_axis\` +* `#16842 `__: ENH: cibuildwheel infrastructure +* `#16909 `__: MAINT: minimize, restore squeezed ((1.0)) addresses #16898 +* `#16911 `__: REL: prep for SciPy 1.9.2 +* `#16922 `__: DOC: update version switcher for 1.9.1 and pin theme to 0.9 +* `#16934 `__: MAINT: cast \`linear_sum_assignment\` to PyCFunction +* `#16943 `__: BLD: use compiler flags in a more portable way +* `#16954 `__: MAINT: stats.mode: fix bug with \`axis!=1\`, \`nan_policy='omit'\`,... +* `#16966 `__: MAINT: fix NumPy upper bound +* `#16969 `__: BLD: fix usage of \`get_install_data\`, which defaults to purelib +* `#16975 `__: DOC: Update numpy supported versions for 1.9.2 +* `#16991 `__: BLD: fixes for building with MSVC and Intel Fortran +* `#17011 `__: Rudimentary test for manylinux_aarch64 with cibuildwheel +* `#17013 `__: BLD: make MKL detection a little more robust, add notes on TODOs +* `#17046 `__: CI: Update cibuildwheel to 2.10.1 +* `#17064 `__: BUG: Fix numerical precision error of \`truncnorm.logcdf\` when... +* `#17096 `__: FIX: ensure a hold on GIL before raising warnings/errors +* `#17127 `__: TST: stats.studentized_range: fix incorrect test +* `#17131 `__: MAINT: pyproject.toml: Update build system requirements From f3ca38db17d81d475353164ebf4e0a038960fc31 Mon Sep 17 00:00:00 2001 From: Tyler Reddy Date: Mon, 3 Oct 2022 19:56:09 -0600 Subject: [PATCH 22/30] MAINT: PR 17132 revisions * clean up some of my own mistakes from merge conflict resolution in the build system --- scipy/integrate/meson.build | 3 +-- scipy/optimize/meson.build | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/scipy/integrate/meson.build b/scipy/integrate/meson.build index 6b53ee7e0b7f..fc03e80cce71 100644 --- a/scipy/integrate/meson.build +++ b/scipy/integrate/meson.build @@ -148,9 +148,8 @@ lsoda_module = custom_target('lsoda_module', py3.extension_module('_lsoda', [lsoda_module, fortranobject_c], link_with: [lsoda_lib, mach_lib], - c_args: [numpy_nodepr_api, '-Wno-unused-variable'], - dependencies: [py3_dep, lapack], c_args: [numpy_nodepr_api, Wno_unused_variable], + dependencies: [py3_dep, lapack], include_directories: [inc_np, inc_f2py], install: true, link_language: 'fortran', diff --git a/scipy/optimize/meson.build b/scipy/optimize/meson.build index aeed5d622fb2..a8b824419f31 100644 --- a/scipy/optimize/meson.build +++ b/scipy/optimize/meson.build @@ -135,7 +135,6 @@ cobyla_module = custom_target('cobyla_module', _cobyla = py3.extension_module('_cobyla', [cobyla_module, fortranobject_c, 'cobyla/cobyla2.f', 'cobyla/trstlp.f'], c_args: [numpy_nodepr_api, Wno_unused_variable], - [cobyla_module, 'cobyla/cobyla2.f', 'cobyla/trstlp.f'], fortran_args: fortran_ignore_warnings, include_directories: [inc_np, inc_f2py], dependencies: [py3_dep], From d885c5514ad7a633176dc34a09a1b92fe482f1f9 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Tue, 4 Oct 2022 12:27:45 +0200 Subject: [PATCH 23/30] BLD: remove Meson pin, newer versions have fixes we need This will solve the failure of the "build from sdist" job in Azure. --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 19ee4b5e5dab..6dc1d40700b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,6 @@ build-backend = 'mesonpy' requires = [ "meson-python>=0.9.0", # we need more fixes in meson-python, so no upper bound now - "meson==0.62.2", # workaround for wheel build issue, see https://github.com/FFY00/meson-python/issues/95 "Cython>=0.29.32,<3.0", "pybind11>=2.4.3,<2.11.0", "pythran>=0.9.12,<0.13.0", From dc1ae86db67e61588343bc29159ecbc360491e55 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Mon, 8 Aug 2022 21:38:11 +0200 Subject: [PATCH 24/30] BLD: add `_USE_MATH_DEFINES` for all Cython-generated code (cherry picked from commit 076a1f0992deb1961a6321e2ac8f37b740135b91) --- scipy/meson.build | 11 ++++++++++- scipy/special/meson.build | 8 +------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/scipy/meson.build b/scipy/meson.build index d896ff44e80e..b59fb621e24e 100644 --- a/scipy/meson.build +++ b/scipy/meson.build @@ -286,10 +286,19 @@ fortran_ignore_warnings = ff.get_supported_arguments( _fflag_Wno_tabs, ) +# Deal with M_PI & friends; add `use_math_defines` to c_args or cpp_args +# Cython doesn't always get this right itself (see, e.g., gh-16800), so +# explicitly add the define as a compiler flag for Cython-generated code. +if is_windows + use_math_defines = ['-D_USE_MATH_DEFINES'] +else + use_math_defines = [] +endif + # Suppress warning for deprecated Numpy API. # (Suppress warning messages emitted by #warning directives). # Replace with numpy_nodepr_api after Cython 3.0 is out -cython_c_args += ['-Wno-cpp'] +cython_c_args += ['-Wno-cpp', use_math_defines] cython_cpp_args = cython_c_args # Ordering of subdirs: special and linalg come first, because other submodules diff --git a/scipy/special/meson.build b/scipy/special/meson.build index 8407bc04ef42..8fe534bed372 100644 --- a/scipy/special/meson.build +++ b/scipy/special/meson.build @@ -274,12 +274,6 @@ ufuncs_cxx_sources = [ ] -if is_windows - use_math_defines = ['-D_USE_MATH_DEFINES'] -else - use_math_defines = [] -endif - cephes_lib = static_library('cephes', cephes_sources, c_args: use_math_defines, @@ -407,7 +401,7 @@ py3.extension_module('_ufuncs_cxx', [ufuncs_cxx_sources, uf_cython_gen_cpp.process(cython_special[2]), # _ufuncs_cxx.pyx ], - cpp_args: [cython_c_args, use_math_defines], + cpp_args: cython_cpp_args, include_directories: [inc_np, '../_lib', '../_build_utils/src'], dependencies: [py3_dep, npymath_lib, ellint_dep], install: true, From 35138daea0389940088f8b8e4bd3c71869f16a79 Mon Sep 17 00:00:00 2001 From: Warren Weckesser Date: Fri, 16 Sep 2022 16:09:19 -0400 Subject: [PATCH 25/30] BUG: sparse: Avoid creating a view when ensuring that an array has native byte order. (#17035) (cherry picked from commit 29ec80b4a4a6767ef38c253dc0eb4b6ffd7144b5) --- scipy/sparse/_sputils.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/scipy/sparse/_sputils.py b/scipy/sparse/_sputils.py index ad4b0c94ae84..2d63a281f857 100644 --- a/scipy/sparse/_sputils.py +++ b/scipy/sparse/_sputils.py @@ -10,7 +10,8 @@ 'isshape', 'issequence', 'isdense', 'ismatrix', 'get_sum_dtype'] supported_dtypes = [np.bool_, np.byte, np.ubyte, np.short, np.ushort, np.intc, - np.uintc, np.int_, np.uint, np.longlong, np.ulonglong, np.single, np.double, + np.uintc, np.int_, np.uint, np.longlong, np.ulonglong, + np.single, np.double, np.longdouble, np.csingle, np.cdouble, np.clongdouble] _upcast_memo = {} @@ -88,7 +89,19 @@ def downcast_intp_index(arr): def to_native(A): - return np.asarray(A, dtype=A.dtype.newbyteorder('native')) + """ + Ensure that the data type of the NumPy array `A` has native byte order. + + `A` must be a NumPy array. If the data type of `A` does not have native + byte order, a copy of `A` with a native byte order is returned. Otherwise + `A` is returned. + """ + dt = A.dtype + if dt.isnative: + # Don't call `asarray()` if A is already native, to avoid unnecessarily + # creating a view of the input array. + return A + return np.asarray(A, dtype=dt.newbyteorder('native')) def getdtype(dtype, a=None, default=None): From 54e27b3261604b73e45567269812678d41711d08 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Tue, 4 Oct 2022 12:58:03 +0200 Subject: [PATCH 26/30] TST: mark float32 gges and qz tests as knownfail See gh-16949 --- scipy/linalg/tests/test_decomp.py | 3 +++ scipy/linalg/tests/test_lapack.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/scipy/linalg/tests/test_decomp.py b/scipy/linalg/tests/test_decomp.py index bfee385e6cd2..3ad6cbc1e904 100644 --- a/scipy/linalg/tests/test_decomp.py +++ b/scipy/linalg/tests/test_decomp.py @@ -10,6 +10,7 @@ import itertools import platform +import sys import numpy as np from numpy.testing import (assert_equal, assert_almost_equal, assert_array_almost_equal, assert_array_equal, @@ -2031,6 +2032,8 @@ class TestQZ: def setup_method(self): seed(12345) + @pytest.mark.xfail(sys.platform == 'darwin', + reason="gges[float32] broken for OpenBLAS on macOS, see gh-16949") def test_qz_single(self): n = 5 A = random([n, n]).astype(float32) diff --git a/scipy/linalg/tests/test_lapack.py b/scipy/linalg/tests/test_lapack.py index 0c183eb8b1d8..75c888c92e47 100644 --- a/scipy/linalg/tests/test_lapack.py +++ b/scipy/linalg/tests/test_lapack.py @@ -2983,6 +2983,9 @@ def test_pptrs_pptri_pptrf_ppsv_ppcon(dtype, lower): @pytest.mark.parametrize('dtype', DTYPES) def test_gges_tgexc(dtype): + if dtype == np.float32 and sys.platform == 'darwin': + pytest.xfail("gges[float32] broken for OpenBLAS on macOS, see gh-16949") + seed(1234) atol = np.finfo(dtype).eps*100 From 50c85e619a09d28d58c381096e25ce497fe814b1 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Tue, 20 Sep 2022 14:14:12 +0200 Subject: [PATCH 27/30] TST: mark one `linalg.solve_discrete_are` as knownfail See gh-16926 (cherry picked from commit 81f4a4c0dc65f09fec893529fc099aa0bb5f1cda) --- scipy/linalg/tests/test_solvers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scipy/linalg/tests/test_solvers.py b/scipy/linalg/tests/test_solvers.py index 636cf66a3c0a..f0aae40c8eb8 100644 --- a/scipy/linalg/tests/test_solvers.py +++ b/scipy/linalg/tests/test_solvers.py @@ -482,7 +482,7 @@ def test_solve_discrete_are(): np.eye(3), 1e6 * np.eye(3), 1e6 * np.eye(3), - None), + "Issue with OpenBLAS, see gh-16926"), # TEST CASE 17 : darex #14 (np.array([[1 - 1/1e8, 0, 0, 0], [1, 0, 0, 0], From 5a793e98a3dba19c18ef62afe9cd58f84ccdd801 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Tue, 4 Oct 2022 13:58:26 +0200 Subject: [PATCH 28/30] DOC: replace `set_tight_layout` with `set_layout_engine` in example There's a PendingDeprecationWarning for this introduced in Matplotlib 3.6 (released 16 Sep 2022). It should be fine to depend on latest Matplotlib in this one example. [skip azp] [skip actions] --- scipy/ndimage/_interpolation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scipy/ndimage/_interpolation.py b/scipy/ndimage/_interpolation.py index 2b3ce4471df1..07fa16f51cfd 100644 --- a/scipy/ndimage/_interpolation.py +++ b/scipy/ndimage/_interpolation.py @@ -874,7 +874,7 @@ def rotate(input, angle, axes=(1, 0), reshape=True, output=None, order=3, >>> ax2.set_axis_off() >>> ax3.imshow(full_img_45, cmap='gray') >>> ax3.set_axis_off() - >>> fig.set_tight_layout(True) + >>> fig.set_layout_engine('tight') >>> plt.show() >>> print(img.shape) (512, 512) From 014ecf68795b61c549cb08ba24af49dd5b08da74 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Tue, 4 Oct 2022 15:02:37 +0200 Subject: [PATCH 29/30] CI: update wheel builder triggers Brings these more in line with `main` --- .github/workflows/wheels.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 37124a6d8884..7cce67b87990 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -19,7 +19,9 @@ on: - cron: "9 9 * * 6" # push: pull_request: - types: [labeled, opened, synchronize, reopened] + branches: + - main + - maintenance/** workflow_dispatch: concurrency: @@ -30,8 +32,7 @@ jobs: get_commit_message: name: Get commit message runs-on: ubuntu-latest - # TODO re-enable - # if: github.repository == 'scipy/scipy' + if: github.repository == 'scipy/scipy' outputs: message: ${{ steps.commit_message.outputs.message }} steps: @@ -44,7 +45,7 @@ jobs: id: commit_message run: | set -xe - COMMIT_MSG=$(git log --no-merges -1 --oneline) + COMMIT_MSG=$(git log --no-merges -1) RUN="0" if [[ "$COMMIT_MSG" == *"[wheel build]"* ]]; then RUN="1" From 2bc973a2c28c4b6b5bea0e288631834fe34b526e Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Tue, 4 Oct 2022 14:54:28 +0200 Subject: [PATCH 30/30] BLD: set version to 1.9.2.dev0 (and trigger wheel build CI) [wheel build] --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index f7814decefba..b3fef6631372 100644 --- a/meson.build +++ b/meson.build @@ -4,7 +4,7 @@ project( # Note that the git commit hash cannot be added dynamically here (it is added # in the dynamically generated and installed `scipy/version.py` though - see # tools/version_utils.py - version: '1.9.2', + version: '1.9.2.dev0', license: 'BSD-3', meson_version: '>= 0.62.2', default_options: [