Use built in eTree implementation instead of lxml

This commit is contained in:
Florian Festi 2019-07-02 12:12:06 +02:00
parent 4a9cdc8d8e
commit d162c769b4
3 changed files with 6 additions and 7 deletions

View File

@ -134,12 +134,11 @@ def ticksPerMM(tree):
return x2/width, y2/height return x2/width, y2/height
def svgMerge(box, inkscape, output): 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) src_tree = ElementTree.parse(box, parser)
dest_tree = et.parse(inkscape, parser) dest_tree = ElementTree.parse(inkscape, parser)
dest_root = dest_tree.getroot() dest_root = dest_tree.getroot()
src_width, src_height = getSizeInMM(src_tree) src_width, src_height = getSizeInMM(src_tree)
@ -164,7 +163,7 @@ def svgMerge(box, inkscape, output):
scale_x, scale_y, off_x, off_y)) scale_x, scale_y, off_x, off_y))
# write the xml file # 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__": if __name__ == "__main__":
svg = SVGFile("examples/box.svg") svg = SVGFile("examples/box.svg")

View File

@ -14,7 +14,7 @@
FROM fedora:latest FROM fedora:latest
# Install requirements # 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 # Get Boxes.py sources to /boxes
RUN git clone --depth 1 -b master https://github.com/florianfesti/boxes.git RUN git clone --depth 1 -b master https://github.com/florianfesti/boxes.git

View File

@ -43,7 +43,7 @@ setup(
author_email='florian@festi.info', author_email='florian@festi.info',
url='https://github.com/florianfesti/boxes', url='https://github.com/florianfesti/boxes',
packages=find_packages(), packages=find_packages(),
install_requires=['cairocffi==0.8.0', 'markdown', 'lxml'], install_requires=['cairocffi==0.8.0', 'markdown'],
scripts=['scripts/boxes', 'scripts/boxesserver'], scripts=['scripts/boxes', 'scripts/boxesserver'],
cmdclass={ cmdclass={
'build_py': CustomBuildExtCommand, 'build_py': CustomBuildExtCommand,