mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
since some distros strip xml out of python we should treat it as (#35538)
an optional dep
This commit is contained in:
parent
e2bd575461
commit
5cbd5eb10f
@ -14,6 +14,7 @@ import subprocess
|
||||
from salt.ext.six import binary_type, string_types, text_type
|
||||
from salt.ext.six.moves import cStringIO, StringIO
|
||||
|
||||
HAS_XML = True
|
||||
try:
|
||||
# Python >2.5
|
||||
import xml.etree.cElementTree as ElementTree
|
||||
@ -30,7 +31,8 @@ except Exception:
|
||||
# normal ElementTree install
|
||||
import elementtree.ElementTree as ElementTree
|
||||
except Exception:
|
||||
raise
|
||||
ElementTree = None
|
||||
HAS_XML = False
|
||||
|
||||
|
||||
# True if we are running on Python 3.
|
||||
@ -44,14 +46,15 @@ else:
|
||||
import exceptions
|
||||
|
||||
|
||||
if not hasattr(ElementTree, 'ParseError'):
|
||||
class ParseError(Exception):
|
||||
'''
|
||||
older versions of ElementTree do not have ParseError
|
||||
'''
|
||||
pass
|
||||
if HAS_XML:
|
||||
if not hasattr(ElementTree, 'ParseError'):
|
||||
class ParseError(Exception):
|
||||
'''
|
||||
older versions of ElementTree do not have ParseError
|
||||
'''
|
||||
pass
|
||||
|
||||
ElementTree.ParseError = ParseError
|
||||
ElementTree.ParseError = ParseError
|
||||
|
||||
|
||||
def text_(s, encoding='latin-1', errors='strict'):
|
||||
|
Loading…
Reference in New Issue
Block a user