summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-12-31 19:09:11 -0800
committerZac Medico <zmedico@gentoo.org>2010-12-31 19:09:11 -0800
commita7d1c59271ce3a8af5bab5324d1ccd76b54d9a33 (patch)
treea1a49593b7837b6f82086dd0839ddb6e277f3fa2
parentd987c6bb00c7320e6227bc89f8bc4e157c3ce940 (diff)
downloadportage-a7d1c59271ce3a8af5bab5324d1ccd76b54d9a33.tar.gz
portage-a7d1c59271ce3a8af5bab5324d1ccd76b54d9a33.tar.bz2
portage-a7d1c59271ce3a8af5bab5324d1ccd76b54d9a33.zip
egencache: handle ImportError for ExpatError
-rwxr-xr-xbin/egencache15
1 files changed, 10 insertions, 5 deletions
diff --git a/bin/egencache b/bin/egencache
index e0834a4ad..c01ced058 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -45,12 +45,16 @@ from portage.dep import Atom, isjustname
from portage.versions import pkgcmp, pkgsplit, vercmp
try:
- import xml.etree.ElementTree
+ from xml.etree import ElementTree
except ImportError:
pass
else:
- from repoman.utilities import parse_metadata_use
- from xml.parsers.expat import ExpatError
+ try:
+ from xml.parsers.expat import ExpatError
+ except ImportError:
+ pass
+ else:
+ from repoman.utilities import parse_metadata_use
from repoman.utilities import FindVCS
@@ -171,7 +175,8 @@ def parse_args(args):
if options.update_use_local_desc:
try:
- xml.etree.ElementTree
+ ElementTree
+ ExpatError
except NameError:
parser.error('--update-use-local-desc requires python with USE=xml!')
@@ -406,7 +411,7 @@ class GenUseLocalDesc(object):
for cp in self._portdb.cp_all():
metadata_path = os.path.join(repo_path, cp, 'metadata.xml')
try:
- metadata = xml.etree.ElementTree.parse(metadata_path)
+ metadata = ElementTree.parse(metadata_path)
except IOError:
pass
except (ExpatError, EnvironmentError) as e: