diff options
Diffstat (limited to 'doc/gen_pkgdiff.py')
-rw-r--r-- | doc/gen_pkgdiff.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/doc/gen_pkgdiff.py b/doc/gen_pkgdiff.py index acfbadc..7dd8c73 100644 --- a/doc/gen_pkgdiff.py +++ b/doc/gen_pkgdiff.py | |||
@@ -12,7 +12,8 @@ | |||
12 | # | 12 | # |
13 | # Note that packages with the unchanged version is not listed. | 13 | # Note that packages with the unchanged version is not listed. |
14 | # | 14 | # |
15 | # The output is presented as XML code printed to stdout. | 15 | # The output is presented as XML code printed to stdout. A summary is printed |
16 | # to STDERR at the end. | ||
16 | # | 17 | # |
17 | ############################################################################### | 18 | ############################################################################### |
18 | 19 | ||
@@ -22,11 +23,18 @@ import xml.etree.ElementTree as ET | |||
22 | 23 | ||
23 | def get_pkgs(file_spec): | 24 | def get_pkgs(file_spec): |
24 | if file_spec.find(":") >= 0: | 25 | if file_spec.find(":") >= 0: |
25 | cmd = ("git", "show", file_spec) | 26 | s = subprocess.check_output(("git", "show", file_spec)) |
26 | root = ET.fromstring(subprocess.check_output(cmd)) | ||
27 | |||
28 | else: | 27 | else: |
29 | root = ET.parse(file_spec) | 28 | f = open(file_spec) |
29 | s = f.read() | ||
30 | f.close() | ||
31 | del f | ||
32 | |||
33 | # ET can't handle some special quotes | ||
34 | for old, new in (("”", """), ("”", """)): | ||
35 | s = s.replace(old, new) | ||
36 | |||
37 | root = ET.fromstring(s) | ||
30 | 38 | ||
31 | for node in root.iter("section"): | 39 | for node in root.iter("section"): |
32 | if "id" in node.attrib: | 40 | if "id" in node.attrib: |