Mail archive
alpine-aports

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

From: Luca Weiss <luca_at_z3ntu.xyz>
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
_at_@ -1,37 +1,70 @@
 # Maintainer: Natanael Copa <ncopa_at_alpinelinux.org>
 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:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Sat Sep 23 2017 - 21:15:05 GMT