# Maintainer: Biswapriyo Nath <nathbappai@gmail.com>

_pyname=owslib
_realname=owslib
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=0.34.1
pkgrel=1
pkgdesc="Python package for client programming with Open Geospatial Consortium (OGC) web service interface standards, and their related content models (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
msys2_references=(
  'anitya: 3945'
  'archlinux: python-owslib'
  'gentoo: dev-python/owslib'
  'purl: pkg:pypi/owslib'
)
license=('spdx:BSD-3-Clause')
url="https://owslib.readthedocs.io/"
msys2_repository_url='https://github.com/geopython/OWSLib/'
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools")
depends=("${MINGW_PACKAGE_PREFIX}-python"
         "${MINGW_PACKAGE_PREFIX}-python-dateutil"
         "${MINGW_PACKAGE_PREFIX}-python-lxml"
         "${MINGW_PACKAGE_PREFIX}-python-pytz"
         "${MINGW_PACKAGE_PREFIX}-python-requests"
         "${MINGW_PACKAGE_PREFIX}-python-yaml")
source=("https://pypi.org/packages/source/${_pyname::1}/${_pyname}/${_pyname/-/_}-${pkgver}.tar.gz")
sha256sums=('9c46d59dc03c753912fc3ef3136dbc843dad7572feb1af2cdf0fc5d1a0959028')

build() {
  cp -r "${_pyname}-${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 -t "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}"
}
