# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py-telegram-bot
_pkgname=${pkgname/py/python}
pkgver=8.0.0
pkgrel=0
pkgdesc="A Python wrapper around the Telegram Bot API"
url="https://github.com/python-telegram-bot/python-telegram-bot"
arch="noarch"
license="LGPL-3.0-or-later"
depends="py-futures py-certifi"
depends_dev=""
makedepends="python2-dev python3-dev py2-setuptools"
install=""
subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
source="$pkgname-$pkgver.zip::https://github.com/$_pkgname/$_pkgname/archive/v$pkgver.zip"
builddir="$srcdir"/$_pkgname-$pkgver

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

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"
}

sha512sums="179b0a84bbee2b55acf45cbe4225723369ff025d4474cb8aa922f6d94128cb96c2c630108213a824877b1580461de7f748476829e4274341b6ee1c670d2ae6c2  py-telegram-bot-8.0.0.zip"
