aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'portage_with_autodep/pym/portage/xml')
-rw-r--r--portage_with_autodep/pym/portage/xml/__init__.pyobin133 -> 131 bytes
-rw-r--r--portage_with_autodep/pym/portage/xml/metadata.py25
-rw-r--r--portage_with_autodep/pym/portage/xml/metadata.pyobin15298 -> 15650 bytes
3 files changed, 17 insertions, 8 deletions
diff --git a/portage_with_autodep/pym/portage/xml/__init__.pyo b/portage_with_autodep/pym/portage/xml/__init__.pyo
index 15f1b77..3c787a2 100644
--- a/portage_with_autodep/pym/portage/xml/__init__.pyo
+++ b/portage_with_autodep/pym/portage/xml/__init__.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/portage/xml/metadata.py b/portage_with_autodep/pym/portage/xml/metadata.py
index 25f801a..fcd9dc0 100644
--- a/portage_with_autodep/pym/portage/xml/metadata.py
+++ b/portage_with_autodep/pym/portage/xml/metadata.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2012 Gentoo Foundation
+# Copyright 2010-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
"""Provides an easy-to-use python interface to Gentoo's metadata.xml file.
@@ -28,6 +28,8 @@
'Thomas Mills Hinkle'
"""
+from __future__ import unicode_literals
+
__all__ = ('MetaDataXML',)
import sys
@@ -42,18 +44,23 @@ if sys.hexversion < 0x2070000 or \
else:
try:
import xml.etree.cElementTree as etree
- except (ImportError, SystemError):
+ except (SystemExit, KeyboardInterrupt):
+ raise
+ except (ImportError, SystemError, RuntimeError, Exception):
+ # broken or missing xml support
+ # http://bugs.python.org/issue14988
import xml.etree.ElementTree as etree
try:
from xml.parsers.expat import ExpatError
-except (ImportError, SystemError):
+except (SystemExit, KeyboardInterrupt):
+ raise
+except (ImportError, SystemError, RuntimeError, Exception):
ExpatError = SyntaxError
import re
import xml.etree.ElementTree
-import portage
-from portage import os, _unicode_decode
+from portage import _encodings, _unicode_encode
from portage.util import unique_everseen
class _MetadataTreeBuilder(xml.etree.ElementTree.TreeBuilder):
@@ -197,12 +204,13 @@ class MetaDataXML(object):
self._xml_tree = None
try:
- self._xml_tree = etree.parse(metadata_xml_path,
+ self._xml_tree = etree.parse(_unicode_encode(metadata_xml_path,
+ encoding=_encodings['fs'], errors='strict'),
parser=etree.XMLParser(target=_MetadataTreeBuilder()))
except ImportError:
pass
except ExpatError as e:
- raise SyntaxError(_unicode_decode("%s") % (e,))
+ raise SyntaxError("%s" % (e,))
if isinstance(herds, etree.ElementTree):
herds_etree = herds
@@ -235,7 +243,8 @@ class MetaDataXML(object):
if self._herdstree is None:
try:
- self._herdstree = etree.parse(self._herds_path,
+ self._herdstree = etree.parse(_unicode_encode(self._herds_path,
+ encoding=_encodings['fs'], errors='strict'),
parser=etree.XMLParser(target=_MetadataTreeBuilder()))
except (ImportError, IOError, SyntaxError):
return None
diff --git a/portage_with_autodep/pym/portage/xml/metadata.pyo b/portage_with_autodep/pym/portage/xml/metadata.pyo
index 0103456..4e8910e 100644
--- a/portage_with_autodep/pym/portage/xml/metadata.pyo
+++ b/portage_with_autodep/pym/portage/xml/metadata.pyo
Binary files differ