aboutsummaryrefslogtreecommitdiffstats
path: root/testing/py-serial/APKBUILD
blob: aeaa939e3b7317039f4d9c2e96492425f5fd5d06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py-serial
_pkgname=pyserial
pkgver=3.3
pkgrel=0
pkgdesc="Python Serial Port Extension"
url="http://pyserial.sourceforge.net/"
arch="noarch"
license="Python"
depends="python2"
makedepends="python2-dev python3-dev py-setuptools"
install=""
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

build() {
	cd "$builddir"
	python2 setup.py build || return 1
	python3 setup.py build || return 1
}

package() {
	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"
	mkdir -p "$subpkgdir"/usr/share/doc/$pkgname/ || return 1
	# Documentation files
	_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
	done
}

examples() {
	cd "$builddir"
	mkdir -p "$subpkgdir"/usr/share/doc/$pkgname/examples || return 1
	# Example files
	_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
}

sha512sums="57a0bcd0684530e1d60022804dd75acd5d9a9a358c92d967076884b2419bcfefae71e949f7aba1737023f6b089c993e98dd7cf6860e9402ed7e0b698953b3ac8  pyserial-3.3.tar.gz"