diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-08-08 20:43:16 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-08-08 20:43:16 -0700 |
commit | 14ffb5c29f748114dd529d0c20e3c5fe6d953b5f (patch) | |
tree | 3b3f327d24a4280a114d80bac88869d60c060e04 | |
parent | 2b37a784ac960d8a0ebe77cba37c1e8ca9f10c54 (diff) | |
download | portage-14ffb5c29f748114dd529d0c20e3c5fe6d953b5f.tar.gz portage-14ffb5c29f748114dd529d0c20e3c5fe6d953b5f.tar.bz2 portage-14ffb5c29f748114dd529d0c20e3c5fe6d953b5f.zip |
Detect if python xml support is enabled and bail out with an
appropriate when necessary.
-rwxr-xr-x | bin/repoman | 17 |
1 files 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 |