# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Thomas Dziedzic < gostrc at gmail >
# Contributor: Angel 'angvp' Velasquez <angvp[at]archlinux.com.ve>
# Contributor: Ray Rashif <schiv@archlinux.org>
# Contributor: Douglas Soares de Andrade <dsa@aur.archlinux.org>
# Contributor: Bodor Dávid Gábor <david.gabor.bodor@gmail.com>
# Contributor: Andrzej Giniewicz <gginiu@gmail.com>

_name=scipy
pkgname=python-scipy
pkgver=1.13.0
pkgrel=1
pkgdesc='Open-source software for mathematics, science, and engineering'
arch=(x86_64 aarch64)
url='https://www.scipy.org/'
license=(BSD-3-Clause)
depends=(blas
         gcc-libs
         glibc
         lapack
         python
         python-numpy
         python-platformdirs
         python-pooch)
provides=(scipy)
makedepends=(cython
             gcc-fortran
             meson-python
             pybind11
             python-build
             python-installer
             python-pythran)
checkdepends=(python-hypothesis
              python-pytest)
optdepends=('python-pillow: for image saving module')
source=(https://github.com/scipy/scipy/releases/download/v$pkgver/$_name-$pkgver.tar.gz)
sha256sums=('58569af537ea29d3f78e5abd18398459f195546bb3be23d16677fb26616cc11e')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation --skip-dependency-check \
    -C setup-args=-Dblas=blas \
    -C setup-args=-Dlapack=lapack
}

check() {
  cd $_name-$pkgver
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  cd test-env
  bin/python -c "from scipy import test; test('full')"
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE.txt -t "$pkgdir"/usr/share/licenses/$pkgname
}
