# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Roger Duran <rogerduran@gmail.com>

pkgname=python-xcffib
pkgver=1.4.0
_commit=517169a2fb6dcc127059f581d3890e0861e2e950
pkgrel=2
pkgdesc="Python3 drop in replacement for xpyb, an XCB python binding"
arch=('any')
url="https://pypi.python.org/pypi/xcffib"
license=('Apache')
depends=('python-cffi' 'libxcb')
makedepends=('git' 'python-setuptools' 'haskell-xcffib')
checkdepends=('python-pytest' 'xorg-server-xvfb' 'xorg-xeyes')
source=("git+https://github.com/tych0/xcffib.git#commit=$_commit")
sha512sums=('SKIP')

prepare() {
  cd xcffib
  # Remove redundant six import
  git cherry-pick -n 96eb6d4a6fa0b1404bf4ba072d0bb8f9e58af306
}

build() {
  cd xcffib
  make xcffib GEN=xcffibgen CABAL=true
  python setup.py build
}

check() {
  cd xcffib
  xvfb-run pytest
}

package() {
  cd xcffib
  python setup.py install --root="$pkgdir/" --optimize=1
}
