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

pkgbase="python-pygments"
pkgname=("python-pygments")
pkgver=2.18.0
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=(
  "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=('786ff802f32e91311bff3889f6e9a86e81505fe99f2735bb6d60ae0c5004f199')

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