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

_realname=e3-core
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=22.10.0
pkgrel=1
pkgdesc="E3 core. Tools and library for building and testing software (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://github.com/AdaCore/e3-core"
msys2_references=(
  'purl: pkg:pypi/e3-core'
  'aur: python-e3-core'
  'gentoo: dev-ada/e3-core'
)
license=('spdx:GPL-3.0-only')
depends=("${MINGW_PACKAGE_PREFIX}-python"
         "${MINGW_PACKAGE_PREFIX}-python-colorama"
         "${MINGW_PACKAGE_PREFIX}-python-dateutil"
         "${MINGW_PACKAGE_PREFIX}-python-packaging"
         "${MINGW_PACKAGE_PREFIX}-python-psutil"
         "${MINGW_PACKAGE_PREFIX}-python-requests"
         "${MINGW_PACKAGE_PREFIX}-python-requests-cache"
         "${MINGW_PACKAGE_PREFIX}-python-requests-toolbelt"
         "${MINGW_PACKAGE_PREFIX}-python-resolvelib"
         "${MINGW_PACKAGE_PREFIX}-python-setuptools"
         "${MINGW_PACKAGE_PREFIX}-python-stevedore"
         "${MINGW_PACKAGE_PREFIX}-python-tqdm"
         "${MINGW_PACKAGE_PREFIX}-python-yaml")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer")
options=('!strip')
source=("https://github.com/AdaCore/e3-core/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz")
sha256sums=('496b630569579c0b544e5455681076baeb6195d9ed03b4a7c7add9618d9e7127')

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 -t "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}" \
    "${srcdir}/${_realname}-${pkgver}/COPYING3"
}
