summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-04-11 17:17:31 -0700
committerZac Medico <zmedico@gentoo.org>2010-04-11 17:17:31 -0700
commitab02fdd64eb215464325dfade55aad115d687a7f (patch)
tree3d3d930b8921d9750d389b274b919f3dddd002c1 /pym/repoman
parentUse assertFalse insead of failIf since failIf is deprecated in python 3.2. (diff)
downloadportage-multirepo-ab02fdd64eb215464325dfade55aad115d687a7f.tar.gz
portage-multirepo-ab02fdd64eb215464325dfade55aad115d687a7f.tar.bz2
portage-multirepo-ab02fdd64eb215464325dfade55aad115d687a7f.zip
Avoid XMLParser.doctype deprecation warnings with >=python-2.7.
Diffstat (limited to 'pym/repoman')
-rw-r--r--pym/repoman/herdbase.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/pym/repoman/herdbase.py b/pym/repoman/herdbase.py
index 6f92abfb..9e20aa17 100644
--- a/pym/repoman/herdbase.py
+++ b/pym/repoman/herdbase.py
@@ -4,7 +4,7 @@
# Distributed under the terms of the GNU General Public License v2
import errno
-import xml.etree.ElementTree as ET
+import xml.etree.ElementTree
from xml.parsers.expat import ExpatError
from portage.exception import FileNotFound, ParseError, PermissionDenied
@@ -36,13 +36,22 @@ class HerdBase(object):
def maintainer_in_herd(self, nick_name, herd_name):
return _make_email(nick_name) in self.herd_to_emails[herd_name]
+class _HerdsTreeBuilder(xml.etree.ElementTree.TreeBuilder):
+ """
+ Implements doctype() as required to avoid deprecation warnings with
+ >=python-2.7.
+ """
+ def doctype(self, name, pubid, system):
+ pass
def make_herd_base(filename):
herd_to_emails = dict()
all_emails = set()
try:
- xml_tree = ET.parse(filename)
+ xml_tree = xml.etree.ElementTree.parse(filename,
+ parser=xml.etree.ElementTree.XMLParser(
+ target=_HerdsTreeBuilder()))
except ExpatError as e:
raise ParseError("metadata.xml: " + str(e))
except EnvironmentError as e: