# Contributor: Francesco Colista # Maintainer: Francesco Colista pkgname=py-jsonschema _pkgname=jsonschema pkgver=3.0.1 pkgrel=2 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="564e7385728b15387cd44c06cf50c36342fe4c6f497d208ce3d611d1659023e95ff032b2609a786cd9610bd915f878d138eef47913f18cc56eaae0651eb6efe8 jsonschema-3.0.1.tar.gz"