pkgname=pathspec
pkgver=0.12.1
pkgdesc='Utility library for gitignore style pattern matching of file paths'
arch=('any')
homepage=https://github.com/cpburnz/python-pathspec
license=('MPL2')
depends=('python')
sources=("${pkgname}-${pkgver}.tar.gz")
urls=("https://files.pythonhosted.org/packages/source/${pkgname:0:1}/${pkgname}/${sources[0]}")
md5sums=("2b26ad1981bfa23748e115f00085624c")

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
}

src_build() {
  python -m build --wheel --skip-dependency-check --no-isolation
}

src_check() {
  python -m unittest
}

src_install() {
  python -m installer --destdir="$pkgdir" dist/*.whl

  # Symlink license file
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  install -d "$pkgdir"/usr/share/licenses/$pkgname
  ln -s "$site_packages"/"$pkgname"-$pkgver.dist-info/licenses/LICENSE \
    "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

