# Contributor: Francesco Colista # Maintainer: Francesco Colista pkgname=py-jsonschema _pkgname=jsonschema pkgver=3.0.2 pkgrel=0 pkgdesc="An implementation of JSON Schema validation for Python" url="https://github.com/Julian/jsonschema" arch="noarch" license="MIT" depends="py3-pyrsistent py-attrs" makedepends="python3-dev python2-dev py-setuptools" subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3" options="!check" # py3-twisted missing source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz" builddir="$srcdir"/$_pkgname-$pkgver build() { cd "$builddir" python2 setup.py build python3 setup.py build } package() { mkdir -p "$pkgdir"/usr/bin ln -s jsonschema-3 "$pkgdir"/usr/bin/jsonschema || return 1 } _py2() { replaces="$pkgname" depends="${depends/py-/py2-}" _py python2 } _py3() { depends="${depends/py-/py3-}" _py python3 } _py() { local python="$1" local pyver="${1:6:1}" pkgdesc="$pkgdesc (for $python)" depends="$depends $python" ## remove if arch isn't noarch install_if="$pkgname=$pkgver-r$pkgrel $python" cd "$builddir" $python setup.py install --prefix=/usr --root="$subpkgdir" # Add version suffix to executable files. local path; for path in "$subpkgdir"/usr/bin/*; do mv "$path" "$path-$pyver" || return 1 done } sha512sums="13b65f318e1e2dc4a1d61399d517d39e53b0da71fbb5ec116e3b4ee274694300c6e2b3545058cd9f15129633fd093fa2d0c21ef1cce5356ca78e74187e7045c3 jsonschema-3.0.2.tar.gz"