1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00
systemd/tools/xml_helper.py
Zbigniew Jędrzejewski-Szmek 11a1589223 tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
2018-04-06 18:58:55 +02:00

26 lines
692 B
Python
Executable File

#!/usr/bin/env python3
# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
# SPDX-License-Identifier: LGPL-2.1+
#
# This file is part of systemd.
#
# Copyright 2012-2013 Zbigniew Jędrzejewski-Szmek
from lxml import etree as tree
class CustomResolver(tree.Resolver):
def resolve(self, url, id, context):
if 'custom-entities.ent' in url:
return self.resolve_filename('man/custom-entities.ent', context)
_parser = tree.XMLParser()
_parser.resolvers.add(CustomResolver())
def xml_parse(page):
doc = tree.parse(page, _parser)
doc.xinclude()
return doc
def xml_print(xml):
return tree.tostring(xml, pretty_print=True, encoding='utf-8')