# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>
# Maintainer: Daniel M. Capella <polyzen@archlinux.org>

_pkgname=linkify-it-py
pkgname=python-$_pkgname
pkgver=2.1.0
pkgrel=1
pkgdesc='Links recognition library with full unicode support'
arch=('any')
url='https://github.com/tsutsu3/linkify-it-py'
license=('MIT')
depends=('python-uc-micro-py')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
checkdepends=('python-pytest')
source=("$_pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
sha512sums=('57652452565a667eca723e116fae858ae8eabbc0b2028520d213c2bce607aa586cd3d542847776cf1aa3ac57562348074433f072c7c993f2690d032e906e5689')

build() {
  cd $_pkgname-$pkgver

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

check() {
  cd $_pkgname-$pkgver

  python -m pytest
}

package() {
  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

  cd $_pkgname-$pkgver

  python -m installer -d "$pkgdir" dist/*.whl
}

# vim:set ts=2 sw=2 et:
