Subject: [alpine-aports] [PATCH] community/py-udev: update to include a python3 version

From: Luca Weiss <[email-masked]>
Date: Mon, 25 Sep 2017 13:28:59 +0200

---
 community/py-udev/APKBUILD | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/community/py-udev/APKBUILD b/community/py-udev/APKBUILD
index fd3e6bef59..32a38c731a 100644
--- a/community/py-udev/APKBUILD
+++ b/community/py-udev/APKBUILD
@@ -6,21 +6,42 @@ pkgdesc="Python bindings to libudev"
 url="http://pyudev.readthedocs.org"
 arch="noarch"
 license="LGPLv2.1"
-depends="python2 eudev"
-makedepends="python2-dev py-setuptools"
+depends="eudev"
+makedepends="python2-dev python3-dev py-setuptools"
 install=""
-subpackages=""
+subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
 source="py-udev-$pkgver.tar.gz::https://github.com/pyudev/pyudev/archive/v$pkgver.tar.gz"
 builddir="$srcdir/pyudev-$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"
-	python2 setup.py install --prefix=/usr --root="$pkgdir" || return 1
+	$python setup.py install --prefix=/usr --root="$subpkgdir"
 }
 
 sha512sums="c6cc8786c69de2a07eeae39cb57e33db6ca5fea83c38fdab277070bf052c97bd053911ab08a11fe65cb56c463492111e74451801390d89dc7f00fd00e68bba19  py-udev-0.21.0.tar.gz"
-- 
2.14.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Luca Weiss <[email-masked]>
Date: Mon, 25 Sep 2017 13:52:56 +0200

---
Changes v1 -> v2:
- added py{2,3}-six dependency

index fd3e6bef59..9d65a03f00 100644
+depends="eudev py-six"
 
 build() {
 	cd "$builddir"
 
 package() {
+	mkdir -p "$pkgdir"
+}
+
+_py2() {
+	replaces="$pkgname"

---