Ejemplo n.º 1
0
 def priority(cls):
     with ExceptionRaisedContext() as exc:
         KWallet.__name__
     if exc:
         raise RuntimeError("KDE libraries not available")
     if 'KDE_SESSION_ID' not in os.environ:
         return 0
     return 5
Ejemplo n.º 2
0
def has_wincrypto():
    """
    Does this environment have wincrypto?
    Should return False even when Mercurial's Demand Import allowed import of
    _win_crypto, so accesses an attribute of the module.
    """
    with ExceptionRaisedContext() as exc:
        _win_crypto.__name__
    return not bool(exc)
Ejemplo n.º 3
0
def has_pywin32():
    """
    Does this environment have pywin32?
    Should return False even when Mercurial's Demand Import allowed import of
    win32cred.
    """
    with ExceptionRaisedContext() as exc:
        win32cred.__name__
    return not bool(exc)
Ejemplo n.º 4
0
 def priority(cls):
     with ExceptionRaisedContext() as exc:
         secretstorage.__name__
     if exc:
         raise RuntimeError("SecretService required")
     try:
         bus = secretstorage.dbus_init()
         secretstorage.Collection(bus)
     except secretstorage.exceptions.SecretServiceNotAvailableException:
         raise RuntimeError("Unable to get initialize SecretService")
     return 5
Ejemplo n.º 5
0
 def priority(cls):
     with ExceptionRaisedContext() as exc:
         secretstorage.__name__
     if exc:
         raise RuntimeError("SecretService required")
     try:
         bus = secretstorage.dbus_init()
         list(secretstorage.get_all_collections(bus))
     except secretstorage.exceptions.SecretServiceNotAvailableException as e:
         raise RuntimeError("Unable to initialize SecretService: %s" % e)
     return 5
Ejemplo n.º 6
0
 def priority(cls):
     with ExceptionRaisedContext() as exc:
         KWallet.__name__
     if exc:
         raise RuntimeError("KDE libraries not available")
     # Infer if KDE environment is active based on environment vars.
     # TODO: Does PyKDE provide a better indicator?
     kde_session_keys = (
         'KDE_SESSION_ID', # most environments
         'KDE_FULL_SESSION', # openSUSE
     )
     if not set(os.environ).intersection(kde_session_keys):
         return 0
     return 5
Ejemplo n.º 7
0
 def priority(cls):
     with ExceptionRaisedContext() as exc:
         secretstorage.__name__
     if exc:
         raise RuntimeError("SecretService required")
     try:
         bus = secretstorage.dbus_init()
         secretstorage.Collection(bus)
     except secretstorage.exceptions.SecretServiceNotAvailableException:
         raise RuntimeError("Unable to get initialize SecretService")
     if 'DISPLAY' not in os.environ:
         raise RuntimeError("SecretService cannot run without a DISPLAY "
                            "environment variable")
     return 5
Ejemplo n.º 8
0
 def _has_gdata(cls):
     with ExceptionRaisedContext() as exc:
         gdata.__name__
     return not bool(exc)
Ejemplo n.º 9
0
 def viable(cls):
     with ExceptionRaisedContext() as exc:
         cls.priority
     return not bool(exc)