Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 905906 - app-i18n/ibus-pinyin: Unable to open preference settings in ibus-setup
Summary: app-i18n/ibus-pinyin: Unable to open preference settings in ibus-setup
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Yixun Lan
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-08 00:57 UTC by znjameswu
Modified: 2023-05-12 00:11 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description znjameswu 2023-05-08 00:57:20 UTC
The upstream package uses `gettext.bind_textdomain_codeset` which is removed in Python 3.11

When trying to open the preference for `Chinese-Pinyin` in `ibus-setup`, an error is thrown:
```
Traceback (most recent call last):
  File "/usr/share/ibus-pinyin/setup/main.py", line 432, in <module>
    main()
  File "/usr/share/ibus-pinyin/setup/main.py", line 428, in main
    PreferencesDialog(name).run()
    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/ibus-pinyin/setup/main.py", line 48, in __init__
    gettext.bind_textdomain_codeset("ibus-pinyin", "UTF-8")
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'gettext' has no attribute 'bind_textdomain_codeset'

```

The relevant APIs were already removed in Python 3.10:
https://bugs.python.org/issue40936
https://docs.python.org/3.10/library/gettext.html#gettext.bind_textdomain_codeset

This is a UX issue but does prevent basic functionalities. 

Reproducible: Always
Comment 1 znjameswu 2023-05-08 01:22:14 UTC
By removing this single line seems to fix the issue. The preference can now function properly
```
File "/usr/share/ibus-pinyin/setup/main.py", line 48, in __init__
    gettext.bind_textdomain_codeset("ibus-pinyin", "UTF-8")
```

No further usages of removed API were found.

An upstream PR has been open to attempt to fix this problem: https://github.com/ibus/ibus-pinyin/pull/13
Comment 2 znjameswu 2023-05-08 01:24:31 UTC
> This is a UX issue but does prevent basic functionalities. 

Correction: does not prevent basic functionalities.
Comment 3 Larry the Git Cow gentoo-dev 2023-05-12 00:11:58 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c2ec315acbc673833f5e076c9e8f3b52b2826537

commit c2ec315acbc673833f5e076c9e8f3b52b2826537
Author:     Yixun Lan <dlan@gentoo.org>
AuthorDate: 2023-05-12 00:07:38 +0000
Commit:     Yixun Lan <dlan@gentoo.org>
CommitDate: 2023-05-12 00:11:06 +0000

    app-i18n/ibus-pinyin: fix preference issue in ibus-setup
    
    Closes: https://bugs.gentoo.org/905906
    Signed-off-by: Yixun Lan <dlan@gentoo.org>

 .../files/ibus-pinyin-1.5.0-gettext.patch          | 16 ++++++
 app-i18n/ibus-pinyin/ibus-pinyin-1.5.0-r6.ebuild   | 64 ++++++++++++++++++++++
 2 files changed, 80 insertions(+)