summaryrefslogtreecommitdiff
path: root/libmat2/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'libmat2/__init__.py')
-rw-r--r--libmat2/__init__.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/libmat2/__init__.py b/libmat2/__init__.py
index d910215..cd65bfc 100644
--- a/libmat2/__init__.py
+++ b/libmat2/__init__.py
@@ -1,5 +1,13 @@
1#!/bin/env python3 1#!/bin/env python3
2 2
3import os
4import collections
5import importlib
6from typing import Dict
7
8# make pyflakes happy
9assert Dict
10
3# A set of extension that aren't supported, despite matching a supported mimetype 11# A set of extension that aren't supported, despite matching a supported mimetype
4UNSUPPORTED_EXTENSIONS = { 12UNSUPPORTED_EXTENSIONS = {
5 '.asc', 13 '.asc',
@@ -17,3 +25,28 @@ UNSUPPORTED_EXTENSIONS = {
17 '.xsd', 25 '.xsd',
18 '.xsl', 26 '.xsl',
19 } 27 }
28
29DEPENDENCIES = {
30 'cairo': 'Cairo',
31 'gi': 'PyGobject',
32 'gi.repository.GdkPixbuf': 'GdkPixbuf from PyGobject',
33 'gi.repository.Poppler': 'Poppler from PyGobject',
34 'mutagen': 'Mutagen',
35 }
36
37def check_dependencies() -> dict:
38 ret = collections.defaultdict(bool) # type: Dict[str, bool]
39
40 exiftool = '/usr/bin/exiftool'
41 ret['Exiftool'] = False
42 if os.path.isfile(exiftool) and os.access(exiftool, os.X_OK): # pragma: no cover
43 ret['Exiftool'] = True
44
45 for key, value in DEPENDENCIES.items():
46 ret[value] = True
47 try:
48 importlib.import_module(key)
49 except ImportError: # pragma: no cover
50 ret[value] = False # pragma: no cover
51
52 return ret