[libvirt] [PATCH python] fix libvirt headers list

Since libvirt.h has been splitted out, generator.py should be fixed accordingly. So add full list of header files. Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com> --- generator.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/generator.py b/generator.py index 01ab441..5ecbed5 100755 --- a/generator.py +++ b/generator.py @@ -29,6 +29,19 @@ import xml.sax debug = 0 onlyOverrides = False +libvirt_headers = ["libvirt", + "libvirt-domain", + "libvirt-domain-snapshot", + "libvirt-event", + "libvirt-host", + "libvirt-interface", + "libvirt-network", + "libvirt-nodedev", + "libvirt-nwfilter", + "libvirt-secret", + "libvirt-storage", + "libvirt-stream",] + def getparser(): # Attach parser to an unmarshalling object. return both objects. target = docParser() @@ -112,9 +125,7 @@ class docParser(xml.sax.handler.ContentHandler): self.function_return_field = attrs['field'] elif tag == 'enum': # enums come from header files, hence virterror.h - if (attrs['file'] == "libvirt" or - attrs['file'] == "virterror" or - attrs['file'] == "virerror"): + if attrs['file'] in libvirt_headers + ["virerror", "virterror"]: enum(attrs['type'],attrs['name'],attrs['value']) elif attrs['file'] == "libvirt-lxc": lxc_enum(attrs['type'],attrs['name'],attrs['value']) @@ -127,11 +138,8 @@ class docParser(xml.sax.handler.ContentHandler): if tag == 'function': # 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" or - self.function_module == "virterror"): + if self.function_module in libvirt_headers + \ + ["event", "virevent", "virerror", "virterror"]: function(self.function, self.function_descr, self.function_return, self.function_args, self.function_file, self.function_module, -- 1.9.3

On 10/28/2014 10:58 AM, Dmitry Guryanov wrote:
Since libvirt.h has been splitted out, generator.py
s/splitted/split/
should be fixed accordingly. So add full list of header files.
Does this still work when targetting older libvirt prior to the header split? If so, then ACK.
+libvirt_headers = ["libvirt", + "libvirt-domain", + "libvirt-domain-snapshot", + "libvirt-event", + "libvirt-host", + "libvirt-interface", + "libvirt-network", + "libvirt-nodedev", + "libvirt-nwfilter", + "libvirt-secret", + "libvirt-storage", + "libvirt-stream",]
Might be worth putting the ] on its own line; then, if we add new files in the future, it will be a one line addition instead of having to modify an existing line. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Tuesday 28 October 2014 11:15:20 Eric Blake wrote:
On 10/28/2014 10:58 AM, Dmitry Guryanov wrote:
Since libvirt.h has been splitted out, generator.py
s/splitted/split/
should be fixed accordingly. So add full list of header files.
Does this still work when targetting older libvirt prior to the header split? If so, then ACK.
Yes, it works, because "libvirt" is in the list.
+libvirt_headers = ["libvirt", + "libvirt-domain", + "libvirt-domain-snapshot", + "libvirt-event", + "libvirt-host", + "libvirt-interface", + "libvirt-network", + "libvirt-nodedev", + "libvirt-nwfilter", + "libvirt-secret", + "libvirt-storage", + "libvirt-stream",]
Might be worth putting the ] on its own line; then, if we add new files in the future, it will be a one line addition instead of having to modify an existing line.
OK, I'll resend the patch. -- Dmitry Guryanov

On 10/28/2014 11:30 AM, Dmitry Guryanov wrote:
On Tuesday 28 October 2014 11:15:20 Eric Blake wrote:
On 10/28/2014 10:58 AM, Dmitry Guryanov wrote:
Since libvirt.h has been splitted out, generator.py
s/splitted/split/
should be fixed accordingly. So add full list of header files.
Does this still work when targetting older libvirt prior to the header split? If so, then ACK.
Yes, it works, because "libvirt" is in the list.
I was more worried that it didn't gripe about missing files. But re-reading the patch, it's always a membership lookup (is file in list) and not a coverage (have we visisted all files in the list), so I agree we are okay. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (2)
-
Dmitry Guryanov
-
Eric Blake