# Maintainer: Peter Budai <peterbudai@hotmail.com>

_realname=joblib
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=1.5.2
pkgrel=1
pkgdesc="Set of tools to provide lightweight pipelining in Python (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
msys2_references=(
  'archlinux: python-joblib'
  'purl: pkg:pypi/joblib'
  "cpe: cpe:/a:joblib_project:joblib"
)
msys2_repository_url='https://github.com/joblib/joblib/'
msys2_changelog_url='https://github.com/joblib/joblib/blob/main/CHANGES.rst'
url='https://joblib.readthedocs.io/'
license=('spdx:BSD-3-Clause')
depends=("${MINGW_PACKAGE_PREFIX}-python")
optdepends=("${MINGW_PACKAGE_PREFIX}-python-numpy: for array manipulation"
            "${MINGW_PACKAGE_PREFIX}-python-lz4: for compressed serialization")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('3faa5c39054b2f03ca547da9b2f52fde67c06240c31853f306aea97f13647b55')

build() {
  cp -r "${_realname}-${pkgver}" "python-build-${MSYSTEM}" && cd "python-build-${MSYSTEM}"
  ${MINGW_PREFIX}/bin/python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd "${srcdir}/python-build-${MSYSTEM}"
  MSYS2_ARG_CONV_EXCL="--prefix=" \
    ${MINGW_PREFIX}/bin/python -m installer --prefix=${MINGW_PREFIX} \
    --destdir="${pkgdir}" dist/*.whl

  install -Dm644 LICENSE.txt "${pkgdir}"${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE
}
