aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'portage_with_autodep/pym/repoman/herdbase.py')
-rw-r--r--portage_with_autodep/pym/repoman/herdbase.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/portage_with_autodep/pym/repoman/herdbase.py b/portage_with_autodep/pym/repoman/herdbase.py
index 91a32cb..c5b88ff 100644
--- a/portage_with_autodep/pym/repoman/herdbase.py
+++ b/portage_with_autodep/pym/repoman/herdbase.py
@@ -1,18 +1,26 @@
# -*- coding: utf-8 -*-
# repoman: Herd database analysis
-# Copyright 2010-2012 Gentoo Foundation
+# Copyright 2010-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 or later
+from __future__ import unicode_literals
+
import errno
import xml.etree.ElementTree
try:
from xml.parsers.expat import ExpatError
-except (ImportError, SystemError):
+except (SystemExit, KeyboardInterrupt):
+ raise
+except (ImportError, SystemError, RuntimeError, Exception):
+ # broken or missing xml support
+ # http://bugs.python.org/issue14988
# This means that python is built without xml support.
# We tolerate global scope import failures for optional
# modules, so that ImportModulesTestCase can succeed (or
# possibly alert us about unexpected import failures).
pass
+
+from portage import _encodings, _unicode_encode
from portage.exception import FileNotFound, ParseError, PermissionDenied
__all__ = [
@@ -52,11 +60,12 @@ def make_herd_base(filename):
all_emails = set()
try:
- xml_tree = xml.etree.ElementTree.parse(filename,
+ xml_tree = xml.etree.ElementTree.parse(_unicode_encode(filename,
+ encoding=_encodings['fs'], errors='strict'),
parser=xml.etree.ElementTree.XMLParser(
target=_HerdsTreeBuilder()))
except ExpatError as e:
- raise ParseError("metadata.xml: " + str(e))
+ raise ParseError("metadata.xml: %s" % (e,))
except EnvironmentError as e:
func_call = "open('%s')" % filename
if e.errno == errno.EACCES: