# Template file for 'python-jsonschema'
pkgname=python-jsonschema
version=2.5.1
revision=2
noarch=yes
wrksrc="jsonschema-${version}"
python_versions="2.7 3.4"
hostmakedepends="python-setuptools python3.4-setuptools
 python-vcversioner python3.4-vcversioner"
depends="python-setuptools python-functools32"
pycompile_module="jsonschema"
short_desc="Implementation of JSON Schema for Python2"
maintainer="Alessio Sergi <al3hex@gmail.com>"
homepage="https://github.com/Julian/jsonschema"
license="MIT"
distfiles="${PYPI_SITE}/j/jsonschema/jsonschema-${version}.tar.gz"
checksum=36673ac378feed3daa5956276a829699056523d7961027911f064b52255ead41

pre_build() {
	cp -a ${wrksrc} /tmp/jsonschema-2.7
	cp -a ${wrksrc} /tmp/jsonschema-3.4
	mv /tmp/jsonschema-{2.7,3.4} ${wrksrc}

	cd jsonschema-3.4
	sed -i 's,\(jsonschema\) =,\13 =,' setup.py
}
do_build() {
	for pyver in $python_versions; do
		cd ${wrksrc}/jsonschema-${pyver}
		python${pyver} setup.py build
	done
}
do_install() {
	for pyver in $python_versions; do
		cd ${wrksrc}/jsonschema-${pyver}
		python${pyver} setup.py install --root=${DESTDIR}
	done
	vlicense COPYING LICENSE
}

python3.4-jsonschema_package() {
	noarch=yes
	depends="python3.4-setuptools"
	pycompile_version="3.4"
	pycompile_module="jsonschema"
	short_desc="${short_desc/Python2/Python3.4}"
	pkg_install() {
		vmove usr/bin/jsonschema3
		vmove usr/lib/python3.4
		vlicense COPYING LICENSE
	}
}
