Mail archive
alpine-aports

[alpine-aports] [PATCH] testing/py-qrcode: Update to version 6.0, added python3

From: Marian Buschsieweke <marian.buschsieweke_at_ovgu.de>
Date: Tue, 24 Apr 2018 16:31:43 +0200

 - Subpackages py2-qrcode and py3-qrcode to support both python versions
 - Subpackage py-qrcode-doc contains manpage for python2 and python3 variants
 - "/usr/bin/qr" is now only provided by "py3-qrcode" to allow installing both
   versions
---
 testing/py-qrcode/APKBUILD | 52 ++++++++++++++++++++++++++++++--------
 1 file changed, 41 insertions(+), 11 deletions(-)
diff --git a/testing/py-qrcode/APKBUILD b/testing/py-qrcode/APKBUILD
index 8ce97cfaf4..f4150e4175 100644
--- a/testing/py-qrcode/APKBUILD
+++ b/testing/py-qrcode/APKBUILD
_at_@ -2,31 +2,61 @@
 # Maintainer: Fabian Affolter <fabian_at_affolter-engineering.ch>
 pkgname=py-qrcode
 _pkgname=qrcode
-pkgver=5.3
+pkgver=6.0
 pkgrel=0
 pkgdesc="A QR code image generator"
 url="https://github.com/lincolnloop/python-qrcode"
 arch="noarch"
 license="BSD"
-depends="python2 py-pillow"
-depends_dev=""
-makedepends="python2-dev py-setuptools"
+makedepends="python2-dev python3-dev py-setuptools"
+depends=" py2-${pkgname#py-} py3-${pkgname#py-}"
 install=""
-subpackages="$pkgname-doc"
-source="$pkgname-$pkgver.tar.gz::https://github.com/lincolnloop/python-qrcode/archive/v5.3.tar.gz"
+subpackages="${pkgname}-doc py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
+source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
+options="!check"
 
-builddir="$srcdir"/python-qrcode-$pkgver
+builddir="$srcdir"/$_pkgname-$pkgver
 
 build() {
 	cd "$builddir"
 	python2 setup.py build || return 1
+	python3 setup.py build || return 1
 }
 
 package() {
 	cd "$builddir"
-	python2 setup.py install --prefix=/usr --root="$pkgdir" || return 1
+	# Install only man page
+	python2 setup.py install --prefix=/usr --root="$pkgdir/tmp"
+	mkdir -p "$pkgdir/usr/share"
+	mv "$pkgdir/tmp/usr/share/man" "$pkgdir/usr/share/"
+	rm -rf "$pkgdir/tmp"
 }
 
-md5sums="81e3670f61bdf186ded61d6bafa847ec  py-qrcode-5.3.tar.gz"
-sha256sums="933123de02a116303ccdf92d1d32c65f24bf8a69faf7ecde41bd8cf4f975ad87  py-qrcode-5.3.tar.gz"
-sha512sums="9c25cadc4a5d82aabc754027373eb9700cbe4e3148fb84de1356df49dad0bfad0b86956d6e32c72448a2838f9815a029a0807c8f23f8dae042a44346c2654487  py-qrcode-5.3.tar.gz"
+_py2() {
+	depends="python2 py2-pillow"
+	replaces="$pkgname"
+	_py python2
+	rm -rf "$subpkgdir/usr/bin"
+}
+
+_py3() {
+	depends="python3 py3-six py3-pillow"
+	_py python3
+}
+
+_py() {
+	local python="$1"
+	pkgdesc="$pkgdesc (for $python)"
+	install_if="$pkgname=$pkgver-r$pkgrel $python"
+
+	cd "$builddir"
+	$python setup.py install --prefix=/usr --root="$subpkgdir"
+
+	# Remove man pages
+	rm -rf "$subpkgdir/usr/share/man"
+
+	# /usr/share should no be empty, delete it (but fail if not)
+	rmdir "$subpkgdir/usr/share"
+}
+
+sha512sums="c43f12fe6b12d244d19a994cfd20adbe3776bbda1459c9dbc6164b1c9e7637f05e2acc1c2d29b82243024a4ea9b46c319a56acdf6d05e7b697bcd2c31c02102e  qrcode-6.0.tar.gz"
-- 
2.17.0
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Tue Apr 24 2018 - 16:31:43 GMT