# Maintainer: Alexandre Ferreira < alex.jorge.m [at] gmail.com >

_realname=wcwidth
pkgbase=python-${_realname}
pkgname=("python-${_realname}")
pkgver=0.2.14
pkgrel=1
pkgdesc='Measures number of Terminal column cells of wide-character codes'
url='https://github.com/jquast/wcwidth'
msys2_references=(
  "anitya: 88052"
  "archlinux: python-wcwidth"
  "cygwin: python-wcwidth"
  "gentoo: dev-python/wcwidth"
  "purl: pkg:pypi/wcwidth"
)
arch=('any')
license=('spdx:MIT')
depends=('python')
makedepends=(
  "python-setuptools"
  "python-build"
  "python-installer"
)
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/jquast/${_realname}/archive/${pkgver}.tar.gz")
sha256sums=('b3d1b4f2bf12f2bf9a759de9b1322c83367d199b3c7526191b8bfb54816bf0b0')
noextract=("${_realname}-${pkgver}.tar.gz")

prepare() {
  [[ -d ${srcdir}/${_realname}-${pkgver} ]] && rm -rf ${srcdir}/${_realname}-${pkgver}
  bsdtar -xzf ${srcdir}/${_realname}-${pkgver}.tar.gz -C $srcdir || true
  bsdtar -xzf ${srcdir}/${_realname}-${pkgver}.tar.gz -C $srcdir || true

}

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

package() {
  cd "${_realname}-${pkgver}"
  python -m installer --destdir="${pkgdir}" dist/*.whl
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/python-${_realname}/LICENSE"
}
