1
0
mirror of synced 2024-11-22 01:04:23 +01:00

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>
This commit is contained in:
Antoine Tenart 2019-03-27 18:50:25 +01:00
parent c8602b8c7e
commit c824a68dd8

View File

@ -30,12 +30,12 @@ UNSUPPORTED_EXTENSIONS = {
} }
DEPENDENCIES = { DEPENDENCIES = {
'cairo': 'Cairo', 'Cairo': 'cairo',
'gi': 'PyGobject', 'PyGobject': 'gi',
'gi.repository.GdkPixbuf': 'GdkPixbuf from PyGobject', 'GdkPixbuf from PyGobject': 'gi.repository.GdkPixbuf',
'gi.repository.Poppler': 'Poppler from PyGobject', 'Poppler from PyGobject': 'gi.repository.Poppler',
'gi.repository.GLib': 'GLib from PyGobject', 'GLib from PyGobject': 'gi.repository.GLib',
'mutagen': 'Mutagen', 'Mutagen': 'mutagen',
} }
@ -46,11 +46,11 @@ def check_dependencies() -> Dict[str, bool]:
ret['Ffmpeg'] = bool(video._get_ffmpeg_path()) ret['Ffmpeg'] = bool(video._get_ffmpeg_path())
for key, value in DEPENDENCIES.items(): for key, value in DEPENDENCIES.items():
ret[value] = True ret[key] = True
try: try:
importlib.import_module(key) importlib.import_module(value)
except ImportError: # pragma: no cover except ImportError: # pragma: no cover
ret[value] = False # pragma: no cover ret[key] = False # pragma: no cover
return ret return ret