pylint: Another fix for gtk3 version detection

We need to place require_version calls earlier and before
any code that might import Gtk/Gdk

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2021-05-22 13:26:32 -04:00
parent 99a2818d0e
commit a8e978dd38
2 changed files with 7 additions and 1 deletions

View File

@ -1,2 +1,7 @@
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
import gi
gi.require_version("Gdk", "3.0")
gi.require_version("Gtk", "3.0")

View File

@ -13,6 +13,8 @@ import sys
import traceback
import gi
gi.require_version("Gdk", "3.0")
gi.require_version("Gtk", "3.0")
gi.require_version('LibvirtGLib', '1.0')
from gi.repository import LibvirtGLib
@ -59,7 +61,6 @@ def _import_gtk(leftovers):
origargv = sys.argv
try:
sys.argv = origargv[:1] + leftovers[:]
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
leftovers = sys.argv[1:]