Skip to content

lxml is not needed #19

@althonos

Description

@althonos

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 !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions