From d162c769b4990648f5a8075bd57b186cbbfbba0c Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Tue, 2 Jul 2019 12:12:06 +0200 Subject: [PATCH] Use built in eTree implementation instead of lxml --- boxes/svgutil.py | 9 ++++----- scripts/Dockerfile | 2 +- setup.py | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/boxes/svgutil.py b/boxes/svgutil.py index c0af9c5..925c7b0 100755 --- a/boxes/svgutil.py +++ b/boxes/svgutil.py @@ -134,12 +134,11 @@ def ticksPerMM(tree): return x2/width, y2/height def svgMerge(box, inkscape, output): - from lxml import etree as et - parser = et.XMLParser(remove_blank_text=True) + parser = ElementTree.XMLParser(remove_blank_text=True) - src_tree = et.parse(box, parser) - dest_tree = et.parse(inkscape, parser) + src_tree = ElementTree.parse(box, parser) + dest_tree = ElementTree.parse(inkscape, parser) dest_root = dest_tree.getroot() src_width, src_height = getSizeInMM(src_tree) @@ -164,7 +163,7 @@ def svgMerge(box, inkscape, output): scale_x, scale_y, off_x, off_y)) # write the xml file - et.ElementTree(dest_root).write(output, pretty_print=True, encoding='utf-8', xml_declaration=True) + ElementTree.ElementTree(dest_root).write(output, pretty_print=True, encoding='utf-8', xml_declaration=True) if __name__ == "__main__": svg = SVGFile("examples/box.svg") diff --git a/scripts/Dockerfile b/scripts/Dockerfile index 00b8918..1d657ee 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -14,7 +14,7 @@ FROM fedora:latest # Install requirements -RUN dnf install -y python3-cairocffi python3-xcffib git-core python3-markdown python3-lxml python3-setuptools pstoedit +RUN dnf install -y python3-cairocffi python3-xcffib git-core python3-markdown python3-setuptools pstoedit # Get Boxes.py sources to /boxes RUN git clone --depth 1 -b master https://github.com/florianfesti/boxes.git diff --git a/setup.py b/setup.py index c5888a3..8ce374e 100755 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ setup( author_email='florian@festi.info', url='https://github.com/florianfesti/boxes', packages=find_packages(), - install_requires=['cairocffi==0.8.0', 'markdown', 'lxml'], + install_requires=['cairocffi==0.8.0', 'markdown'], scripts=['scripts/boxes', 'scripts/boxesserver'], cmdclass={ 'build_py': CustomBuildExtCommand,