# Contributor: Raed Rizqie <raed.rizqie@gmail.com>

_realname=jsonschema-specifications
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=2025.9.1
pkgrel=1
pkgdesc='The JSON Schema meta-schemas and vocabularies, exposed as a Registry (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
msys2_references=(
  'archlinux: python-jsonschema-specifications'
  'gentoo: dev-python/jsonschema-specifications'
  'purl: pkg:pypi/jsonschema-specifications'
)
msys2_repository_url='https://github.com/python-jsonschema/jsonschema-specifications'
url='https://jsonschema-specifications.readthedocs.io/'
license=('spdx:MIT')
depends=("${MINGW_PACKAGE_PREFIX}-python"
         "${MINGW_PACKAGE_PREFIX}-python-referencing")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-hatch-vcs"
             "${MINGW_PACKAGE_PREFIX}-python-hatchling"
             "${MINGW_PACKAGE_PREFIX}-python-installer")
options=('!strip')
source=("https://pypi.org/packages/source/${_realname::1}/${_realname/-/_}/${_realname/-/_}-${pkgver}.tar.gz")
sha256sums=('b540987f239e745613c7a9176f3edb72b832a4ac465cf02712288397832b5e8d')

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=;--install-scripts=;--install-platlib=" \
    ${MINGW_PREFIX}/bin/python -m installer --prefix=${MINGW_PREFIX} \
    --destdir="${pkgdir}" dist/*.whl

  install -Dm644 "COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
