Repository URL to install this package:
Version:
19.0.2-1 ▾
|
# (c) Copyright 2014. CodeWeavers, Inc.
import checkgtk
import cxutils
import cxdiag
import mountpoints
import cxfixes
def check_all_bases():
gtk_status = checkgtk.ensure_present_gtk()
cxfixes.clear_errors()
if gtk_status in (checkgtk.MISSING_PYGI, checkgtk.MISSING_GIR, checkgtk.BROKEN):
if gtk_status != checkgtk.MISSING_GIR:
cxfixes.add_error('pygi')
cxfixes.add_error('gir-data')
diag = cxdiag.get(None)
for errid, (level, title, _description) in cxutils.iteritems(diag.warnings):
if level == 'Require':
cxfixes.add_error(errid, title)
if cxfixes.has_errors():
# DBus is optional so only report/fix it opportunistically
mountpoints.check_dbus()
return gtk_status
def fix_all_bases(report=True):
gtk_status = check_all_bases()
# Delayed import in case we're running in Python 3
import cxfixes
cxfixes.fix_errors()
if report:
# Refresh the error list so we don't report errors that have been fixed
# as a side effect of others. For instance installing libgcc_s is
# likely to fix MissingLibPthread.
gtk_status = check_all_bases()
cxfixes.report_errors()
elif gtk_status != checkgtk.OK:
# The issues may not have all been fixed but if GTK+ is ok we can
# at least bring up the GUI.
gtk_status = checkgtk.ensure_present_gtk()
if gtk_status == checkgtk.NO_DISPLAY:
import cxlog
cxlog.err("Verify $DISPLAY: it is not set, invalid or you are not allowed to access it")
if gtk_status != checkgtk.OK:
# Only signal a failure if we won't be able to bring up the GUI
return False
return True