public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/repoman/, bin/, pym/portage/xml/, pym/_emerge/
@ 2012-06-04 21:59 Zac Medico
  0 siblings, 0 replies; only message in thread
From: Zac Medico @ 2012-06-04 21:59 UTC (permalink / raw
  To: gentoo-commits

commit:     ee3bf6f9773c0afbd494c657d253241f79d98044
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  4 21:59:12 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jun  4 21:59:12 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ee3bf6f9

Handle more import exceptions involving xml.

See http://bugs.python.org/issue14988

---
 bin/repoman                 |    6 +++++-
 pym/_emerge/EbuildPhase.py  |   13 +++++++++++--
 pym/portage/xml/metadata.py |   10 ++++++++--
 pym/repoman/herdbase.py     |    6 +++++-
 4 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/bin/repoman b/bin/repoman
index 052ec94..e43fa1c 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -45,7 +45,11 @@ portage.dep._internal_warnings = True
 try:
 	import xml.etree.ElementTree
 	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
 	msg = ["Please enable python's \"xml\" USE flag in order to use repoman."]
 	from portage.output import EOutput
 	out = EOutput()

diff --git a/pym/_emerge/EbuildPhase.py b/pym/_emerge/EbuildPhase.py
index 27944f4..741f608 100644
--- a/pym/_emerge/EbuildPhase.py
+++ b/pym/_emerge/EbuildPhase.py
@@ -12,7 +12,16 @@ from _emerge.MiscFunctionsProcess import MiscFunctionsProcess
 from _emerge.EbuildProcess import EbuildProcess
 from _emerge.CompositeTask import CompositeTask
 from portage.util import writemsg
-from portage.xml.metadata import MetaDataXML
+
+try:
+	from portage.xml.metadata import MetaDataXML
+except (SystemExit, KeyboardInterrupt):
+	raise
+except (ImportError, SystemError, RuntimeError, Exception):
+	# broken or missing xml support
+	# http://bugs.python.org/issue14988
+	MetaDataXML = None
+
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
 	'portage.elog:messages@elog_messages',
@@ -71,7 +80,7 @@ class EbuildPhase(CompositeTask):
 			maint_str = ""
 			upstr_str = ""
 			metadata_xml_path = os.path.join(os.path.dirname(self.settings['EBUILD']), "metadata.xml")
-			if os.path.isfile(metadata_xml_path):
+			if MetaDataXML is not None and os.path.isfile(metadata_xml_path):
 				herds_path = os.path.join(self.settings['PORTDIR'],
 					'metadata/herds.xml')
 				try:

diff --git a/pym/portage/xml/metadata.py b/pym/portage/xml/metadata.py
index 25f801a..f820e54 100644
--- a/pym/portage/xml/metadata.py
+++ b/pym/portage/xml/metadata.py
@@ -42,12 +42,18 @@ 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

diff --git a/pym/repoman/herdbase.py b/pym/repoman/herdbase.py
index 91a32cb..fcf58b3 100644
--- a/pym/repoman/herdbase.py
+++ b/pym/repoman/herdbase.py
@@ -7,7 +7,11 @@ 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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-06-04 21:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-04 21:59 [gentoo-commits] proj/portage:master commit in: pym/repoman/, bin/, pym/portage/xml/, pym/_emerge/ Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox