Files
haikuports/dev-python/pyserial/pyserial-3.5~20211205.recipe
Oscar Lesta 0f469405c2 pyserial: cleanups, drop Python 3.9 support.
Also: properly version-suffix commands.
2025-07-24 01:02:28 -03:00

94 lines
2.3 KiB
Bash

SUMMARY="Python serial port access library"
DESCRIPTION="This module encapsulates the access for the serial port.
It provides backends for Python running on Windows, OSX, Linux, BSD (possibly \
any POSIX compliant system) and IronPython.
The module named "serial" automatically selects the appropriate backend."
HOMEPAGE="https://github.com/pyserial/pyserial"
COPYRIGHT="2001-2020 Chris Liechti"
LICENSE="BSD (3-clause)"
REVISION="4"
srcGitRev="31fa4807d73ed4eb9891a88a15817b439c4eea2d"
SOURCE_URI="https://github.com/pyserial/pyserial/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="d77a5431db2d1d8e1c7d99bc2d736981c7ae9f73d0ffff9861be94589b1c14b3"
SOURCE_FILENAME="pyserial-$portVersion-$srcGitRev.tar.gz"
SOURCE_DIR="pyserial-$srcGitRev"
PATCHES="665.patch"
ARCHITECTURES="any"
PROVIDES="
$portName = $portVersion
"
REQUIRES="
haiku
"
BUILD_REQUIRES="
haiku_devel
"
PYTHON_VERSIONS=(3.10)
defaultVersion=3.10
for pythonVersion in ${PYTHON_VERSIONS[@]}; do
pythonPackage=python${pythonVersion//.}
eval "PROVIDES_$pythonPackage=\"
${portName}_$pythonPackage = $portVersion
cmd:pyserial_miniterm_$pythonVersion = $portVersion
cmd:pyserial_ports_$pythonVersion = $portVersion
\""
# Provide non-suffixed cmd only for the default Python version
if [ $pythonVersion = $defaultVersion ]; then
eval "PROVIDES_$pythonPackage+=\"
cmd:pyserial_miniterm = $portVersion
cmd:pyserial_ports = $portVersion
\""
fi
eval "REQUIRES_$pythonPackage=\"
haiku
cmd:python$pythonVersion
\""
BUILD_REQUIRES+="
setuptools_$pythonPackage
"
BUILD_PREREQUIRES+="
cmd:python$pythonVersion
"
done
INSTALL()
{
for pythonVersion in ${PYTHON_VERSIONS[@]}; do
pythonPackage=python${pythonVersion//.}
python=python$pythonVersion
installLocation=$prefix/lib/$python/vendor-packages/
export PYTHONPATH=$installLocation:$PYTHONPATH
mkdir -p $installLocation
rm -rf build
$python setup.py build install \
--root=/ --prefix=$prefix
# Version suffix all the scripts
for f in $binDir/*; do
mv $f $f-$pythonVersion
done
# And provide suffix-less symlinks for the default version
if [ $pythonVersion = $defaultVersion ]; then
for f in $binDir/*; do
ln -sr $f ${f%-$pythonVersion}
done
fi
packageEntries $pythonPackage \
$prefix/lib/python* \
$prefix/bin
done
}