base: if gi.repository fails to import, warn

We need python 3.6 but old Ubuntus only have 3.5. 3.6 can be installed (and
thus we get past the 3.6 sys.version check), but the gi.repository backports
are in various states of disarray (see #103 and #104).

And Python (and in particular gi) makes it hard for users to distinguish
between "the dependencies are a mess" and "this is a bug in tuhi".

So let's catch any error during gi.repository import and print a warning to
the user, in the hope of getting less bugs caused by Ubuntu frankenpythons.
Still won't fix issues like #104, but I'm not sure how to test for those
errors.

Related to #103
This commit is contained in:
Peter Hutterer 2018-03-06 10:37:43 +10:00 committed by Benjamin Tissoires
parent 0ee18353ef
commit 7e751d45c8
1 changed files with 10 additions and 1 deletions

View File

@ -16,7 +16,16 @@ import enum
import logging
import sys
import time
from gi.repository import GObject, GLib
try:
from gi.repository import GObject, GLib
except Exception as e:
print(f'************ Importing gi.repository failed **********')
print(f'* This is an issue with the gi module, not with tuhi *')
print(f'******************************************************')
print(f'The full exception is below:')
print(f'')
raise e
from tuhi.dbusserver import TuhiDBusServer
from tuhi.ble import BlueZDeviceManager