summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2012-05-11 14:53:05 +0200
committerjvoisin2012-05-11 14:53:05 +0200
commitc9562087fdabdafec11a673ca86e7d43e4071d76 (patch)
tree7a4e61fbc5696867b115e029285bf6260f8c109c
parent836bd5d42e4ec4797c3a505aa0b3c5af2decdf97 (diff)
Informatives messages for missings libraries
-rw-r--r--lib/strippers.py30
-rw-r--r--test/test.py3
2 files changed, 26 insertions, 7 deletions
diff --git a/lib/strippers.py b/lib/strippers.py
index dfdf1ea..61030a7 100644
--- a/lib/strippers.py
+++ b/lib/strippers.py
@@ -20,24 +20,42 @@ STRIPPERS = {
20 'application/officeopenxml': office.OpenXmlStripper, 20 'application/officeopenxml': office.OpenXmlStripper,
21} 21}
22 22
23try: # PDF support 23
24# PDF support
25pdfSupport = True
26try:
24 import poppler 27 import poppler
28except ImportError:
29 print('Unable to import python-poppler: not PDF support')
30 pdfSupport = False
31
32try:
25 import cairo 33 import cairo
34except ImportError:
35 print('Unable to import python-cairo: no PDF support')
36 pdfSupport = False
37
38try:
26 import pdfrw 39 import pdfrw
40except ImportError:
41 print('Unable to import python-pdfrw: no PDf support')
42 pdfSupport = False
43
44if pdfSupport:
27 STRIPPERS['application/x-pdf'] = office.PdfStripper 45 STRIPPERS['application/x-pdf'] = office.PdfStripper
28 STRIPPERS['application/pdf'] = office.PdfStripper 46 STRIPPERS['application/pdf'] = office.PdfStripper
29except ImportError:
30 print('Unable to import python-poppler and/or python-cairo \
31and/or pdfrw: no PDF support')
32 47
33try: # mutangen-python : audio format support 48
49# audio format support with mutagen-python
50try:
34 import mutagen 51 import mutagen
35 STRIPPERS['audio/x-flac'] = audio.FlacStripper 52 STRIPPERS['audio/x-flac'] = audio.FlacStripper
36 STRIPPERS['audio/vorbis'] = audio.OggStripper 53 STRIPPERS['audio/vorbis'] = audio.OggStripper
37except ImportError: 54except ImportError:
38 print('Unable to import python-mutagen: limited audio format support') 55 print('Unable to import python-mutagen: limited audio format support')
39 56
40try: # check if exiftool is installed on the system 57# exiftool
58try:
41 subprocess.Popen('exiftool', stdout=open('/dev/null')) 59 subprocess.Popen('exiftool', stdout=open('/dev/null'))
42 import exiftool 60 import exiftool
43 STRIPPERS['image/jpeg'] = exiftool.JpegStripper 61 STRIPPERS['image/jpeg'] = exiftool.JpegStripper
diff --git a/test/test.py b/test/test.py
index 630c157..f09e1c5 100644
--- a/test/test.py
+++ b/test/test.py
@@ -28,6 +28,7 @@ FILE_LIST = zip(clean, dirty)
28try: # PDF render processing 28try: # PDF render processing
29 import poppler 29 import poppler
30 import cairo 30 import cairo
31 import pdfrw
31except: 32except:
32 FILE_LIST.remove(('clean é.pdf', 'dirty é.pdf')) 33 FILE_LIST.remove(('clean é.pdf', 'dirty é.pdf'))
33 34
@@ -37,7 +38,7 @@ except:
37 pass # since wr don't have any ogg for now 38 pass # since wr don't have any ogg for now
38 #FILE_LIST.remove(('clean.ogg', 'dirty.ogg')) 39 #FILE_LIST.remove(('clean.ogg', 'dirty.ogg'))
39 40
40try: # file format managed by exiftool 41try: # file format exclusively managed by exiftool
41 subprocess.Popen('exiftool', stdout=open('/dev/null')) 42 subprocess.Popen('exiftool', stdout=open('/dev/null'))
42except: 43except:
43 pass # None for now 44 pass # None for now