# Maintainer : Christoph Reiter <reiter.christoph@gmail.com>

pkgname=namcap
pkgver=3.3.1
pkgrel=6
pkgdesc="A Pacman package analyzer"
arch=('any')
url="https://gitlab.archlinux.org/pacman/namcap"
license=('GPL')
depends=('python'
         'python-pyalpm'
         'binutils')
makedepends=(
  "python-setuptools"
  "python-build"
  "python-installer"
)
source=(https://gitlab.archlinux.org/pacman/namcap/-/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz
        '001-disable-some-things.patch'
        '002-force-msys-python.patch'
        '003-fix-install-paths.patch')
sha256sums=('d3c016c82c2ee91271b71111718c41338c0db9e3d36e8b38e62c08d3a47225f5'
            'cb967efd1368007d4712feb9b33e29fb7d0ebb77cdce23adadaa75791187aab0'
            'd3c8b73c1d506bb30e41dac1f8663e62d1a52e2b74d2bae8e7f04986c2a2b8e9'
            '3bfeaae85da41279816805858ce24c64b8c55b6e079a2c4ced70883e800093af')
noextract=(${pkgname}-${pkgver}.tar.gz)

prepare() {
  tar -xzvf ${pkgname}-${pkgver}.tar.gz || true
  cd ${pkgname}-${pkgver}

  patch -Nbp1 -i "${srcdir}/001-disable-some-things.patch"
  patch -Nbp1 -i "${srcdir}/002-force-msys-python.patch"
  patch -Nbp1 -i "${srcdir}/003-fix-install-paths.patch"
}

build() {
  cd ${pkgname}-${pkgver}

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

package() {
  cd ${pkgname}-${pkgver}

  python -m installer --destdir="${pkgdir}" dist/*.whl
}

