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

_realname=markdown-it-py
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=3.0.0
pkgrel=4
pkgdesc='Python port of markdown-it. Markdown parsing, done right! (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://github.com/executablebooks/markdown-it-py'
msys2_references=(
  "cpe: cpe:/a:executablebooks:markdown-it-py"
  "purl: pkg:pypi/markdown-it-py"
)
license=('spdx:MIT')
depends=("${MINGW_PACKAGE_PREFIX}-python"
         "${MINGW_PACKAGE_PREFIX}-python-mdurl")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-flit-core")
options=('!strip')
source=("$url/archive/v$pkgver/${_realname}-${pkgver}.tar.gz")
sha256sums=('60dffc950e61a2b4ec980087d79352293f138f7b41bf3d7f8e1907160986c886')

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"
}

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