# Maintainer: Rafał Brzegowy <rafal.brzegowy@yahoo.com>

_realname=meshio
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=5.3.4
pkgrel=1
pkgdesc='Input/output for many mesh formats (mingw-w64)'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url='https://github.com/nschloe/meshio'
license=('spdx:MIT')
depends=("${MINGW_PACKAGE_PREFIX}-python-numpy"
         "${MINGW_PACKAGE_PREFIX}-python-rich")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools"
             "${MINGW_PACKAGE_PREFIX}-python-wheel")
optdepends=("${MINGW_PACKAGE_PREFIX}-python-netcdf4"
	    "${MINGW_PACKAGE_PREFIX}-python-h5py")
options=('!strip')
source=("$url/archive/v$pkgver.tar.gz")
sha256sums=('710af6e4fa2daed144f7fd58690fa6cbd476956d02b453ecae45787eb0bef3e3')

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
}
