From question@closedsrc.org  Tue Feb 22 00:21:54 2005
Return-Path: <question@closedsrc.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id 428A916A4CE; Tue, 22 Feb 2005 00:21:54 +0000 (GMT)
Received: from q.closedsrc.org (ip233.gte244.dsl-acs2.sea.iinet.com [209.20.244.233])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id A38CC43D31; Tue, 22 Feb 2005 00:21:53 +0000 (GMT)
	(envelope-from question@closedsrc.org)
Received: by q.closedsrc.org (Postfix, from userid 1001)
	id 068E64503E; Mon, 21 Feb 2005 16:21:47 -0800 (PST)
Message-Id: <20050222002147.068E64503E@q.closedsrc.org>
Date: Mon, 21 Feb 2005 16:21:47 -0800 (PST)
From: Linh Pham <question+fbsdports@closedsrc.org>
Reply-To: Linh Pham <question+fbsdports@closedsrc.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: sergei@freebsd.org, m_zwart@123mail.org
Subject: mail/getmail: Add patch to not use "strict" with Python 2.4
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>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:    clsung
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 22 00:30:20 GMT 2005
>Closed-Date:    Fri Mar 04 04:00:09 GMT 2005
>Last-Modified:  Fri Mar 04 04:00:09 GMT 2005
>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:
Responsible-Changed-From-To: freebsd-ports-bugs->clsung 
Responsible-Changed-By: clsung 
Responsible-Changed-When: Tue Feb 22 06:05:32 GMT 2005 
Responsible-Changed-Why:  
Grab. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=77896 
State-Changed-From-To: open->closed 
State-Changed-By: clsung 
State-Changed-When: Fri Mar 4 03:59:58 GMT 2005 
State-Changed-Why:  
Committed, Thank you. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=77896 
>Unformatted:
