summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>2012-05-13 00:30:46 +0200
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>2012-05-13 00:30:46 +0200
commitd5bdc1574b7ac665900cb0769af31c38fa1621c0 (patch)
treea4e8de61eadd1c0c17f3a7b65002240562ab8638
parent75ff9dea4e2bc141e53acaf7edb43f8b54fc56e5 (diff)
downloadportage-d5bdc1574b7ac665900cb0769af31c38fa1621c0.tar.gz
portage-d5bdc1574b7ac665900cb0769af31c38fa1621c0.tar.bz2
portage-d5bdc1574b7ac665900cb0769af31c38fa1621c0.zip
Check type of xml.etree.ElementTree.TreeBuilder before applying
workaround for http://bugs.python.org/issue14007.
-rw-r--r--pym/portage/__init__.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 6ca044518..745e06af7 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -44,10 +44,6 @@ except ImportError as e:
sys.stderr.write(" "+str(e)+"\n\n");
raise
-if sys.hexversion >= 0x3030000:
- # Workaround for http://bugs.python.org/issue14007
- sys.modules["_elementtree"] = None
-
try:
import portage.proxy.lazyimport
@@ -339,6 +335,16 @@ _python_interpreter = os.path.realpath(sys.executable)
_bin_path = PORTAGE_BIN_PATH
_pym_path = PORTAGE_PYM_PATH
+if sys.hexversion >= 0x3030000:
+ # Workaround for http://bugs.python.org/issue14007
+ def _test_xml_etree_ElementTree_TreeBuilder_type():
+ import subprocess
+ p = subprocess.Popen([_python_interpreter, "-c",
+ "import sys, xml.etree.ElementTree; sys.exit(not isinstance(xml.etree.ElementTree.TreeBuilder, type))"])
+ if p.wait() != 0:
+ sys.modules["_elementtree"] = None
+ _test_xml_etree_ElementTree_TreeBuilder_type()
+
def _shell_quote(s):
"""
Quote a string in double-quotes and use backslashes to