# Template file for 'python-curl'
pkgname=python-curl
version=7.19.5
revision=1
wrksrc="pycurl-${version}"
build_style=python-module
python_versions="2.7 3.4"
hostmakedepends="python-devel python3.4-devel"
makedepends="libressl-devel libcurl-devel ${hostmakedepends}"
replaces="pycurl>=0"
pycompile_module="curl"
short_desc="Python2 interface to cURL library"
homepage="http://pycurl.sourceforge.net/"
license="LGPL-2.1, MIT"
maintainer="Juan RP <xtraeme@gmail.com>"
distfiles="http://pycurl.sourceforge.net/download/pycurl-${version}.tar.gz"
checksum=69a0aa7c9dddbfe4cebf4d1f674c490faccf739fc930d85d8990ce2fd0551a43

CFLAGS="-fno-strict-aliasing"

_doc_install() {
	vmkdir usr/share/doc/${pkgname}
	vcopy "examples AUTHORS ChangeLog README.rst RELEASE-NOTES.rst" usr/share/doc/${pkgname}
	# install licenses
	vlicense COPYING-LGPL
	vlicense COPYING-MIT
}

post_install() {
	# remove documentation as installed by setup.py
	rm -rf ${DESTDIR}/usr/share/doc
	_doc_install
}

python3.4-curl_package() {
	pycompile_version="3.4"
	pycompile_module="curl"
	short_desc="${short_desc/Python2/Python3.4}"
	pkg_install() {
		vmove usr/lib/python3.4
		cd ${wrksrc}
		find . -name '*.py' -exec sed -i -e 's,#! /usr/bin/env python,&3.4,' {} +
		_doc_install
	}
}
