# Packager = Tuxcore <dev@tuxcore.org> 
_name=charset_normalizer
pkgname=python-charset-normalizer
pkgver=3.3.2
pkgrel=2
pkgdesc='Encoding and language detection alternative to chardet'
arch=(any)
url=https://github.com/Ousret/charset_normalizer
license=(MIT)
depends=(python)
makedepends=(
  git
  python-build
  python-installer
  python-setuptools
  python-wheel
)
checkdepends=(
  python-pytest
)
source=("git+$url.git#tag=$pkgver")
b2sums=('005698ff0db98835326e055cb0097048998d2657b5998d09c1fbd81e0ab6c0551c5faf6c9934e3865dcd337cb2f86646acef37cd65187bf334b50c8328233c9b')

pkgver() {
  cd $_name
  git describe --tags
}

build() {
  cd $_name
  python -m build --wheel --skip-dependency-check --no-isolation
}

check() {
  cd $_name
  # Override addopts as they invoke coverage testing
  pytest --override-ini="addopts="
}

package() {
  cd $_name
  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"/$_name-$pkgver.dist-info/LICENSE \
    "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

# vim: ts=2 sw=2 et:
