ports/116914: Fix mail/svnmailer with lang/python25+

Philip M. Gollucci pgollucci at p6m7g8.com
Thu Oct 4 16:40:02 UTC 2007


>Number:         116914
>Category:       ports
>Synopsis:       Fix mail/svnmailer with lang/python25+
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 04 16:40:01 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Philip M. Gollucci
>Release:        FreeBSD 7.0-current
>Organization:
Riderway Inc.
>Environment:
FreeBSD philip.hq.rws 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Thu Jul 26 16:44:37 EDT 2007     root at philip.office.rws:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
Starting with Python 2.5 (PYTHON_REL == 250) Exceptional Handling is built-in.

See Misc/News:
 * Exceptions are now built-in in python (LP: #111735)
    (Thanks to Daniel Gruen for providing the patch)
  * debian/control: Modify Maintainer value to match
    DebianMaintainerField spec.

mail/svnmailer doesn't account for this.


>How-To-Repeat:
cvsup to a ports tree post 2.5 python default.
cd mail/svnmailer
make install

#!/bin/sh
SVNADMIN=/usr/local/bin/svnadmin
MAILER=/usr/local/bin/svn-mailer
CONFIG=/usr/local/etc/svn-mailer.conf
REPOS=/home/svn
$MAILER -d "$REPOS" -r "1" -f $CONFIG

Notifier: svnmailer.util.SplittingDecorator
Revision: 3428
Groups: [u'defaults']
Traceback (most recent call last):
  File "/usr/local/lib/python2.5/site-packages/svnmailer/main.py", line 101, in run
    notifier.run()
  File "/usr/local/lib/python2.5/site-packages/svnmailer/notifier/_mail.py", line 62, in run
    for mail in self.getMails():
  File "/usr/local/lib/python2.5/site-packages/svnmailer/notifier/_mail.py", line 83, in getMails
    for mail in self.composeMail():
  File "/usr/local/lib/python2.5/site-packages/svnmailer/notifier/_textmail.py", line 131, in composeMail
    self.writeNotification()
  File "/usr/local/lib/python2.5/site-packages/svnmailer/notifier/_mail.py", line 96, in writeNotification
    self.writeDiffList()
  File "/usr/local/lib/python2.5/site-packages/svnmailer/notifier/_text.py", line 183, in writeDiffList
    self.writeContentDiff(change)
  File "/usr/local/lib/python2.5/site-packages/svnmailer/notifier/_textmail.py", line 303, in writeContentDiff
    self.__super.writeContentDiff(change)
  File "/usr/local/lib/python2.5/site-packages/svnmailer/notifier/_text.py", line 352, in writeContentDiff
    change, enc = enc, default = default
  File "/usr/local/lib/python2.5/site-packages/svnmailer/notifier/_base.py", line 300, in dumpContent
    enc1, enc2 = self.getContentEncodings(change)
  File "/usr/local/lib/python2.5/site-packages/svnmailer/notifier/_base.py", line 348, in getContentEncodings
    from encodings import exceptions
ImportError: cannot import name exceptions



>Fix:
Conditionally apply this patch if PYTHON_REL >= 250

Patch obtained from:
http://launchpadlibrarian.net/8131802/svnmailer-1.0.8-python2.5.diff

Note additional of files directory and new patch file.

portlint -ACN
port looks clean.

Patch attached with submission follows:

? files/25-patch-src__lib__svnmailer__notifier___base.py
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/mail/svnmailer/Makefile,v
retrieving revision 1.7
diff -u -r1.7 Makefile
--- Makefile	19 Dec 2006 21:19:04 -0000	1.7
+++ Makefile	4 Oct 2007 03:57:54 -0000
@@ -19,6 +19,11 @@
 USE_PYTHON=		2.3+
 USE_PYDISTUTILS=	yes
 
+.include <bsd.port.pre.mk>
+.if ${PYTHON_REL} >= 250
+EXTRA_PATCHES+=	${FILESDIR}/25-patch-src__lib__svnmailer__notifier___base.py
+.endif
+
 PORTDOCS=	index.html perlig.css perlig.jpg perlig_docs.css \
 		perlig_offline.css right.gif up.gif
 
@@ -32,4 +37,4 @@
 	cd ${WRKSRC}/docs; ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR}
 .endif
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
--- /dev/null	2007-10-03 23:57:27.000000000 -0400
+++ files/25-patch-src__lib__svnmailer__notifier___base.py	2007-10-03 23:40:08.000000000 -0400
@@ -0,0 +1,45 @@
+--- ./src/lib/svnmailer/notifier/_base.py.orig	2006-04-17 06:29:06.000000000 -0400
++++ ./src/lib/svnmailer/notifier/_base.py	2007-10-03 23:39:56.000000000 -0400
+@@ -345,7 +345,6 @@
+             @return: The two encodings
+             @rtype: C{tuple} of C{str}
+         """
+-        from encodings import exceptions
+ 
+         enc1 = enc2 = default
+         if not change.wasAdded() or change.wasCopied():
+@@ -353,7 +352,7 @@
+                 enc1 = self._getContentEncoding(
+                     change.getBasePath(), change.getBaseRevision()
+                 )
+-            except exceptions.LookupError:
++            except LookupError:
+                 # fall back
+                 pass
+ 
+@@ -364,7 +363,7 @@
+                 enc2 = self._getContentEncoding(
+                     change.path, change.revision
+                 )
+-            except exceptions.LookupError:
++            except LookupError:
+                 # fall back
+                 pass
+ 
+@@ -389,7 +388,6 @@
+             @exception encodings.exception.LookupError: The specified encoding
+                 is not implemented or no encoding was specified
+         """
+-        from encodings import exceptions
+ 
+         # first try the svn:mime-type
+         enc = self.getEncodingFromMimeType(path, revision)
+@@ -427,7 +425,7 @@
+             codecs.lookup(enc)
+             return enc
+ 
+-        raise exceptions.LookupError("No Encoding configured")
++        raise LookupError("No Encoding configured")
+ 
+ 
+     def getEncodingFromMimeType(self, path, revision):


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list