]> xenbits.xensource.com Git - libvirt.git/commitdiff
apibuild: Fix -refs.xml building
authorCole Robinson <crobinso@redhat.com>
Fri, 16 Mar 2018 17:49:58 +0000 (13:49 -0400)
committerCole Robinson <crobinso@redhat.com>
Fri, 16 Mar 2018 19:07:23 +0000 (15:07 -0400)
Another usage of deprecated 'string' functions. We are just trying to
match ascii letters here, so use a simple regex. And again drop the
aggressive exception handling, it doesn't seem to trigger for anything
in libvirt code.

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

index e81980e3c367d9a41853e5c480583af4f1a6c0e1..51abf83832bb46671b0e5db269218a6ba2854308 100755 (executable)
@@ -11,7 +11,6 @@
 from __future__ import print_function
 
 import os, sys
-import string
 import glob
 import re
 
@@ -2092,23 +2091,20 @@ class docBuilder:
         str = str.replace(';', ' ')
         tokens = str.split()
         for token in tokens:
-            try:
-                c = token[0]
-                if string.letters.find(c) < 0:
-                    pass
-                elif len(token) < 3:
+            c = token[0]
+            if not re.match(r"[a-zA-Z]", c):
+                pass
+            elif len(token) < 3:
+                pass
+            else:
+                lower = token.lower()
+                # TODO: generalize this a bit
+                if lower == 'and' or lower == 'the':
                     pass
+                elif token in self.xref:
+                    self.xref[token].append(id)
                 else:
-                    lower = string.lower(token)
-                    # TODO: generalize this a bit
-                    if lower == 'and' or lower == 'the':
-                        pass
-                    elif token in self.xref:
-                        self.xref[token].append(id)
-                    else:
-                        self.xref[token] = [id]
-            except:
-                pass
+                    self.xref[token] = [id]
 
     def analyze(self):
         if not quiet: