commit:     0079957a51e55a4ff5f630e9df0993a84a3b7509
Author:     Alfred Wingate <parona <AT> protonmail <DOT> com>
AuthorDate: Fri Apr 25 14:45:38 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Apr 26 21:34:42 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0079957a

app-misc/lirc: enable py3.13 + fix python

Python bindings are broken without the config.py patch.

Bug: https://bugs.gentoo.org/830522
Bug: https://bugs.gentoo.org/922209
Bug: https://bugs.gentoo.org/952222
Signed-off-by: Alfred Wingate <parona <AT> protonmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/41748
Closes: https://github.com/gentoo/gentoo/pull/41748
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../lirc/files/lirc-0.10.2-fix-python-pkg.patch    |  26 +++
 app-misc/lirc/lirc-0.10.2-r1.ebuild                | 185 +++++++++++++++++++++
 2 files changed, 211 insertions(+)

diff --git a/app-misc/lirc/files/lirc-0.10.2-fix-python-pkg.patch 
b/app-misc/lirc/files/lirc-0.10.2-fix-python-pkg.patch
new file mode 100644
index 000000000000..4d14dd5cb7bf
--- /dev/null
+++ b/app-misc/lirc/files/lirc-0.10.2-fix-python-pkg.patch
@@ -0,0 +1,26 @@
+https://sourceforge.net/p/lirc/git/ci/3e2e9758aac0d51bc4168d863763c8e3a4c537f5/
+
+From 3e2e9758aac0d51bc4168d863763c8e3a4c537f5 Mon Sep 17 00:00:00 2001
+From: Sean Young <[email protected]>
+Date: Sun, 12 Mar 2023 11:24:47 +0000
+Subject: [PATCH 1/1] config.py is needed by the python package
+
+Partial revert of commit 0ab24de56c8a282ffd356e929e71b48a69685dda
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -84,11 +84,10 @@ dist_py_pkg_DATA        = python-pkg/setup.py \
+ 
+ py_pkg_lircdir          = $(pkgdatadir)/python-pkg/lirc
+ py_PYTHON               = python-pkg/lirc/__init__.py \
++                          python-pkg/lirc/config.py \
+                           python-pkg/lirc/database.py \
+                           python-pkg/lirc/paths.py
+ 
+-nodist_py_pkg_PYTHON    = python-pkg/lirc/config.py
+-
+ if HAVE_PYTHON35
+ py_PYTHON               += python-pkg/lirc/async_client.py \
+                           python-pkg/lirc/client.py
+-- 
+2.49.0
+

