From: Michael Tremer Date: Tue, 27 Apr 2010 13:42:24 +0000 (+0200) Subject: naoki: python 2.4 does not come with the email module. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19978eb748ea7cda01e9927bf79530ca27b86933;p=ipfire-3.x.git naoki: python 2.4 does not come with the email module. So, we disable the email function here. This affects CentOS 5.4. --- diff --git a/naoki/backend.py b/naoki/backend.py index 9129cc333..1c7f69074 100644 --- a/naoki/backend.py +++ b/naoki/backend.py @@ -1,7 +1,6 @@ #!/usr/bin/python -import email.mime.multipart -import email.mime.text + import os import shutil import smtplib @@ -20,6 +19,15 @@ __cache = { "group_names" : None, } +# Python 2.4 does not have that email module, so +# we disable the mail function here. +try: + import email.mime.multipart + import email.mime.text + have_email = 1 +except ImportError: + have_email = 0 + try: import hashlib have_hashlib = 1 @@ -565,6 +573,10 @@ def report_error_by_mail(package): if not config["error_report_recipient"]: return + if not have_email: + log.error("Can't send mail because this python version does not support this") + return + try: connection = smtplib.SMTP(config["smtp_server"]) #connection.set_debuglevel(1)