# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Jim Bridgewater <jwbwater at gmail dot com>
# Contributor: delta48 <dark.magician.48[at]gmail[dot]com>

pkgname=python-pyperclip
pkgver=1.11.0
_commit=f5326bfd7c5448b40051dd261a7304657977b838
pkgrel=1
pkgdesc="A cross-platform clipboard module for Python"
arch=('any')
url="https://github.com/asweigart/pyperclip"
license=('BSD-3-Clause')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
# GTK/Qt tests crash xvfb, and Klipper tests require a running klipper
#checkdepends=('xorg-server-xvfb' 'python-pytest' 'xsel' 'xclip')
depends=('python')
optdepends=('xclip: xclip backend'
            'xsel: xsel backend'
            'wl-clipboard: wl-clipboard backend'
            'plasma-workspace: klipper backend')
source=("$pkgname-$_commit.tar.gz::https://github.com/asweigart/pyperclip/archive/$_commit.tar.gz")
sha512sums=('550c77d2d329361575af8bdf96e09a51d8653d4fb6ce86062e4ef3292d53d6bd5c4d37f2d39cefebbee1774f852948b2a2fba9eea0e27f2dbd392bbe5ef15a90')

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

# https://github.com/asweigart/pyperclip/issues/263
#check() {
#  cd pyperclip-$_commit
#  PYTHONPATH="$PWD"/build/lib xvfb-run py.test
#}

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

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