pkgbase=python-pbr pkgname=(python3-pbr python2-pbr) pkgver=3.1.1 pkgrel=2 pkgdesc="Python Build Reasonableness" arch=('any') url=https://pypi.python.org/pypi/pbr license=(Apache) makedepends=(python2-setuptools python3-setuptools git) source=("$pkgbase-$pkgver.tar.gz::https://github.com/openstack-dev/pbr/archive/$pkgver.tar.gz") sha256sums=('cf742ca9b8e28fff579cc2d6d7be740a43679b2fba5603627ea7881c5d663ad5') prepare() { cp -a pbr-$pkgver{,-py2} find pbr-$pkgver-py2 -name \*.py -exec sed -i '1s/python$/&2/' {} + export PBR_VERSION=$pkgver } build() { cd "$srcdir"/pbr-$pkgver python3 setup.py build cd "$srcdir"/pbr-$pkgver-py2 python2 setup.py build } check() { cd "$srcdir"/pbr-$pkgver python3 setup.py testr || warning "Tests failed" cd "$srcdir"/pbr-$pkgver-py2 PYTHON=python2 python2 setup.py testr || warning "Tests failed" } package_python3-pbr() { depends=('python3-setuptools') cd pbr-$pkgver python3 setup.py install -O1 --root="$pkgdir" install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE } package_python2-pbr() { depends=('python2-setuptools') cd pbr-$pkgver-py2 python2 setup.py install -O1 --root="$pkgdir" install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE mv "$pkgdir"/usr/bin/pbr{,2} }