From 4249282052079ef391b6b4b2c874f04afd0d84c5 Mon Sep 17 00:00:00 2001 From: nocode Date: Fri, 3 Jul 2026 23:59:25 +0200 Subject: [PATCH] fix(python-meh): fix python 3.11 compatibility by replacing removed gettext.ldgettext Replace gettext.ldgettext with gettext.dgettext in Anaconda exception handler since ldgettext was removed in Python 3.11. Without this fix, the exception handler crashes with AttributeError when trying to display errors, resulting in raw tracebacks instead of the meh dialog in both GUI and TUI modes. Also clean up stale __pycache__ directories from previous extractions and add validation to ensure ldgettext is completely removed. --- pkgbuilds/python-meh/PKGBUILD | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pkgbuilds/python-meh/PKGBUILD b/pkgbuilds/python-meh/PKGBUILD index 7d565ed..311d121 100644 --- a/pkgbuilds/python-meh/PKGBUILD +++ b/pkgbuilds/python-meh/PKGBUILD @@ -5,7 +5,7 @@ # l'arborescence à la main plutôt que de patcher la chaîne distutils. pkgname=python-meh pkgver=0.43 -pkgrel=1 +pkgrel=2 pkgdesc="Python exception handling library (dépendance Anaconda)" arch=('any') url="https://github.com/rhinstaller/python-meh" @@ -16,6 +16,24 @@ source=("$pkgname-$pkgver.tar.gz::https://github.com/rhinstaller/python-meh/arch sha256sums=('cd50301794ab68a064715f1ace960f6de07aea809aa85f73087d44573c98be52') _srcdir="python-meh-$_tag" +prepare() { + cd "$srcdir/$_srcdir" + # gettext.ldgettext a été SUPPRIMÉ en Python 3.11 : sans ce remplacement, le + # gestionnaire d'exceptions d'Anaconda plante LUI-MÊME (AttributeError) dès + # qu'il doit AFFICHER une erreur → traceback brut au lieu du dialogue meh, + # en GUI comme en TUI. dgettext est l'équivalent direct (ldgettext n'était + # que la variante bytes). Corrigé en amont après 0.43. + sed -i 's/gettext\.ldgettext(/gettext.dgettext(/' \ + meh/handler.py meh/ui/text.py meh/ui/gui.py + # .pyc d'une extraction précédente (src/ n'est pas nettoyé par makepkg -f) : + # à jeter, sinon ils partiraient dans le paquet via cp -a. + find meh -type d -name __pycache__ -exec rm -rf {} + + if grep -rn --include='*.py' 'ldgettext' meh/; then + echo "ERREUR : ldgettext encore présent après patch" >&2 + return 1 + fi +} + package() { cd "$srcdir/$_srcdir" local sitedir