]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
apibuild: Fix errors on python3
authorCole Robinson <crobinso@redhat.com>
Fri, 16 Mar 2018 17:47:36 +0000 (13:47 -0400)
committerCole Robinson <crobinso@redhat.com>
Fri, 16 Mar 2018 19:07:18 +0000 (15:07 -0400)
Module 'string' function lower doesn't exist in python3. The canonical
way is to call .lower() on a str instance. Do that, and make the
exception handling more specific, which would have made this issue
obvious.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
docs/apibuild.py

index 67b7eed1e6ea21bcd20ad4ce46f4067ad79e41bf..e81980e3c367d9a41853e5c480583af4f1a6c0e1 100755 (executable)
@@ -2326,10 +2326,10 @@ class docBuilder:
             for data in ('Summary', 'Description', 'Author'):
                 try:
                     output.write("     <%s>%s</%s>\n" % (
-                                 string.lower(data),
+                                 data.lower(),
                                  escape(dict.info[data]),
-                                 string.lower(data)))
-                except:
+                                 data.lower()))
+                except KeyError:
                     self.warning("Header %s lacks a %s description" % (module, data))
             if 'Description' in dict.info:
                 desc = dict.info['Description']