# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Maintainer: Bruno Pagani <archange@archlinux.org>
# Contributor: Andrzej Giniewicz <gginiu@gmail.com>

pkgname=python-scikit-learn
pkgver=1.6.1
pkgrel=1
pkgdesc='A set of python modules for machine learning and data mining'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url='https://scikit-learn.org'
_url='https://github.com/scikit-learn/scikit-learn'
license=(BSD-3-Clause)
depends=(python-joblib
         python-numpy
         python-scipy
         python-threadpoolctl)
makedepends=(cython
             meson-python
             python-{build,installer,wheel})
makedepends_powerpc64=(openmp)
makedepends_powerpc64le=(openmp)
makedepends_riscv64=(openmp)
makedepends_x86_64=(openmp)
optdepends=('python-matplotlib: plotting capabilities')
options=(!emptydirs)
_archive="${pkgname#python-}-$pkgver"
source=("$_url/archive/$pkgver/$_archive.tar.gz")
sha256sums=('88c1816c89d2b27f2506d155e1195d71fc9d935bbe1968ce02b0e9ddd659b2ff')

prepare() {
	cd $_archive
	sed -i -E \
		-e '/setuptools/s/<[0-9.]+//' \
		-e '/numpy/d' \
		-e '/Cython/s/,<3.0//' \
		pyproject.toml
}

build() {
	cd $_archive
	python -m build -wn
}

package() {
	cd $_archive
	python -m installer -d "$pkgdir" dist/*.whl
	install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" COPYING
}
