# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>

_realname=oslo-concurrency
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=7.2.0
pkgrel=1
pkgdesc="OpenStack library for all concurrency-related code (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
msys2_references=(
  'archlinux: python-oslo-concurrency'
  'gentoo: dev-python/oslo-concurrency'
  'purl: pkg:pypi/oslo-concurrency'
)
msys2_repository_url='https://opendev.org/openstack/oslo.concurrency'
msys2_changelog_url='https://docs.openstack.org/releasenotes/oslo.concurrency/'
msys2_documentation_url='https://docs.openstack.org/oslo.concurrency/latest/'
msys2_issue_tracker_url='https://bugs.launchpad.net/oslo.concurrency'
url='https://docs.openstack.org/oslo.concurrency/latest'
license=('spdx:Apache-2.0')
depends=("${MINGW_PACKAGE_PREFIX}-python-pbr"
         "${MINGW_PACKAGE_PREFIX}-python-oslo-config"
         "${MINGW_PACKAGE_PREFIX}-python-oslo-i18n"
         "${MINGW_PACKAGE_PREFIX}-python-oslo-utils"
         "${MINGW_PACKAGE_PREFIX}-python-fasteners")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python-oslotest"
              "${MINGW_PACKAGE_PREFIX}-python-eventlet")
options=(!strip)
source=("https://pypi.io/packages/source/${_realname:0:1}/${_realname/-/_}/${_realname/-/_}-${pkgver}.tar.gz")
sha256sums=('160e814c8549f6a464e77a04265ed996d581bdd3fd3bd4ebf311d3446bb7e1aa')

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

check() {
  cd "${srcdir}/python-build-${MSYSTEM}"
  PYTHON=${MINGW_PREFIX}/bin/python ${MINGW_PREFIX}/bin/stestr run || warning "Tests failed"
}

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 "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
