commit: 446498c7ccd725a86e3b53d85df8eda74040c6c9 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Wed Dec 24 16:30:50 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Wed Dec 24 16:30:50 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=446498c7
dev-python/pyserial: fix glibc-2.42 compat Signed-off-by: Sam James <sam <AT> gentoo.org> .../pyserial/files/pyserial-3.5-glibc-2.42.patch | 39 ++++++++++++++++++++ dev-python/pyserial/pyserial-3.5-r3.ebuild | 42 ++++++++++++++++++++++ 2 files changed, 81 insertions(+) diff --git a/dev-python/pyserial/files/pyserial-3.5-glibc-2.42.patch b/dev-python/pyserial/files/pyserial-3.5-glibc-2.42.patch new file mode 100644 index 000000000000..3a4e95a85449 --- /dev/null +++ b/dev-python/pyserial/files/pyserial-3.5-glibc-2.42.patch @@ -0,0 +1,39 @@ +https://github.com/pyserial/pyserial/issues/805 +https://github.com/pyserial/pyserial/pull/808 + +From 152f2639c630141b9d23f023178b619751e624a0 Mon Sep 17 00:00:00 2001 +From: Alexander von Gluck IV <[email protected]> +Date: Sun, 24 Aug 2025 20:17:51 -0500 +Subject: [PATCH] serial_posix: Fix custom baud rates for glibc >=2.42; solves + #805 + +* https://sourceware.org/pipermail/libc-alpha/2025-July/168553.html +* Based on changes recommended by JoaoBarioni in #805 +* Reverts 0085e1e1d (#519) +--- + serial/serialposix.py | 11 ++--------- + 1 file changed, 2 insertions(+), 9 deletions(-) + +diff --git a/serial/serialposix.py b/serial/serialposix.py +index 0464075b..6f843918 100644 +--- a/serial/serialposix.py ++++ b/serial/serialposix.py +@@ -430,15 +430,8 @@ def _reconfigure_port(self, force_update=False): + ispeed = ospeed = self.BAUDRATE_CONSTANTS[self._baudrate] + except KeyError: + #~ raise ValueError('Invalid baud rate: %r' % self._baudrate) +- +- # See if BOTHER is defined for this platform; if it is, use +- # this for a speed not defined in the baudrate constants list. +- try: +- ispeed = ospeed = BOTHER +- except NameError: +- # may need custom baud rate, it isn't in our list. +- ispeed = ospeed = getattr(termios, 'B38400') +- ++ # Use safe placeholder for tcsetattr(), try to set special baudrate later ++ ispeed = ospeed = termios.B38400 + try: + custom_baud = int(self._baudrate) # store for later + except ValueError: + diff --git a/dev-python/pyserial/pyserial-3.5-r3.ebuild b/dev-python/pyserial/pyserial-3.5-r3.ebuild new file mode 100644 index 000000000000..3e41295370c5 --- /dev/null +++ b/dev-python/pyserial/pyserial-3.5-r3.ebuild @@ -0,0 +1,42 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{11..14} pypy3_11 ) + +inherit distutils-r1 pypi + +DESCRIPTION="Python Serial Port extension" +HOMEPAGE=" + https://github.com/pyserial/pyserial/ + https://pypi.org/project/pyserial/ +" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos" +IUSE="examples" + +DOCS=( CHANGES.rst README.rst ) + +PATCHES=( + "${FILESDIR}/${P}-unittest-fix.patch" + "${FILESDIR}/${P}-glibc-2.42.patch" +) + +distutils_enable_sphinx documentation --no-autodoc + +python_test() { + "${EPYTHON}" test/run_all_tests.py loop:// -v || + die "Testing failed with ${EPYTHON}" +} + +python_install_all() { + distutils-r1_python_install_all + if use examples; then + dodoc -r examples + docompress -x /usr/share/doc/${PF}/examples + fi +}
