# Maintainer: Developer <dev@opalos.org>
# Maintainer: Developer <dev@opalos.org>

pkgname=python-typing_extensions
_name=${pkgname#python-}
pkgver=%version%
pkgrel=%release%
pkgdesc='Backported and Experimental Type Hints for Python 3.8+'
arch=(any)
url=https://github.com/python/typing_extensions
license=(Python-2.0.1)
depends=(python)
makedepends=(git python-build python-flit-core python-installer)
checkdepends=(python-tests)
provides=(python-typing-extensions)
conflicts=(python-typing-extensions)
source=("git+${url}.git#tag=${pkgver}")
b2sums=('1ff6d7f08b3a46743a3252a18cbf6b41dff5f0e65f175cfd94b3fdf78b9d20872ac32d50e3f6da4c3a6ac69305ea6311f6b4df8170c286f0d5df99362929781f')

pkgver() {
  cd "${_name}"

  git describe --tags
}

build() {
  cd "${_name}"

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

check() {
  cd "${_name}"

  python -m unittest discover src
}

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:
