[libvirt] [PATCH python] Deal with old filenames for events/error functions

Daniel P. Berrange berrange at redhat.com
Wed Nov 27 11:14:14 UTC 2013


From: "Daniel P. Berrange" <berrange at redhat.com>

Older libvirt has files named 'events' and 'virterror'
rather than 'virevent' and 'virerror'. This is visible
in the API XML files. We must look for both names to
ensure we don't loose generation of methods with older
versions of libvirt.

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
 generator.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/generator.py b/generator.py
index 273efbd..cd857b4 100755
--- a/generator.py
+++ b/generator.py
@@ -113,7 +113,8 @@ class docParser(xml.sax.handler.ContentHandler):
         elif tag == 'enum':
             # enums come from header files, hence virterror.h
             if (attrs['file'] == "libvirt" or
-                attrs['file'] == "virterror"):
+                attrs['file'] == "virterror" or
+                attrs['file'] == "virerror"):
                 enum(attrs['type'],attrs['name'],attrs['value'])
             elif attrs['file'] == "libvirt-lxc":
                 lxc_enum(attrs['type'],attrs['name'],attrs['value'])
@@ -127,8 +128,10 @@ class docParser(xml.sax.handler.ContentHandler):
             # fuctions come from source files, hence 'virerror.c'
             if self.function is not None:
                 if (self.function_module == "libvirt" or
+                    self.function_module == "event" or
                     self.function_module == "virevent" or
-                    self.function_module == "virerror"):
+                    self.function_module == "virerror" or
+                    self.function_module == "virterror"):
                     function(self.function, self.function_descr,
                              self.function_return, self.function_args,
                              self.function_file, self.function_module,
-- 
1.8.3.1




More information about the libvir-list mailing list