|
13 | 13 | pip install wheel |
14 | 14 | PYGOBJECT_WITHOUT_PYCAIRO=1 pip install --no-build-isolation pygobject |
15 | 15 | """ |
16 | | -import logging |
17 | | - |
18 | | -logger = logging.getLogger(__name__) |
19 | 16 |
|
20 | 17 | try: |
21 | 18 | import gi # https://github.com/AzureAD/microsoft-authentication-extensions-for-python/wiki/Encryption-on-Linux # pylint: disable=line-too-long |
22 | 19 | except ImportError: |
23 | | - logger.exception( |
24 | | - """Runtime dependency of PyGObject is missing. |
| 20 | + raise ImportError("""Unable to import module 'gi' |
| 21 | +Runtime dependency of PyGObject is missing. |
25 | 22 | Depends on your Linux distro, you could install it system-wide by something like: |
26 | 23 | sudo apt install python3-gi python3-gi-cairo gir1.2-secret-1 |
27 | 24 | If necessary, please refer to PyGObject's doc: |
28 | 25 | https://pygobject.readthedocs.io/en/latest/getting_started.html |
29 | | -""") |
30 | | - raise |
| 26 | +""") # Message via exception rather than log |
31 | 27 |
|
32 | 28 | try: |
33 | 29 | # pylint: disable=no-name-in-module |
34 | 30 | gi.require_version("Secret", "1") # Would require a package gir1.2-secret-1 |
35 | 31 | # pylint: disable=wrong-import-position |
36 | 32 | from gi.repository import Secret # Would require a package gir1.2-secret-1 |
37 | | -except (ValueError, ImportError): |
38 | | - logger.exception( |
| 33 | +except (ValueError, ImportError) as ex: |
| 34 | + raise type(ex)( |
39 | 35 | """Require a package "gir1.2-secret-1" which could be installed by: |
40 | 36 | sudo apt install gir1.2-secret-1 |
41 | | - """) |
42 | | - raise |
| 37 | + """) # Message via exception rather than log |
| 38 | + |
43 | 39 |
|
44 | 40 | class LibSecretAgent(object): |
45 | 41 | """A loader/saver built on top of low-level libsecret""" |
@@ -134,7 +130,5 @@ def trial_run(): |
134 | 130 | you may need to install gnome-keyring package. |
135 | 131 | * Headless mode (such as in an ssh session) is not supported. |
136 | 132 | """ |
137 | | - logger.exception(message) # This log contains trace stack for debugging |
138 | | - logger.warning(message) # This is visible by default |
139 | | - raise |
| 133 | + raise RuntimeError(message) # Message via exception rather than log |
140 | 134 |
|
0 commit comments