1SUMMARY="Python serial port access library"
2DESCRIPTION="This module encapsulates the access for the serial port.
3It provides backends for Python running on Windows, OSX, Linux, BSD (possibly \
4any POSIX compliant system) and IronPython.
5The module named "serial" automatically selects the appropriate backend."
6HOMEPAGE="https://github.com/pyserial/pyserial"
7COPYRIGHT="2001-2020 Chris Liechti"
8LICENSE="BSD (3-clause)"
9REVISION="3"
10srcGitRev="31fa4807d73ed4eb9891a88a15817b439c4eea2d"
11SOURCE_URI="https://github.com/pyserial/pyserial/archive/$srcGitRev.tar.gz"
12CHECKSUM_SHA256="d77a5431db2d1d8e1c7d99bc2d736981c7ae9f73d0ffff9861be94589b1c14b3"
13SOURCE_FILENAME="pyserial-$portVersion-$srcGitRev.tar.gz"
14SOURCE_DIR="pyserial-$srcGitRev"
15PATCHES="665.patch"
16
17ARCHITECTURES="any"
18
19PROVIDES="
20	$portName = $portVersion
21	"
22REQUIRES="
23	haiku
24	"
25
26BUILD_REQUIRES="
27	haiku_devel
28	"
29
30PYTHON_PACKAGES=(python39 python310)
31PYTHON_VERSIONS=(3.9 3.10)
32for i in "${!PYTHON_PACKAGES[@]}"; do
33pythonPackage=${PYTHON_PACKAGES[i]}
34pythonVersion=${PYTHON_VERSIONS[$i]}
35eval "PROVIDES_${pythonPackage}=\"\
36	${portName}_$pythonPackage = $portVersion\n\
37	cmd:pyserial_miniterm\n\
38	cmd:pyserial_ports\n\
39	\"; \
40REQUIRES_$pythonPackage=\"\
41	haiku\n\
42	cmd:python$pythonVersion\
43	\""
44BUILD_REQUIRES="$BUILD_REQUIRES
45	setuptools_$pythonPackage"
46BUILD_PREREQUIRES="$BUILD_PREREQUIRES
47	cmd:python$pythonVersion"
48done
49
50INSTALL()
51{
52	for i in "${!PYTHON_PACKAGES[@]}"; do
53		pythonPackage=${PYTHON_PACKAGES[i]}
54		pythonVersion=${PYTHON_VERSIONS[$i]}
55
56		python=python$pythonVersion
57		installLocation=$prefix/lib/$python/vendor-packages/
58		export PYTHONPATH=$installLocation:$PYTHONPATH
59		mkdir -p $installLocation
60		rm -rf build
61		$python setup.py build install \
62			--root=/ --prefix=$prefix
63
64		packageEntries  $pythonPackage \
65			$prefix/lib/python* \
66			$prefix/bin
67	done
68}
69