# Maintainer: Rafael Dominiquini <rafaeldominiquini at gmail dot com>

_upstreamver='2.1.0'
_upstreamver_regex='^[0-9]+\.[0-9]+\.[0-9]+$'
_source_type='pypi-releases'
_pypi_package='emoji-country-flag'

pkgname="python-${_pypi_package}"
pkgver="${_upstreamver}"
pkgrel=1
pkgdesc="En/Decode unicode country flags emoji"
arch=('any')
url='https://github.com/cvzi/flag'
license=('MIT')
depends=('python')
makedepends=('python-setuptools' 'python-wheel' 'python-build' 'python-installer')
source=("https://files.pythonhosted.org/packages/source/${_pypi_package::1}/${_pypi_package//-/_}/${_pypi_package//-/_}-${pkgver}.tar.gz")
sha256sums=('3b4df6a9d9961ab7716090689c2e96405baff68e46849ab2704335d904589f2a')

build() {
  cd "${srcdir}/${_pypi_package//-/_}-${pkgver}/"

  python -m build --wheel --no-isolation
}

package() {
  cd "${srcdir}/${_pypi_package//-/_}-${pkgver}/"

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

  install -Dm644 "README.md" "${pkgdir}/usr/share/doc/${pkgname}/README.md"

  install -Dm644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
