Bug 110464

Summary: games/fretsonfire: becomes broken if py-xml is installed
Product: Ports & Packages Reporter: Dmitry Marakasov <amdmi3>
Component: Individual Port(s)Assignee: Jose Alonso Cardenas Marquez <acm>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Dmitry Marakasov 2007-03-18 06:10:04 UTC
fretsonfire-1.1.324 becomes broken after installing textproc/py-xml. Here's what it says:

---
Traceback (most recent call last):
  File "/usr/local/bin/FretsOnFire", line 16, in ?
    execfile(os.path.join(package_dir, "FretsOnFire.py"))
  File "/usr/local/lib/fretsonfire/FretsOnFire/FretsOnFire.py", line 64, in ?
    engine = GameEngine(config)
  File "/usr/local/lib/fretsonfire/FretsOnFire/GameEngine.py", line 181, in __init__
    self.data = Data(self.resource, self.svg)
  File "/usr/local/lib/fretsonfire/FretsOnFire/Data.py", line 48, in __init__
    self.loadSvgDrawing(self, "star1", "star1.svg", textureSize = (128, 128))
  File "/usr/local/lib/fretsonfire/FretsOnFire/Data.py", line 93, in loadSvgDrawing
    getattr(target, name).convertToTexture(textureSize[0], textureSize[1])
  File "/usr/local/lib/fretsonfire/FretsOnFire/Svg.py", line 564, in convertToTexture
    self._render(transform)
  File "/usr/local/lib/fretsonfire/FretsOnFire/Svg.py", line 585, in _render
    self._cacheDrawing(self.context.drawBoard)
  File "/usr/local/lib/fretsonfire/FretsOnFire/Svg.py", line 543, in _cacheDrawing
    sax.parseString(self.svgData, SvgHandler(drawBoard, self.cache))
  File "/usr/local/lib/python2.4/site-packages/_xmlplus/sax/__init__.py", line 47, in parseString
    parser.parse(inpsrc)
  File "/usr/local/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 109, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/usr/local/lib/python2.4/site-packages/_xmlplus/sax/xmlreader.py", line 123, in parse
    self.feed(buffer)
  File "/usr/local/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 216, in feed
    self._parser.Parse(data, isFinal)
  File "/usr/local/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 312, in start_element
    self._cont_handler.startElement(name, AttributesImpl(attrs))
  File "/usr/local/lib/fretsonfire/FretsOnFire/Svg.py", line 325, in startElement
    f(attrs)
  File "/usr/local/lib/fretsonfire/FretsOnFire/Svg.py", line 400, in startLineargradient
    if "xlink:href" in attrs:
  File "/usr/local/lib/python2.4/site-packages/_xmlplus/sax/xmlreader.py", line 316, in __getitem__
    return self._attrs[name]
KeyError: 0
---

After deinstalling py-xml, FOF works again.

Fix: 

Seems like FretsOnFire/Svg.py should be patched, so `from xml import sax` line would use python's builtin sax module (/usr/local/lib/python2.4/xml/sax) instead of one installed by py-xml (/usr/local/lib/python2.4/site-packages/_xmlplus/sax). I'm not a pro in python, so I don't know how to actually do it.
How-To-Repeat: % cd /usr/ports/textproc/py-xml && make install
% FretsOnFire
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2007-03-18 06:10:12 UTC
Responsible Changed
From-To: freebsd-ports-bugs->acm

Over to maintainer
Comment 2 Mark Linimon 2007-05-06 00:44:50 UTC
----- Forwarded message from Jose Alonso Cardenas Marquez <acm@FreeBSD.org> -----

From: Jose Alonso Cardenas Marquez <acm@FreeBSD.org>

2007/4/23, Dmitry Marakasov <amdmi3@amdmi3.ru>:
>Yes, it now works both with and without py-xml installed.
>
>But 1.2.451 doesn't play guitar sound (only background song). Is it the
>same for you?

No, It works for me, btw i think that this PR could be closed, because
the main problem was solved.

Greetings
ACM
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2007-05-20 09:06:52 UTC
State Changed
From-To: open->closed

acm@ notes that the main problem was solved.