# Template file for 'python-virtualenv-clone'
pkgname=python-virtualenv-clone
version=0.2.5
revision=1
noarch=yes
wrksrc="${pkgname#*-}-${version}"
python_versions="2.7 3.4"
build_style=python-module
hostmakedepends="python-setuptools python3.4-setuptools"
makedepends="python-devel python3.4-devel"
depends="python python-setuptools"
pycompile_module="clonevirtualenv.py"
short_desc="Script to clone virtualenvs (Python2)"
maintainer="Alessio Sergi <al3hex@gmail.com>"
homepage="https://github.com/edwardgeorge/virtualenv-clone"
license="MIT"
distfiles="https://pypi.python.org/packages/source/v/${pkgname#*-}/${pkgname#*-}-${version}.tar.gz"
checksum=7087ba4eb48acfd5209a3fd03e15d072f28742619127c98333057e32748d91c4

post_extract() {
	cp -a ${wrksrc} /tmp/python2.7-build
	cp -a ${wrksrc} /tmp/python3.4-build
	mv /tmp/python{2.7,3.4}-build ${wrksrc}
}

pre_build() {
	cd ${wrksrc}/python3.4-build
	sed -i 's,virtualenv-clone=,virtualenv-clone3=,' setup.py
}

do_build() {
	cd ${wrksrc}/python2.7-build
	python setup.py build

	cd ${wrksrc}/python3.4-build
	python3.4 setup.py build
}

do_install() {
	cd ${wrksrc}/python2.7-build
	python setup.py install --root=${DESTDIR}

	cd ${wrksrc}/python3.4-build
	python3.4 setup.py install --root=${DESTDIR}
}

post_install() {
	vlicense LICENSE
}

python3.4-virtualenv-clone_package() {
	noarch=yes
	depends="python3.4 python3.4-setuptools"
	pycompile_version="3.4"
	pycompile_module="clonevirtualenv.py"
	short_desc="${short_desc/Python2/Python3.4}"
	pkg_install() {
		vmove usr/bin/virtualenv-clone3
		vmove usr/lib/python3.4
		vlicense ${wrksrc}/LICENSE
	}
}
