changeset 1542:94901070478e

plugins: added new MissingModule exceptions to plugins using third party modules
author Goffi <goffi@goffi.org>
date Wed, 30 Sep 2015 17:25:09 +0200
parents 685fad1c18e4
children 62596ec69bbd
files src/plugins/plugin_adhoc_dbus.py src/plugins/plugin_misc_radiocol.py src/plugins/plugin_misc_text_syntaxes.py src/plugins/plugin_xep_0054.py src/plugins/plugin_xep_0071.py src/plugins/plugin_xep_0277.py
diffstat 6 files changed, 29 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_adhoc_dbus.py	Wed Sep 30 17:24:21 2015 +0200
+++ b/src/plugins/plugin_adhoc_dbus.py	Wed Sep 30 17:25:09 2015 +0200
@@ -24,8 +24,11 @@
 from sat.core import exceptions
 from twisted.internet import defer
 from wokkel import data_form
-from lxml import etree
-from os import path
+try:
+    from lxml import etree
+except ImportError:
+    raise exceptions.MissingModule(u"Missing module lxml, please download/install it from http://lxml.de/")
+import os.path
 import uuid
 import dbus
 from dbus.mainloop.glib import DBusGMainLoop
--- a/src/plugins/plugin_misc_radiocol.py	Wed Sep 30 17:24:21 2015 +0200
+++ b/src/plugins/plugin_misc_radiocol.py	Wed Sep 30 17:25:09 2015 +0200
@@ -29,10 +29,13 @@
 import copy
 import time
 from os import unlink
-from mutagen.oggvorbis import OggVorbis, OggVorbisHeaderError
-from mutagen.mp3 import MP3, HeaderNotFoundError
-from mutagen.easyid3 import EasyID3
-from mutagen.id3 import ID3NoHeaderError
+try:
+    from mutagen.oggvorbis import OggVorbis, OggVorbisHeaderError
+    from mutagen.mp3 import MP3, HeaderNotFoundError
+    from mutagen.easyid3 import EasyID3
+    from mutagen.id3 import ID3NoHeaderError
+except ImportError:
+    raise exceptions.MissingModule(u"Missing module Mutagen, please download/install from https://bitbucket.org/lazka/mutagen")
 
 
 NC_RADIOCOL = 'http://www.goffi.org/protocol/radiocol'
--- a/src/plugins/plugin_misc_text_syntaxes.py	Wed Sep 30 17:24:21 2015 +0200
+++ b/src/plugins/plugin_misc_text_syntaxes.py	Wed Sep 30 17:25:09 2015 +0200
@@ -24,8 +24,11 @@
 from twisted.internet import defer
 from twisted.internet.threads import deferToThread
 from sat.core import exceptions
-from lxml import html
-from lxml.html import clean
+try:
+    from lxml import html
+    from lxml.html import clean
+except ImportError:
+    raise exceptions.MissingModule(u"Missing module lxml, please download/install it from http://lxml.de/")
 from cgi import escape
 import re
 
--- a/src/plugins/plugin_xep_0054.py	Wed Sep 30 17:24:21 2015 +0200
+++ b/src/plugins/plugin_xep_0054.py	Wed Sep 30 17:25:09 2015 +0200
@@ -37,7 +37,10 @@
 from hashlib import sha1
 from sat.core import exceptions
 from sat.memory import persistent
-from PIL import Image
+try:
+    from PIL import Image
+except:
+    raise exceptions.MissingModule(u"Missing module pillow, please download/install it from https://python-pillow.github.io")
 from cStringIO import StringIO
 
 try:
--- a/src/plugins/plugin_xep_0071.py	Wed Sep 30 17:24:21 2015 +0200
+++ b/src/plugins/plugin_xep_0071.py	Wed Sep 30 17:25:09 2015 +0200
@@ -25,7 +25,10 @@
 from wokkel import disco, iwokkel
 from zope.interface import implements
 # from lxml import etree
-from lxml import html
+try:
+    from lxml import html
+except ImportError:
+    raise exceptions.MissingModule(u"Missing module lxml, please download/install it from http://lxml.de/")
 try:
     from twisted.words.protocols.xmlstream import XMPPHandler
 except ImportError:
--- a/src/plugins/plugin_xep_0277.py	Wed Sep 30 17:24:21 2015 +0200
+++ b/src/plugins/plugin_xep_0277.py	Wed Sep 30 17:25:09 2015 +0200
@@ -31,7 +31,10 @@
 
 # XXX: tmp.pubsub is actually use instead of wokkel version
 from wokkel import pubsub
-from feed.date import rfc3339
+try:
+    from feed.date import rfc3339
+except ImportError:
+    raise exceptions.MissingModule(u"Missing module pyfeed, please download/install it from http://home.avvanta.com/~steveha/pyfeed.html")
 import uuid
 import time
 import urlparse