-
Notifications
You must be signed in to change notification settings - Fork 93
Description
Description
The create_image.py
script currently fails to run on modern Linux distributions (e.g., Ubuntu 22.04+, Fedora 38+, openEuler) due to a ModuleNotFoundError
for the pango
module.
This issue arises because the script uses the legacy direct import method (import pango
), which relies on static PyGTK 2 bindings. Modern Linux systems use PyGObject with GObject Introspection, which requires importing Pango via the gi.repository
namespace.
Steps to Reproduce
-
Set up a clean, modern Linux environment, such as Ubuntu 22.04 or 24.04.
-
Install the necessary dependencies:
sudo apt update sudo apt install -y python3-cairo python3-gi python3-gi-cairo gir1.2-pango-1.0 python3-pip python3-venv #and then,you may create a virtual python env and activate it.
-
Clone the repository:
git clone [https://github.com/notofonts/nototools.git](https://github.com/notofonts/nototools.git) cd nototools #install the nototools. pip3 install -r requirements.txt pip3 install .
-
Attempt to run the script:
python3 nototools/create_image.py -h
Actual Behavior
The script fails with the following traceback:
(py_venv) root@MSI:~/nototools# create_image.py -h
/root/py_venv/bin/create_image.py:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
__import__('pkg_resources').require('notofonttools==0.2.20')
Traceback (most recent call last):
File "/root/py_venv/bin/create_image.py", line 7, in <module>
exec(compile(f.read(), __file__, 'exec'))
File "/root/nototools/nototools/create_image.py", line 33, in <module>
import pango
ModuleNotFoundError: No module named 'pango'
Expected Behavior
The script should run successfully and display its help message.
Suggested Solution
The import statements in create_image.py
should be updated to use the modern PyGObject API. This involves:
- Importing the
gi
module. - Calling
gi.require_version()
forPango
andPangoCairo
. - Importing
Pango
andPangoCairo
fromgi.repository
.
This change will make the script compatible with standard modern Linux environments. I will submit a Pull Request shortly to address this.