webdav-client-python
webdav-client-python copied to clipboard
lxml is not needed
Hi there,
the current package seem to require lxml, yet this module only uses the etree interface, which has a builtin C and Python implementation (xml.etree.cElementTree and xml.etree.ElementTree). As such, you could make lxml an optional dependency, which would make the webdav module way easier to setup on machines without compilers as well as Python implementations other than CPython.
The fix is straightforward: in webdav/client.py, replace
import lxml.etree as etree
with
try:
from lxml import etree
except ImportError:
try:
from xml.etree import cElementTree as etree
except ImportError:
from xml.etree import ElementTree as etree
this way, the lxml implementation is used if available; otherwise, the C implementation is used; if it's not available, the plain Python implementation is used. Then, you could remove lxml from the hard dependencies !