Bug 652890 - cannot import name fixtag
Summary: cannot import name fixtag
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-meld3
Version: 14
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
Assignee: Mike McGrath
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-11-13 10:24 UTC by Johan Cwiklinski
Modified: 2010-11-29 21:31 UTC (History)
4 users (show)

Fixed In Version: python-meld3-0.6.7-1.fc14
Clone Of:
Environment:
Last Closed: 2010-11-29 21:31:26 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Johan Cwiklinski 2010-11-13 10:24:17 UTC
Description of problem:
I'm trying to build a RPM for repoze.profile wich depends on python-meld3. I got the following stack trace:
======================================================================
ERROR: test_keep_at_shutdown (repoze.profile.tests.TestProfileMiddleware)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/dev/shm/repoze.profile-1.1/repoze/profile/tests.py", line 318, in test_keep_at_shutdown
    log_filename=log_filename)
  File "/dev/shm/repoze.profile-1.1/repoze/profile/tests.py", line 5, in _makeOne
    from repoze.profile.profiler import AccumulatingProfileMiddleware
  File "/dev/shm/repoze.profile-1.1/repoze/profile/profiler.py", line 26, in <module>
    import meld3
  File "/usr/lib64/python2.7/site-packages/meld3/__init__.py", line 2, in <module>
    from meld3 import parse_xml
  File "/usr/lib64/python2.7/site-packages/meld3/meld3.py", line 27, in <module>
    from xml.etree.ElementTree import fixtag
ImportError: cannot import name fixtag


Version-Release number of selected component (if applicable):
python-meld3-0.6.5-2.fc14.x86_64

Comment 1 Johan Cwiklinski 2010-11-13 10:59:31 UTC
Apparently, there is already a fix upstream for that one:
$ svn log -r 981 http://svn.supervisord.org/meld3 
------------------------------------------------------------------------
r981 | Chris McDonough <chrism> | 2010-08-05 03:03:36 +0200 (jeu. 05 août 2010) | 6 lignes

0.6.7 (2010-08-04)

  Make compatible with Python 2.7 (patch kindly contributed by
  Jonathan Riboux).


------------------------------------------------------------------------


$ svn diff http://svn.supervisord.org/meld3 -rr980:981
Index: trunk/meld3/test_meld3.py
===================================================================
--- trunk/meld3/test_meld3.py	(révision 980)
+++ trunk/meld3/test_meld3.py	(révision 981)
@@ -1,6 +1,7 @@
 import unittest
 from StringIO import StringIO
 import re
+import sys
 
 _SIMPLE_XML = r"""<?xml version="1.0"?>
 <root xmlns:meld="http://www.plope.com/software/meld3">
@@ -1671,9 +1672,13 @@
 </html>"""
 
     def test_unknown_entity(self):
-        from xml.parsers import expat
-        self.assertRaises(expat.error, self._parse,
-                          '<html><head></head><body>&fleeb;</body></html>')
+        if sys.version_info[:3] >= (2,7,0):
+            self.assertRaises(SyntaxError, self._parse,
+                              '<html><head></head><body>&fleeb;</body></html>')
+        else:
+            from xml.parsers import expat
+            self.assertRaises(expat.error, self._parse,
+                              '<html><head></head><body>&fleeb;</body></html>')
 
     def test_content_nostructure(self):
         root = self._parse(_SIMPLE_XML)
Index: trunk/meld3/meld3.py
===================================================================
--- trunk/meld3/meld3.py	(révision 980)
+++ trunk/meld3/meld3.py	(révision 981)
@@ -3,6 +3,7 @@
 import re
 import types
 import mimetools
+import string
 from StringIO import StringIO
 
 try:
@@ -24,10 +25,34 @@
     from xml.etree.ElementTree import QName
     from xml.etree.ElementTree import _raise_serialization_error
     from xml.etree.ElementTree import _namespace_map
-    from xml.etree.ElementTree import fixtag
     from xml.etree.ElementTree import parse as et_parse
     from xml.etree.ElementTree import ElementPath
 
+    try:
+        from xml.etree.ElementTree import fixtag
+    except:
+        def fixtag(tag, namespaces):
+            # given a decorated tag (of the form {uri}tag), return prefixed
+            # tag and namespace declaration, if any
+            if isinstance(tag, QName):
+                tag = tag.text
+            namespace_uri, tag = string.split(tag[1:], "}", 1)
+            prefix = namespaces.get(namespace_uri)
+            if prefix is None:
+                prefix = _namespace_map.get(namespace_uri)
+                if prefix is None:
+                    prefix = "ns%d" % len(namespaces)
+                namespaces[namespace_uri] = prefix
+                if prefix == "xml":
+                    xmlns = None
+                else:
+                    xmlns = ("xmlns:%s" % prefix, namespace_uri)
+            else:
+                xmlns = None
+            return "%s:%s" % (prefix, tag), xmlns
+        
+
+
 # HTMLTreeBuilder does not exist in python 2.5 standard elementtree
 from HTMLParser import HTMLParser
 AUTOCLOSE = "p", "li", "tr", "th", "td", "head", "body"
Index: trunk/CHANGES.txt
===================================================================
--- trunk/CHANGES.txt	(révision 980)
+++ trunk/CHANGES.txt	(révision 981)
@@ -1,3 +1,8 @@
+0.6.7 (2010-08-04)
+
+  Make compatible with Python 2.7 (patch kindly contributed by
+  Jonathan Riboux).
+
 0.6.6
 
   Change download location.  This really should be a setuptools
Index: trunk/setup.py
===================================================================
--- trunk/setup.py	(révision 980)
+++ trunk/setup.py	(révision 981)
@@ -12,12 +12,12 @@
 
 setup(
     name = 'meld3',
-    version = '0.6.6',
+    version = '0.6.7',
     description = 'meld3 is an HTML/XML templating engine.',
     author = 'Chris McDonough',
     author_email =  'chrism',
-    license='see LICENSE.txt',
+    license='ZPL 2.1',
     packages=['meld3'],
-    url='http://dist.repoze.org/meld3/',
+    url='http://svn.supervisord.org/meld3/     ',
     ext_modules=ext_modules,
 )

Comment 2 Marco Vittorini Orgeas 2010-11-19 16:10:19 UTC
This is a one STOP bug for the supervisord package.

Supervisord rely on python-meld and after upgrade F13 --> F14 I can't start the supervisord daemon anymore.
Now being svd the daemon which starts and control almost all the other machine services you understand that after the upgrade I'm stuck.
Would the assignee apply the patch and push the package to upgrade as soon as possible please ? 

thanks

Comment 3 Toshio Ernie Kuratomi 2010-11-19 20:38:47 UTC
I've just built python-meld3-0.6.7 which should have the attached fix.  Also a note:

mmcgrath and I packaged this because we used supervisor it in Fedora Infrastructure.  We're now only using one app via supervisor (and contemplating porting that to use a different method).  If you (or anyone) would like to become owner or comaintainer for this package and/or the supervisor package, it would be greatly appreciated.

Comment 4 Fedora Update System 2010-11-19 21:55:05 UTC
python-meld3-0.6.7-1.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/python-meld3-0.6.7-1.fc14

Comment 5 Fedora Update System 2010-11-21 01:29:21 UTC
python-meld3-0.6.7-1.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update python-meld3'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/python-meld3-0.6.7-1.fc14

Comment 6 Fedora Update System 2010-11-29 21:31:21 UTC
python-meld3-0.6.7-1.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.