8000 FIX: skip gtk backend if gobject but not pygtk is installed by tacaswell · Pull Request #12929 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

FIX: skip gtk backend if gobject but not pygtk is installed #12929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/matplotlib/backends/_gtk3_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@

if gi.__name__ == "pgi" and gi.version_info < (0, 0, 11, 2):
raise ImportError("The GTK3 backends are incompatible with pgi<0.0.11.2")
gi.require_version("Gtk", "3.0")
try:
# :raises ValueError: If module/version is already loaded, already
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not shure what the leading colon is for, but heh.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copy-pasted their docstring (which uses the google style docstrings)

# required, or unavailable.
gi.require_version("Gtk", "3.0")
except ValueError as e:
# in this case we want to re-raise as ImportError so the
# auto-backend selection logic correctly skips.
raise ImportError from e

globals().update(
{name:
importlib.import_module("{}.repository.{}".format(gi.__name__, name))
Expand Down
0