# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Robin Candau <antiz@archlinux.org>

pkgname=python-tqdm
pkgver=4.66.2
_commit=cc372d09dcd5a5eabdc6ed4cf365bdb0be004d44
pkgrel=1
pkgdesc='Fast, Extensible Progress Meter'
arch=('any')
license=('MIT' 'MPL-2.0')
url='https://github.com/tqdm/tqdm'
depends=('python')
optdepends=('python-requests: telegram')
makedepends=('git' 'python-setuptools-scm' 'python-toml' 'python-build' 'python-installer' 'python-wheel')
checkdepends=('python-pytest' 'python-pytest-asyncio' 'python-pytest-timeout' 'python-numpy' 'python-pandas' 'python-rich' 'python-dask' 'tk' 'python-keras')
source=("git+https://github.com/tqdm/tqdm.git#commit=${_commit}")
sha512sums=('SKIP')

build() {
  cd tqdm
  python -m build --wheel --no-isolation
}

check() {
  cd tqdm

  # Tests fail with the following error:
  # ```
  # E   DeprecationWarning: np.find_common_type is deprecated.  Please use `np.result_type` or `np.promote_types`.
  # E   See https://numpy.org/devdocs/release/1.25.0-notes.html and the docs for more information.  (Deprecated NumPy 1.25)
  # ```
  # This is because "python-pandas" is outdated in our repo. It is currently in v1.5.3 in [extra] while the test for this package requires >= 2.0.0
  # See the following link for mor details: https://github.com/sdv-dev/SDV/issues/1469#issuecomment-1616746578
  # Until "python-pandas" isn't updated on our side, the tests will fail so they are disabled for now.

  #pytest
}

package() {
  cd tqdm
  python -m installer --destdir="${pkgdir}" dist/*.whl
  install -Dm 644 LICENCE "${pkgdir}/usr/share/licenses/${pkgname}/LICENCE"
  install -Dm 644 tqdm/completion.sh "${pkgdir}/usr/share/bash-completion/completions/tqdm"
}

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