summaryrefslogtreecommitdiffstats
path: root/src/lib/Client
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2006-08-14 15:06:28 +0000
committerNarayan Desai <desai@mcs.anl.gov>2006-08-14 15:06:28 +0000
commite1e6ec2bce46f4588f0c1da12ff89e9cf039783c (patch)
tree1ccdf7565d6ff38b4dc311a5a7458de1eff3cf7c /src/lib/Client
parent11c1bbdb7d694a23dd7d331369c3af5f6309bd95 (diff)
downloadbcfg2-e1e6ec2bce46f4588f0c1da12ff89e9cf039783c.tar.gz
bcfg2-e1e6ec2bce46f4588f0c1da12ff89e9cf039783c.tar.bz2
bcfg2-e1e6ec2bce46f4588f0c1da12ff89e9cf039783c.zip
Add new client side XML abstraction layer
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2061 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Client')
-rw-r--r--src/lib/Client/XML.py21
-rw-r--r--src/lib/Client/__init__.py2
2 files changed, 22 insertions, 1 deletions
diff --git a/src/lib/Client/XML.py b/src/lib/Client/XML.py
new file mode 100644
index 000000000..356886558
--- /dev/null
+++ b/src/lib/Client/XML.py
@@ -0,0 +1,21 @@
+'''XML lib compatibility layer for the Bcfg2 client'''
+__revision__ = '$Revision$'
+
+# library will use lxml, then builtin xml.etree, then ElementTree
+
+try:
+ from lxml.etree import Element, SubElement, tostring
+ from lxml.etree import XMLSyntaxError as ParseError
+except ImportError:
+ # lxml not available
+ try:
+ from xml.etree.ElementTree import Element, XML, tostring
+ from xml.parsers.expat import ExpatError as ParseError
+ except ImportError:
+ try:
+ from elementtree.ElementTree import Element, XML, tostring
+ from xml.parsers.expat import ExpatError as ParseError
+ except ImportError:
+ print "Failed to load lxml, xml.etree and elementtree.ElementTree"
+ print "Cannot continue"
+ raise SystemExit, 1
diff --git a/src/lib/Client/__init__.py b/src/lib/Client/__init__.py
index bfdbc0e98..f7ba1a537 100644
--- a/src/lib/Client/__init__.py
+++ b/src/lib/Client/__init__.py
@@ -1,4 +1,4 @@
'''This contains all Bcfg2 Client modules'''
__revision__ = '$Revision$'
-__all__ = ["Proxy", "Toolset", "Debian", "Solaris", "Redhat", "Gentoo"]
+__all__ = ["Proxy", "Toolset", "Debian", "Solaris", "Redhat", "Gentoo", "XML"]