On 11/27/2013 04:14 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange(a)redhat.com>
If the libvirt-override-virXXXX.py file has methods which call
C APIs that don't exist in the version of libvirt built against
we need to skip copying their code.
eg for 0.9.13 libvirt we should not copy the 'listAllDomains'
method.
The way this works is that it breaks the override file into
individual methods by looking for ' def '. It then collects
the contents until the next method start, whereupon it looks
for a libvirtmod.XXXXXX API call. It checks if the XXXXX part
is present in the XML description we have, and if not, it
discards the entire method.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
generator.py | 42 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 41 insertions(+), 1 deletion(-)
I see this got committed prior to the release (good); but never reviewed...
My python is weak, so I only spotted something on the surface:
+ if offset != -1:
+ func = line[offset + 11:]
+ offset = func.find("(")
+ func = func[0:offset]
+ if func not in functions_skipped:
+ return True
+ return False
+
+ for line in extra.readlines():
+ offset = line.find(" def ")
+ if offset != -1:
+ name = line[offset+5:]
Inconsistent spacing around '+'
Other than that, I assume it works, so belated ack :)
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org