tag 595860 patch
thanks

On Tue, Sep 07, 2010 at 01:00:40AM +0200, Lucas Nussbaum wrote:
> Package: solfege
> Version: 3.16.4-1
> Severity: serious
> Tags: squeeze sid
> User: debian...@lists.debian.org
> Usertags: qa-ftbfs-20100906 qa-ftbfs
> Justification: FTBFS on amd64
> 
> Hi,
> 
> During a rebuild of all packages in a squeeze chroot, your package failed
> to build on amd64.
> 
> Relevant part:
> […]
> > ======================================================================
> > ERROR: test_add (solfege.mpd.tests.test_musicalpitch.TestMusicalPitch)
> > ----------------------------------------------------------------------
> > Traceback (most recent call last):
> >   File 
> > "/build/user-solfege_3.16.4-1-amd64-5srsJD/solfege-3.16.4/solfege/mpd/tests/test_musicalpitch.py",
> >  line 35, in test_add
> >     self.assertEquals(n.get_octave_notename(), 'd')
> >   File 
> > "/build/user-solfege_3.16.4-1-amd64-5srsJD/solfege-3.16.4/solfege/mpd/musicalpitch.py",
> >  line 360, in get_octave_notename
> >     return self._format_notename("%(utnotename)s%(oct)s")
> >   File 
> > "/build/user-solfege_3.16.4-1-amd64-5srsJD/solfege-3.16.4/solfege/mpd/musicalpitch.py",
> >  line 383, in _format_notename
> >     notename = _i(notename)
> >   File 
> > "/build/user-solfege_3.16.4-1-amd64-5srsJD/solfege-3.16.4/solfege/i18n.py", 
> > line 37, in _i
> >     ns = _(s)
> > TypeError: 'tuple' object is not callable
> […]

Python 2.6’s doctest is the culprit, more specifically some new lines in
doctest.DocTestRunner.run which override the displayhook provided by
test.py.  This causes _ to be set to the result of the last statement
(like in the REPL), which overrides the _ alias for ugettext from
solfege.i18n.

Upstream has fixed the issue by abolishing doctest.  Considering the
freeze and the fact that test.py isn’t shipped in the binary packages, I
have attached an alternative, ugly, but very simple patch to fix the
problem.

Cheers,
-- 
Michael Schutte <mi...@uiae.at>
Subject: Set sys.__displayhook__ = sys.displayhook in test.py
From: Michael Schutte <mi...@uiae.at>
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=595860
Forwarded: not-needed

doctest from Python >= 2.6 resets sys.displayhook whenever a test is
run.  The default displayhook sets _ to the evaluation result of the
last line, but this messes with the global definition of _ in
solfege.i18n.

This patch implements an ugly fix by redefining sys.__displayhook__ in
test.py.  Upstream has already fixed the problem properly by avoiding
doctest in the first place.

Index: solfege-3.16.4/test.py
===================================================================
--- solfege-3.16.4.orig/test.py	2010-09-18 19:28:26.000000000 +0200
+++ solfege-3.16.4/test.py	2010-09-18 19:28:33.000000000 +0200
@@ -19,7 +19,7 @@
     else:
         print s
 
-sys.displayhook = f
+sys.__displayhook__ = sys.displayhook = f
 
 from solfege import testlib
 import solfege.i18n

Attachment: signature.asc
Description: Digital signature

Reply via email to