suspicious-source: Show error message instead of having the import error

for recommended packages (Closes: #613101, LP: #693813).
This commit is contained in:
Benjamin Drung 2011-02-12 22:37:16 +01:00
parent 13fbbcb4f3
commit 02c7c47ece
2 changed files with 13 additions and 1 deletions

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
ubuntu-dev-tools (0.117) UNRELEASED; urgency=low
* suspicious-source: Show error message instead of having the import error
for recommended packages (Closes: #613101, LP: #693813).
-- Benjamin Drung <bdrung@debian.org> Sat, 12 Feb 2011 22:35:07 +0100
ubuntu-dev-tools (0.116) unstable; urgency=low ubuntu-dev-tools (0.116) unstable; urgency=low
[ Benjamin Drung ] [ Benjamin Drung ]

View File

@ -14,13 +14,18 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import magic
import optparse import optparse
import os import os
import sys import sys
from ubuntutools.logger import Logger from ubuntutools.logger import Logger
try:
import magic
except ImportError:
Logger.error("Please install 'python-magic' in order to use this utility.")
sys.exit(1)
DEFAULT_WHITELISTED_MIMETYPES = [ DEFAULT_WHITELISTED_MIMETYPES = [
"application/vnd.font-fontforge-sfd", # font source: fontforge "application/vnd.font-fontforge-sfd", # font source: fontforge
"application/x-elc", "application/x-elc",