summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/xml/metadata.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/pym/portage/xml/metadata.py b/pym/portage/xml/metadata.py
index ef335e29f..9e1886927 100644
--- a/pym/portage/xml/metadata.py
+++ b/pym/portage/xml/metadata.py
@@ -36,10 +36,19 @@ except ImportError:
import xml.etree.ElementTree as etree
import re
+import xml.etree.ElementTree
import portage
from portage import os
from portage.util import unique_everseen
+class _MetadataTreeBuilder(xml.etree.ElementTree.TreeBuilder):
+ """
+ Implements doctype() as required to avoid deprecation warnings with
+ Python >=2.7.
+ """
+ def doctype(self, name, pubid, system):
+ pass
+
class _Maintainer(object):
"""An object for representing one maintainer.
@@ -173,7 +182,8 @@ class MetaDataXML(object):
self._xml_tree = None
try:
- self._xml_tree = etree.parse(metadata_xml_path)
+ self._xml_tree = etree.parse(metadata_xml_path,
+ parser=etree.XMLParser(target=_MetadataTreeBuilder()))
except ImportError:
pass
@@ -208,7 +218,8 @@ class MetaDataXML(object):
if self._herdstree is None:
try:
- self._herdstree = etree.parse(self._herds_path)
+ self._herdstree = etree.parse(self._herds_path,
+ parser=etree.XMLParser(target=_MetadataTreeBuilder()))
except (ImportError, IOError, SyntaxError):
return None