fix(script): Modernize Pango imports in create_image.py for Linux compatibility#913
Open
yyjeqhc wants to merge 1 commit into
Open
fix(script): Modernize Pango imports in create_image.py for Linux compatibility#913yyjeqhc wants to merge 1 commit into
yyjeqhc wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
The create_image.py script uses a legacy `import pango` statement, which fails on modern Linux distributions that rely on PyGObject for bindings. This makes the tool unusable on standard setups like Ubuntu 22.04+ or Fedora without manual changes. This commit refactors the Pango and PangoCairo imports to use the modern GObject Introspection (`gi`) mechanism. It replaces the direct imports with the standard `from gi.repository import ...` pattern, preceded by the necessary `gi.require_version()` calls. This change resolves the `ModuleNotFoundError` and makes the script compatible with current Linux environments, improving its portability.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #912
Description of Changes
This pull request resolves the
ModuleNotFoundErrorthat occurs when runningcreate_image.pyon modern Linux distributions.The root cause is the script's use of legacy
import pangostatements, which are incompatible with modern systems that provide Python bindings for GTK libraries via PyGObject.This PR modernizes the script's imports by:
import pangoandimport pangocairowith the GObject Introspection (gi) mechanism.gi.require_version()calls forPangoandPangoCairoto ensure API stability.gi.repository.How to Test
These changes have been tested on a clean Ubuntu 24.04 environment.
This modification significantly improves the script's portability and usability on current Linux systems without altering its core functionality.