summaryrefslogtreecommitdiff
path: root/libmat2/__init__.py
diff options
context:
space:
mode:
authorAntoine Tenart2019-03-27 18:50:25 +0100
committerAntoine Tenart2019-03-29 19:29:28 +0100
commitc824a68dd8cba7ff567f54bf65d22d46438d326b (patch)
tree4e638d6d976c059ddf6123714e13f190de414a34 /libmat2/__init__.py
parentc8602b8c7e4e6a2686b02f1410f7bc71e25da470 (diff)
libmat2: reshape the dependencies list
Invert the keys and values in DEPENDENCIES. It seems more natural to use the key as a key in check_dependencies(), and the value as the value. This also help in preparing for reworking the check_dependencies() helper. Signed-off-by: Antoine Tenart <antoine.tenart@ack.tf>
Diffstat (limited to 'libmat2/__init__.py')
-rw-r--r--libmat2/__init__.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/libmat2/__init__.py b/libmat2/__init__.py
index be7067b..1d945d4 100644
--- a/libmat2/__init__.py
+++ b/libmat2/__init__.py
@@ -30,12 +30,12 @@ UNSUPPORTED_EXTENSIONS = {
30 } 30 }
31 31
32DEPENDENCIES = { 32DEPENDENCIES = {
33 'cairo': 'Cairo', 33 'Cairo': 'cairo',
34 'gi': 'PyGobject', 34 'PyGobject': 'gi',
35 'gi.repository.GdkPixbuf': 'GdkPixbuf from PyGobject', 35 'GdkPixbuf from PyGobject': 'gi.repository.GdkPixbuf',
36 'gi.repository.Poppler': 'Poppler from PyGobject', 36 'Poppler from PyGobject': 'gi.repository.Poppler',
37 'gi.repository.GLib': 'GLib from PyGobject', 37 'GLib from PyGobject': 'gi.repository.GLib',
38 'mutagen': 'Mutagen', 38 'Mutagen': 'mutagen',
39 } 39 }
40 40
41 41
@@ -46,11 +46,11 @@ def check_dependencies() -> Dict[str, bool]:
46 ret['Ffmpeg'] = bool(video._get_ffmpeg_path()) 46 ret['Ffmpeg'] = bool(video._get_ffmpeg_path())
47 47
48 for key, value in DEPENDENCIES.items(): 48 for key, value in DEPENDENCIES.items():
49 ret[value] = True 49 ret[key] = True
50 try: 50 try:
51 importlib.import_module(key) 51 importlib.import_module(value)
52 except ImportError: # pragma: no cover 52 except ImportError: # pragma: no cover
53 ret[value] = False # pragma: no cover 53 ret[key] = False # pragma: no cover
54 54
55 return ret 55 return ret
56 56