# Contributor: Danilo Falcão <danilo@falcao.org>
# Maintainer: Danilo Falcão <danilo@falcao.org>
pkgname=pelican
_pkgname=pelican
pkgver=3.7.1
pkgrel=0
pkgdesc="A tool to generate a static blog from reStructuredText or Markdown input files."
url="https://pypi.python.org/pypi/pelican/"
arch="noarch"
license="AGPL-3.0"
depends="bash py-feedgenerator py-pygments py-docutils py-blinker py-unidecode
		py-markdown py-jinja2 py-dateutil"
makedepends="python2-dev py-setuptools python3-dev"
subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz
	pelican
	pelican-import
	pelican-quickstart
	pelican-themes
"
builddir="$srcdir"/$_pkgname-$pkgver

build() {
	cd "$builddir"
	python2 setup.py build || return 1
	python3 setup.py build || return 1
}

package() {
	mkdir -p "$pkgdir"
}

_py2() {
	replaces="$pkgname"
	depends="${depends//py-/py2-}"
	_py python2
}

_py3() {
	depends="${depends//py-/py3-}"
	_py python3
}

_py() {
	local python="$1"
	pkgdesc="$pkgdesc (for $python)"
	depends="$depends $python"
	install_if="$pkgname=$pkgver-r$pkgrel $python"

	cd "$builddir"
	$python setup.py install --prefix=/usr --root="$subpkgdir"

	install -Dm755 "$srcdir"/pelican "$pkgdir"/usr/bin/pelican || return 1
	install -Dm755 "$srcdir"/pelican-import "$pkgdir"/usr/bin/pelican-import || return 1
	install -Dm755 "$srcdir"/pelican-quickstart "$pkgdir"/usr/bin/pelican-quickstart || return 1
	install -Dm755 "$srcdir"/pelican-themes "$pkgdir"/usr/bin/pelican-themes || return 1
}


sha512sums="bb378ac5103d402e7955a7852c190ff7faece12b1f48c5583552ad64e47e06af886267da8d54be6123ee5ba0231f8fff4a3ef5130a45e95d9a8f907a20ec9851  pelican-3.7.1.tar.gz
430260ecf616254ebd402caa0fc39a220748e95460f670bf43ab50922cdff3ba142aacc12f862ce8b12b069b8218fe24b8387723911e3b3acc83960d05cfafff  pelican
f7638795328ca5e103d8e0fa41b3b559f0657d75465fd88ca64be3514ecbc6ef0566ffc687a8869291d6b80b57fa7695ab454c33f014934eebda7ae00ec92763  pelican-import
7fb3002ee7cee43bc8f216d6df67c8144059090598a25a676880eeccc36d8d0d7063eac3792115843c3d9a5c3d859ad63bae5c9eeb858878f921fe95e0d43c95  pelican-quickstart
132fb5cd6a09f2d5c9d7759240b3621808d3447d30f14a27722add6e5d8f95e9547043a144ad1f98dc74844fdadf0cbd66011d7f6bde7d087bde11284c9eb105  pelican-themes"
