# Maintainer: Konstantin Podsvirov <konstantin@podsvirov.su>

_realname=sphinx-copybutton
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-$_realname")
pkgver=0.5.2
pkgrel=4
pkgdesc="Sphinx extension to add a \"copy\" button to code blocks (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://sphinx-copybutton.readthedocs.io/"
msys2_repository_url="https://github.com/executablebooks/sphinx-copybutton"
msys2_references=(
  'purl: pkg:pypi/sphinx-copybutton'
)
license=('spdx:MIT')
depends=("${MINGW_PACKAGE_PREFIX}-python"
         "${MINGW_PACKAGE_PREFIX}-python-sphinx")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=(https://pypi.org/packages/source/s/$_realname/$_realname-$pkgver.tar.gz)
sha256sums=('4cf17c82fb9646d1bc9ca92ac280813a3b605d8c421225fd9913154103ee1fbd')

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"
  install -Dm644 README.md "${pkgdir}${MINGW_PREFIX}/share/doc/python-${_realname}/README.md"
}

# vim:set ts=2 sw=2 et:
