# Contributor: ScrumpyJack <scrumpyjack@st.ilet.to>
# Maintainer: ScrumpyJack <scrumpyjack@st.ilet.to>
pkgname=py-sensehat
_pkgname=python-sense-hat
pkgver=2.2.0
pkgrel=0
pkgdesc="Python module to control the Raspberry Pi Sense HAT"
url="https://www.raspberrypi.org/products/sense-hat/"
arch="armhf"
license="BSD-3-Clause"
depends=""
# Package doesn't provide tests
options="!check"
makedepends="python2-dev python3-dev py-setuptools"
subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
source="$_pkgname-$pkgver.tar.gz::https://github.com/RPi-Distro/${_pkgname}/archive/v${pkgver}.tar.gz"
builddir=${srcdir}/${_pkgname}-${pkgver}

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

#check() {
#	cd "$builddir"
#	python2 setup.py test
#	python3 setup.py test
#}

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

_py2() {
	replaces="$pkgname"
	_py python2
}

_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="71914f6f22206cff23992a6908698978741a46bf9b98648388bac4550f39e8de73db6bd389b79585eba6e82160649a8c8da4217d515bbdbcb50d47218415f3ac  python-sense-hat-2.2.0.tar.gz"
