diff --git a/dev-python/pyserial/patches/665.patch b/dev-python/pyserial/patches/665.patch new file mode 100644 index 000000000..a72815884 --- /dev/null +++ b/dev-python/pyserial/patches/665.patch @@ -0,0 +1,29 @@ +From 95e393b4877327ff20b0a0e7411ea37f181ab6e9 Mon Sep 17 00:00:00 2001 +From: OscarL +Date: Thu, 25 Aug 2022 11:32:14 +0000 +Subject: [PATCH] Add detection for Haiku's serial ports + +Now that PySerial works OK (without patches. relying on serialposix.py) on the nightly versions of Haiku (see https://haiku-os.org), make sure its ports gets detected properly. +--- + serial/tools/list_ports_posix.py | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/serial/tools/list_ports_posix.py b/serial/tools/list_ports_posix.py +index b1157546..888f89f9 100644 +--- a/serial/tools/list_ports_posix.py ++++ b/serial/tools/list_ports_posix.py +@@ -96,6 +96,14 @@ def comports(include_links=False): + devices.update(list_ports_common.list_links(devices)) + return [list_ports_common.ListPortInfo(d) for d in devices] + ++elif plat[:5] == 'haiku': # Haiku ++ def comports(include_links=False): ++ """scan for available ports. return a list of device names.""" ++ devices = set(glob.glob('/dev/ports/*')) ++ if include_links: ++ devices.update(list_ports_common.list_links(devices)) ++ return [list_ports_common.ListPortInfo(d) for d in devices] ++ + else: + # platform detection has failed... + import serial diff --git a/dev-python/pyserial/pyserial-3.2.1.recipe b/dev-python/pyserial/pyserial-3.2.1.recipe deleted file mode 100644 index e661ae74e..000000000 --- a/dev-python/pyserial/pyserial-3.2.1.recipe +++ /dev/null @@ -1,36 +0,0 @@ -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-2017 Chris Liechti" -LICENSE="BSD (3-clause)" -REVISION="1" -SOURCE_URI="https://github.com/pyserial/pyserial/archive/v$portVersion.tar.gz" -CHECKSUM_SHA256="cd7232b1f1667ebaf260bba0e086c0370bc12d0322dc20caca9b764deca497e7" - -ARCHITECTURES="?any" - -PROVIDES=" - $portName = $portVersion - cmd:miniterm.py - " -REQUIRES=" - haiku - cmd:python3.7 - " - -BUILD_REQUIRES=" - haiku_devel - setuptools_python3 - " -BUILD_PREREQUIRES=" - cmd:python3.7 - " - -INSTALL() -{ - python3.7 setup.py build install \ - --root=/ --prefix=$prefix -} diff --git a/dev-python/pyserial/pyserial-3.5~20211205.recipe b/dev-python/pyserial/pyserial-3.5~20211205.recipe new file mode 100644 index 000000000..d29639d8b --- /dev/null +++ b/dev-python/pyserial/pyserial-3.5~20211205.recipe @@ -0,0 +1,68 @@ +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="1" +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_PACKAGES=(python3 python38 python39 python310) +PYTHON_VERSIONS=(3.7 3.8 3.9 3.10) +for i in "${!PYTHON_PACKAGES[@]}"; do +pythonPackage=${PYTHON_PACKAGES[i]} +pythonVersion=${PYTHON_VERSIONS[$i]} +eval "PROVIDES_${pythonPackage}=\"\ + ${portName}_$pythonPackage = $portVersion\n\ + cmd:pyserial_miniterm\n\ + cmd:pyserial_ports\n\ + \"; \ +REQUIRES_$pythonPackage=\"\ + haiku\n\ + cmd:python$pythonVersion\ + \"" +BUILD_REQUIRES="$BUILD_REQUIRES + setuptools_$pythonPackage" +BUILD_PREREQUIRES="$BUILD_PREREQUIRES + cmd:python$pythonVersion" +done + +INSTALL() +{ + for i in "${!PYTHON_PACKAGES[@]}"; do + pythonPackage=${PYTHON_PACKAGES[i]} + pythonVersion=${PYTHON_VERSIONS[$i]} + + 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 + + packageEntries $pythonPackage \ + $prefix/lib/python* \ + $prefix/bin + done +}