# Maintainer: João Guerra <joca.bt@gmail.com>

pkgbase="python-pygments"
pkgname=("python-pygments")
pkgver=2.19.2
pkgrel=1
pkgdesc="A syntax highlighting engine written in Python"
arch=("i686" "x86_64")
url="https://pygments.org/"
msys2_repository_url="https://github.com/pygments/pygments"
msys2_references=(
  "purl: pkg:pypi/pygments"
  "cpe: cpe:/a:pygments:pygments"
)
license=('spdx:BSD-2-Clause')
depends=("python")
makedepends=(
  "python-hatchling"
  "python-build"
  "python-installer"
)
provides=("python3-pygments")
conflicts=("python3-pygments")
replaces=("python3-pygments")
source=("https://pypi.python.org/packages/source/p/pygments/pygments-${pkgver}.tar.gz")
sha256sums=('636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887')

build() {
  cd "pygments-${pkgver}"

  python -m build --wheel --skip-dependency-check --no-isolation
}

package () {
  cd "pygments-${pkgver}"

  python -m installer --destdir="${pkgdir}" dist/*.whl
  install -Dm644 external/pygments.bashcomp "${pkgdir}/usr/share/bash-completion/completions/pygmentize"
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
