From 14ffb5c29f748114dd529d0c20e3c5fe6d953b5f Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 8 Aug 2010 20:43:16 -0700 Subject: [PATCH] Detect if python xml support is enabled and bail out with an appropriate when necessary. --- bin/repoman | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/bin/repoman b/bin/repoman index 9f64701b8..0115c2885 100755 --- a/bin/repoman +++ b/bin/repoman @@ -21,8 +21,6 @@ import sys import tempfile import time import platform -import xml.etree.ElementTree -from xml.parsers.expat import ExpatError try: from urllib.request import urlopen as urllib_request_urlopen @@ -32,9 +30,6 @@ except ImportError: from itertools import chain from stat import S_ISDIR -if not hasattr(__builtins__, "set"): - from sets import Set as set - try: import portage except ImportError: @@ -42,6 +37,18 @@ except ImportError: sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) import portage portage._disable_legacy_globals() + +try: + import xml.etree.ElementTree + from xml.parsers.expat import ExpatError +except ImportError: + msg = ["Please enable python's \"xml\" USE flag in order to use repoman."] + from portage.output import EOutput + out = EOutput() + for line in msg: + out.eerror(line) + sys.exit(1) + from portage import os from portage import subprocess_getstatusoutput from portage import _encodings -- 2.26.2