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.
This commit is contained in:
2026-07-03 23:59:25 +02:00
parent 5e66f99816
commit 4249282052
+19 -1
View File
@@ -5,7 +5,7 @@
# l'arborescence à la main plutôt que de patcher la chaîne distutils. # l'arborescence à la main plutôt que de patcher la chaîne distutils.
pkgname=python-meh pkgname=python-meh
pkgver=0.43 pkgver=0.43
pkgrel=1 pkgrel=2
pkgdesc="Python exception handling library (dépendance Anaconda)" pkgdesc="Python exception handling library (dépendance Anaconda)"
arch=('any') arch=('any')
url="https://github.com/rhinstaller/python-meh" 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') sha256sums=('cd50301794ab68a064715f1ace960f6de07aea809aa85f73087d44573c98be52')
_srcdir="python-meh-$_tag" _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() { package() {
cd "$srcdir/$_srcdir" cd "$srcdir/$_srcdir"
local sitedir local sitedir