Date: Mon, 21 Feb 2005 16:21:47 -0800 (PST) From: Linh Pham <question+fbsdports@closedsrc.org> To: FreeBSD-gnats-submit@FreeBSD.org Cc: m_zwart@123mail.org Subject: ports/77896: mail/getmail: Add patch to not use "strict" with Python 2.4 Message-ID: <20050222002147.068E64503E@q.closedsrc.org> Resent-Message-ID: <200502220030.j1M0UKrx041285@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 77896 >Category: ports >Synopsis: mail/getmail: Add patch to not use "strict" with Python 2.4 >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Tue Feb 22 00:30:20 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Linh Pham >Release: FreeBSD 5.3-RELEASE-p4 i386 >Organization: >Environment: System: FreeBSD q.internal.closedsrc.org 5.3-RELEASE-p4 FreeBSD 5.3-RELEASE-p4 #5: Sat Jan 8 23:34:57 PST 2005 question@q.internal.closedsrc.org:/usr/obj/usr/src/sys/Q i386 >Description: Add patches to mail/getmail to tell modules not to use "strict" when program is executed with Python 2.4 or newer. Borrowed patch from Gentoo Portage of net-mail/getmail. Credit goes to Marien Zwart <m_zwart@123mail.org> per the following Gentoo Portage change log entry: 09 Feb 2005; Andrej Kacian <ticho@gentoo.org> +files/python2.4-fix.patch, +getmail-4.2.5-r1.ebuild, +getmail-4.3.1-r1.ebuild, getmail-4.3.2.ebuild: Fix deprecation warnings for "strict" usage in python 2.4. Patch submitted by Marien Zwart <m_zwart@123mail.org>, bug #80073. Only change I made was to clean up the code a wee bit. >How-To-Repeat: >Fix: --- getmail,python2.4-patches.diff begins here --- diff -ruN /usr/ports/mail/getmail/files/patch-message.py getmail/files/patch-message.py --- /usr/ports/mail/getmail/files/patch-message.py Wed Dec 31 16:00:00 1969 +++ getmail/files/patch-message.py Mon Feb 21 16:09:33 2005 @@ -0,0 +1,43 @@ +--- getmailcore/message.py.orig Mon Feb 21 15:57:08 2005 ++++ getmailcore/message.py Mon Feb 21 16:04:17 2005 +@@ -7,6 +7,7 @@ + 'Message', + ] + ++import sys + import os + import time + import cStringIO +@@ -86,20 +87,28 @@ + # of filters, etc, which should be saner. + if fromlines: + try: +- self.__msg = email.message_from_string(os.linesep.join( +- fromlines), strict=False) ++ if sys.version_info < (2, 4): ++ self.__msg = email.message_from_string(os.linesep.join(fromlines), strict=False) ++ else: ++ self.__msg = email.message_from_string(os.linesep.join(fromlines)) + except email.Errors.MessageError, o: + self.__msg = corrupt_message(o, fromlines=fromlines) + self.__raw = os.linesep.join(fromlines) + elif fromstring: + try: +- self.__msg = email.message_from_string(fromstring, strict=False) ++ if sys.version_info < (2, 4): ++ self.__msg = email.message_from_string(fromstring, strict=False) ++ else: ++ self.__msg = email.message_from_string(fromstring) + except email.Errors.MessageError, o: + self.__msg = corrupt_message(o, fromstring=fromstring) + self.__raw = fromstring + elif fromfile: + try: +- self.__msg = email.message_from_file(fromfile, strict=False) ++ if sys.version_info < (2, 4): ++ self.__msg = email.message_from_file(fromfile, strict=False) ++ else: ++ self.__msg = email.message_from_file(fromfile) + except email.Errors.MessageError, o: + # Shouldn't happen + self.__msg = corrupt_message(o, fromstring=fromfile.read()) diff -ruN /usr/ports/mail/getmail/files/patch-retrieverbases.py getmail/files/patch-retrieverbases.py --- /usr/ports/mail/getmail/files/patch-retrieverbases.py Wed Dec 31 16:00:00 1969 +++ getmail/files/patch-retrieverbases.py Mon Feb 21 16:09:19 2005 @@ -0,0 +1,23 @@ +--- getmailcore/_retrieverbases.py.orig Mon Feb 21 15:57:08 2005 ++++ getmailcore/_retrieverbases.py Mon Feb 21 15:59:11 2005 +@@ -33,6 +33,7 @@ + 'RetrieverSkeleton', + ] + ++import sys + import os + import socket + import time +@@ -445,7 +446,11 @@ + self.log.trace() + msgnum = self._getmsgnumbyid(msgid) + response, headerlist, octets = self.conn.top(msgnum, 0) +- parser = email.Parser.Parser(strict=False) ++ # 'strict' argument is deprecated in Python 2.4 ++ if sys.version_info < (2, 4): ++ parser = email.Parser.Parser(strict=False) ++ else: ++ parser = email.Parser.Parser() + return parser.parsestr(os.linesep.join(headerlist), headersonly=True) + + def initialize(self): --- getmail,python2.4-patches.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050222002147.068E64503E>