diff --git a/app-misc/lirc/lirc-0.10.2-r1.ebuild 
b/app-misc/lirc/lirc-0.10.2-r1.ebuild
new file mode 100644
index 000000000000..3ab3e910806a
--- /dev/null
+++ b/app-misc/lirc/lirc-0.10.2-r1.ebuild
@@ -0,0 +1,185 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..13} )
+
+inherit autotools linux-info python-single-r1 xdg-utils
+
+DESCRIPTION="decode and send infra-red signals of many commonly used remote 
controls"
+HOMEPAGE="https://www.lirc.org/";
+
+LIRC_DRIVER_DEVICE="/dev/lirc0"
+
+MY_P=${PN}-${PV/_/-}
+S="${WORKDIR}/${MY_P}"
+
+if [[ ${PV} == *_pre* ]] ; then
+       SRC_URI="https://www.lirc.org/software/snapshots/${MY_P}.tar.bz2";
+elif [[ ${PV} == *_p* ]] ; then
+       inherit autotools
+       SRC_URI="https://downloads.sourceforge.net/lirc/${PN}-$(ver_cut 
1-3).tar.bz2"
+       SRC_URI+=" mirror://debian/pool/main/l/${PN}/${PN}_$(ver_cut 
1-3)-$(ver_cut 5-).debian.tar.xz"
+       S="${WORKDIR}"/${PN}-$(ver_cut 1-3)
+else
+       SRC_URI="https://downloads.sourceforge.net/lirc/${MY_P}.tar.bz2";
+fi
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86"
+IUSE="audio +devinput doc ftdi gtk inputlirc selinux static-libs systemd 
+uinput usb X"
+
+REQUIRED_USE="
+       ${PYTHON_REQUIRED_USE}
+       gtk? ( X )
+"
+
+COMMON_DEPEND="
+       ${PYTHON_DEPS}
+       audio? (
+               >media-libs/portaudio-18
+               media-libs/alsa-lib
+       )
+       $(python_gen_cond_dep '
+               dev-python/pyyaml[${PYTHON_USEDEP}]
+       ')
+       ftdi? ( dev-embedded/libftdi:0 )
+       systemd? ( sys-apps/systemd )
+       usb? ( virtual/libusb:0 )
+       X? (
+               x11-libs/libICE
+               x11-libs/libSM
+               x11-libs/libX11
+       )
+"
+
+DEPEND="
+       ${COMMON_DEPEND}
+       dev-libs/libxslt
+       $(python_gen_cond_dep '
+               dev-python/setuptools[${PYTHON_USEDEP}]
+       ')
+       doc? ( app-text/doxygen )
+       sys-apps/kmod
+       sys-kernel/linux-headers
+"
+
+RDEPEND="
+       ${COMMON_DEPEND}
+       gtk? (
+               x11-libs/vte[introspection]
+               $(python_gen_cond_dep '
+                       dev-python/pygobject[${PYTHON_USEDEP}]
+               ')
+       )
+       inputlirc? ( app-misc/inputlircd )
+       selinux? ( sec-policy/selinux-lircd )
+"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-0.10.1-runtimedirectory.patch"
+       "${FILESDIR}/${PN}-0.10.2-fix-python-pkg.patch"
+)
+
+MAKEOPTS+=" -j1"
+
+pkg_setup() {
+       use uinput && CONFIG_CHECK="~INPUT_UINPUT"
+       python-single-r1_pkg_setup
+       linux-info_pkg_setup
+}
+
+src_prepare() {
+       default
+
+       # https://bugs.gentoo.org/922209
+       sed -i -e "/^libpython / 
s|\$(libdir)/python\$(PYTHON_VERSION)|$(python_get_stdlib)|" Makefile.am || die
+       sed -i -e "/^libpython / 
s|\$(libdir)/python\$(PYTHON_VERSION)|$(python_get_stdlib)|" tools/Makefile.am 
|| die
+
+       eautoreconf
+}
+
+src_configure() {
+       xdg_environment_reset
+       econf \
+               --localstatedir="${EPREFIX}/var" \
+               $(use_enable static-libs static) \
+               $(use_enable devinput) \
+               $(use_enable uinput) \
+               $(use_with X x)
+}
+
+src_install() {
+       default
+
+       if use !gtk ; then
+               # lirc-setup requires gtk
+               rm "${ED}"/usr/bin/lirc-setup || die
+       fi
+
+       newinitd "${FILESDIR}"/lircd-0.8.6-r2 lircd
+       newinitd "${FILESDIR}"/lircmd-0.9.4a-r2 lircmd
+       newconfd "${FILESDIR}"/lircd.conf.4 lircd
+       newconfd "${FILESDIR}"/lircmd-0.10.0.conf lircmd
+
+       insinto /etc/modprobe.d/
+       newins "${FILESDIR}"/modprobed.lirc lirc.conf
+
+       newinitd "${FILESDIR}"/irexec-initd-0.9.4a-r2 irexec
+       newconfd "${FILESDIR}"/irexec-confd irexec
+
+       keepdir /etc/lirc
+       if [[ -e "${ED}"/etc/lirc/lircd.conf ]]; then
+               newdoc "${ED}"/etc/lirc/lircd.conf lircd.conf.example
+       fi
+
+       find "${ED}" -name '*.la' -delete || die
+
+       # https://bugs.gentoo.org/830522
+       python_optimize
+
+       # Avoid QA notice
+       rm -d "${ED}"/var/run/lirc || die
+       rm -d "${ED}"/var/run || die
+}
+
+pkg_preinst() {
+       local dir="${EROOT}/etc/modprobe.d"
+       if [[ -a "${dir}"/lirc && ! -a "${dir}"/lirc.conf ]]; then
+               elog "Renaming ${dir}/lirc to lirc.conf"
+               mv -f "${dir}/lirc" "${dir}/lirc.conf" || die
+       fi
+
+       # copy the first file that can be found
+       if [[ -f "${EROOT}"/etc/lirc/lircd.conf ]]; then
+               cp "${EROOT}"/etc/lirc/lircd.conf "${T}"/lircd.conf || die
+       elif [[ -f "${EROOT}"/etc/lircd.conf ]]; then
+               cp "${EROOT}"/etc/lircd.conf "${T}"/lircd.conf || die
+               MOVE_OLD_LIRCD_CONF=1
+       elif [[ -f "${ED}"/etc/lirc/lircd.conf ]]; then
+               cp "${ED}"/etc/lirc/lircd.conf "${T}"/lircd.conf || die
+       fi
+
+       # stop portage from touching the config file
+       if [[ -e "${ED}"/etc/lirc/lircd.conf ]]; then
+               rm -f "${ED}"/etc/lirc/lircd.conf || die
+       fi
+}
+
+pkg_postinst() {
+       # copy config file to new location
+       # without portage knowing about it
+       # so it will not delete it on unmerge or ever touch it again
+       if [[ -e "${T}"/lircd.conf ]]; then
+               cp "${T}"/lircd.conf "${EROOT}"/etc/lirc/lircd.conf || die
+               if [[ "$MOVE_OLD_LIRCD_CONF" = "1" ]]; then
+                       elog "Moved /etc/lircd.conf to /etc/lirc/lircd.conf"
+                       rm -f "${EROOT}"/etc/lircd.conf || die
+               fi
+       fi
+
+       einfo "The new default location for lircd.conf is inside of"
+       einfo "${EROOT}/etc/lirc/ directory"
+}

Reply via email to