Subject: [alpine-aports] [PATCH] testing/py-serial: Update to 3.3, split package for Python3 & Python2

From: Marian Buschsieweke <[email-masked]>
Date: Tue, 4 Jul 2017 19:30:53 +0200

---
 testing/py-serial/APKBUILD | 52 ++++++++++++++++++++++++++++++++--------------
 1 file changed, 36 insertions(+), 16 deletions(-)

diff --git a/testing/py-serial/APKBUILD b/testing/py-serial/APKBUILD
index 92797cda6e..61b5df4c16 100644
--- a/testing/py-serial/APKBUILD
+++ b/testing/py-serial/APKBUILD
@@ -2,35 +2,54 @@
 # Maintainer: Fabian Affolter <[email-masked]>
 pkgname=py-serial
 _pkgname=pyserial
-pkgver=2.6
+pkgver=3.3
 pkgrel=0
 pkgdesc="Python Serial Port Extension"
 url="http://pyserial.sourceforge.net/"
 arch="noarch"
 license="Python"
 depends="python2"
-makedepends="python2-dev"
+makedepends="python2-dev python3-dev py-setuptools"
 install=""
-subpackages="$pkgname-doc $pkgname-examples"
+subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3 $pkgname-doc $pkgname-examples"
 source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
 
-_builddir="$srcdir"/$_pkgname-$pkgver
+builddir="$srcdir"/$_pkgname-$pkgver
+
 build() {
-	cd "$_builddir"
+	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
+	depends="py2-${pkgname#py-} py3-${pkgname#py-}"
+	mkdir -p "$pkgdir"
+}
+
+_py2() {
+	_py_common python2
+	rm "$subpkgdir/usr/bin/miniterm.py"
+}
+
+_py3() {
+	_py_common python3
+}
+
+_py_common() {
+	local python="$1"
+	depends="$python"
+	
+	cd "$builddir"
+	$python setup.py install --prefix=/usr --root="$subpkgdir"
 }
 
 doc() {
-	cd "$_builddir"
+	cd "$builddir"
 	mkdir -p "$subpkgdir"/usr/share/doc/$pkgname/ || return 1
 	# Documentation files
-	_docs="appendix.rst examples.rst pyparallel.rst pyserial.rst \
-		pyserial_api.rst shortintro.rst"
+	_docs="appendix.rst examples.rst index.rst pyserial.rst \
+		pyserial_api.rst shortintro.rst tools.rst url_handlers.rst"
 	for _doc in $_docs; do
 		mv "$srcdir"/$_pkgname-$pkgver/documentation/$_doc \
 			"$subpkgdir"/usr/share/doc/$pkgname/$_doc || return 1
@@ -38,17 +57,18 @@ doc() {
 }
 
 examples() {
-	cd "$_builddir"
+	cd "$builddir"
 	mkdir -p "$subpkgdir"/usr/share/doc/$pkgname/examples || return 1
 	# Example files
-	_examples="enhancedserial.py rfc2217_server.py scan.py \
-		scanlinux.py tcp_serial_redirect.py port_publisher.py port_publisher.sh"
+	_examples="port_publisher.sh rfc2217_server.py tcp_serial_redirect.py\
+	           wxSerialConfigDialog.py wxTerminal.py port_publisher.py\
+	           at_protocol.py setup-miniterm-py2exe.py\
+	           setup-rfc2217_server-py2exe.py setup-wxTerminal-py2exe.py\
+	           wxSerialConfigDialog.wxg wxTerminal.wxg"
 	for _example in $_examples; do
 		mv "$srcdir"/$_pkgname-$pkgver/examples/$_example \
 			"$subpkgdir"/usr/share/doc/$pkgname/examples/$_example || return 1
 	done
 }
 
-md5sums="cde799970b7c1ce1f7d6e9ceebe64c98  pyserial-2.6.tar.gz"
-sha256sums="049dbcda0cd475d3be903e721d60889ee2cc4ec3b62892a81ecef144196413ed  pyserial-2.6.tar.gz"
-sha512sums="41682f8fafb6c5fa9642d3a0a3d6d0648101c38d157005f9c4e019e55d534953486072caf05647d8828b0e19c8259cc61cac856a570bf09904922ffd175fad2d  pyserial-2.6.tar.gz"
+sha512sums="57a0bcd0684530e1d60022804dd75acd5d9a9a358c92d967076884b2419bcfefae71e949f7aba1737023f6b089c993e98dd7cf6860e9402ed7e0b698953b3ac8  pyserial-3.3.tar.gz"
-- 
2.13.2

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