# Template file for 'python-Unidecode'
pkgname=python-Unidecode
version=0.04.18
revision=1
noarch=yes
wrksrc="Unidecode-${version}"
build_style=python-module
python_versions="2.7 3.4"
hostmakedepends="python-setuptools python3.4-setuptools"
depends="python-setuptools"
pycompile_module="unidecode"
short_desc="Python2 ASCII transliterations of Unicode text"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="https://pypi.python.org/pypi/Unidecode/"
license="GPL-2"
distfiles="${PYPI_SITE}/U/Unidecode/Unidecode-${version}.tar.gz"
checksum=f19150c74de2fe6847b13efeeaee402f2bd2c309a446346a8b5baae0315d108a

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

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

python3.4-Unidecode_package() {
	noarch=yes
	depends="python3.4-setuptools"
	pycompile_version="3.4"
	pycompile_module="unidecode"
	short_desc="${short_desc/Python2/Python3.4}"
	pkg_install() {
		vmove usr/bin/unidecode3
		vmove usr/lib/python3.4
	}
}
