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

From: Luca Weiss <[email-masked]>
Date: Sat, 23 Sep 2017 21:15:05 +0200

python2 -c "import dbus"
python3 -c "import dbus"
both work
---
 main/py-dbus/APKBUILD | 67 ++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 50 insertions(+), 17 deletions(-)

diff --git a/main/py-dbus/APKBUILD b/main/py-dbus/APKBUILD
index 5b507c7ca6..762dda689f 100644
--- a/main/py-dbus/APKBUILD
+++ b/main/py-dbus/APKBUILD
@@ -1,37 +1,70 @@
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=py-dbus
 pkgver=1.2.0
-pkgrel=2
+pkgrel=0
 pkgdesc="Python bindings for DBUS"
 url="http://www.freedesktop.org/wiki/Software/DBusBindings"
 arch="all"
 license="GPL LGPL"
-depends="python2"
-depends_dev="py-dbus"
-makedepends="dbus-glib-dev python2-dev"
-subpackages="$pkgname-dev $pkgname-doc"
+depends=""
+#depends_dev="py-dbus"
+makedepends="dbus-glib-dev python2-dev python3-dev"
+subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3 $pkgname-doc $pkgname-dev"
 source="http://dbus.freedesktop.org/releases/dbus-python/dbus-python-$pkgver.tar.gz"
 
 _builddir="$srcdir"/dbus-python-$pkgver
 
 prepare() {
-	cd "$_builddir"
-	update_config_sub || return 1
+	local python; for python in python2 python3; do
+		cp -r "$_builddir" "$_builddir-$python"
+		cd "$_builddir-$python"
+		update_config_sub
+	done
 }
-build() {
-	cd "$_builddir"
-	./configure \
+
+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"
+	PYTHON=$python ./configure \
 		--build=$CBUILD \
 		--host=$CHOST \
-		--prefix=/usr \
-		|| return 1
-	make || return 1
-	make test || return 1
+		--prefix=/usr
+	make
+	make test
+	make DESTDIR="$subpkgdir" install
+	rm -rf "$pkgdir"/docpkg "$pkgdir"/devpkg
+	mkdir -p "$pkgdir"/docpkg "$pkgdir"/devpkg
+	mv "$subpkgdir"/usr/share/doc "$pkgdir"/docpkg
+	mv "$subpkgdir"/usr/lib/pkgconfig "$pkgdir"/devpkg
+	mv "$subpkgdir"/usr/include "$pkgdir"/devpkg
+	rmdir "$subpkgdir"/usr/share
 }
 
-package() {
-	cd "$_builddir"
-	make DESTDIR="$pkgdir" install || return 1
+doc() {
+	mkdir -p "$subpkgdir"/usr/share/
+	mv "$pkgdir"/docpkg/doc "$subpkgdir"/usr/share/doc
+}
+
+dev() {
+	mkdir -p "$subpkgdir"/usr/lib
+	mv "$pkgdir"/devpkg/pkgconfig "$subpkgdir"/usr/lib/
+	mv "$pkgdir"/devpkg/include "$subpkgdir"/usr/
 }
 
 md5sums="b09cd2d1a057cc432ce944de3fc06bf7  dbus-python-1.2.0.tar.gz"
-- 
2.14.1

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

---

From: Leonardo Arena <[email-masked]>
Date: Wed, 1 Nov 2017 16:09:05 +0100

Hi,

> +++ b/main/py-dbus/APKBUILD
this should be bumped to "3".
>   _builddir="$srcdir"/dbus-python-$pkgver
Perhaps while there you can strip the "_" suffix. It's now an official 
APKBUILD variable.
> +	PYTHON=$python ./configure \
Now abuild requires "test" to be separated in the "check()" function.
> +	make test
Same here.
>   md5sums="b09cd2d1a057cc432ce944de3fc06bf7  dbus-python-1.2.0.tar.gz"
Thanks!

/eo

---