diff options
-rwxr-xr-x | bin/xml_sanitize | 46 | ||||
-rw-r--r-- | po/POTFILES.in | 1 | ||||
-rw-r--r-- | units/info/jobs.pxu | 2 |
3 files changed, 1 insertions, 48 deletions
diff --git a/bin/xml_sanitize b/bin/xml_sanitize deleted file mode 100755 index 7d43b83..0000000 --- a/bin/xml_sanitize +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python3 -import errno -import io -import sys - -from argparse import ArgumentParser, FileType - -VALID_XML_CHARS = frozenset([0x9, 0xA, 0xD] + - list(range(0x20, 0xD7FF)) + - list(range(0xE000, 0xFFFD)) + - list(range(0x10000, 0x10FFFF))) - - -def is_valid_xml_char(ch): - # Is this character valid in XML? - # http://www.w3.org/TR/xml/#charsets - return ord(ch) in VALID_XML_CHARS - - -def main(): - parser = ArgumentParser("Receives as input some text and outputs " - "the same text without characters which are " - "not valid in the XML specification.") - parser.add_argument('input_file', - type=FileType('r'), - nargs='?', - help='The name of the file to sanitize.') - args = parser.parse_args() - - if args.input_file: - text = ''.join([c for c in args.input_file.read() if - is_valid_xml_char(c)]) - - else: - with io.TextIOWrapper( - sys.stdin.buffer, encoding='UTF-8', errors="ignore") as stdin: - text = ''.join([c for c in stdin.read() if is_valid_xml_char(c)]) - - print(text) - -if __name__ == "__main__": - try: - sys.exit(main()) - except Exception as err: - if err.errno != errno.EPIPE: - raise(err) diff --git a/po/POTFILES.in b/po/POTFILES.in index faace3d..7d289d8 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -141,7 +141,6 @@ bin/tomcat_test [type: gettext/python] bin/window_test bin/wireless_ext bin/xen_test -[type: gettext/python] bin/xml_sanitize [type: gettext/python] bin/xrandr_cycle [type: gettext/python] manage.py src/clocktest.c diff --git a/units/info/jobs.pxu b/units/info/jobs.pxu index b881543..2e21195 100644 --- a/units/info/jobs.pxu +++ b/units/info/jobs.pxu @@ -176,7 +176,7 @@ requires: id: udev_attachment plugin: attachment category_id: com.canonical.plainbox::info -command: udevadm info --export-db | xml_sanitize +command: udevadm info --export-db estimated_duration: 1.465 _description: Attaches a dump of the udev database showing system hardware information. _summary: Attach dump of udev database |