# Maintainer: Sarah Ottinger <schalaalexiazeal@gmail.com>

_realname=rpyc
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=6.0.2
pkgrel=1
pkgdesc='Remote Python Call - A transparent and symmetric RPC library for python (mingw-w64)'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://rpyc.readthedocs.io/'
msys2_repository_url='https://github.com/tomerfiliba-org/rpyc'
msys2_references=(
  "cpe: cpe:/a:rpyc_project:rpyc"
  "purl: pkg:pypi/rpyc"
)
license=('spdx:MIT')
depends=("${MINGW_PACKAGE_PREFIX}-python-plumbum")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-hatchling")
options=('!strip')
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('8e780a6a71b842128a80a337c64adfb6f919014e069951832161c9efc630c93b')

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