[libvirt] [PATCH python] Avoid generating the migrate methods in multiple classes

From: "Daniel P. Berrange" <berrange@redhat.com> The python code generator tries to figure out what class a method should be in by looking at the list of arguments for any which are object types. Unfortunately missing break statements meant that methods which have multiple object arguments (eg migrate as a virDomainPtr followed by a virConnectPtr) got added to multiple classes. The migrate methods should only be visible in the virDomain class, and the versions in the virConnect class have fubar arguments. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- generator.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generator.py b/generator.py index c769ed0..ab2a97f 100755 --- a/generator.py +++ b/generator.py @@ -1264,12 +1264,14 @@ def buildWrappers(module): func = nameFixup(name, classe, type, file) info = (0, func, name, ret, args, file, mod) function_classes[classe].append(info) + break elif name[0:3] == "vir" and len(args) >= 2 and args[1][1] == type \ and file != "python_accessor" and not name in function_skip_index_one: found = 1 func = nameFixup(name, classe, type, file) info = (1, func, name, ret, args, file, mod) function_classes[classe].append(info) + break if found == 1: continue func = nameFixup(name, "None", file, file) -- 1.8.3.1

On 11/26/2013 10:00 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
The python code generator tries to figure out what class a method should be in by looking at the list of arguments for any which are object types. Unfortunately missing break statements meant that methods which have multiple object arguments (eg migrate as a virDomainPtr followed by a virConnectPtr) got added to multiple classes. The migrate methods should only be visible in the virDomain class, and the versions in the virConnect class have fubar arguments.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- generator.py | 2 ++ 1 file changed, 2 insertions(+)
ACK. Wow - this repo split has forced us to address some long-standing bugs. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Tue, Nov 26, 2013 at 01:00:38PM -0700, Eric Blake wrote:
On 11/26/2013 10:00 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
The python code generator tries to figure out what class a method should be in by looking at the list of arguments for any which are object types. Unfortunately missing break statements meant that methods which have multiple object arguments (eg migrate as a virDomainPtr followed by a virConnectPtr) got added to multiple classes. The migrate methods should only be visible in the virDomain class, and the versions in the virConnect class have fubar arguments.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- generator.py | 2 ++ 1 file changed, 2 insertions(+)
ACK. Wow - this repo split has forced us to address some long-standing bugs.
Automated testing found to be useful :-P I found this fixed some other broken methods too, so I'm changing the commit message to this Avoid generating the methods in multiple classes The python code generator tries to figure out what class a method should be in by looking at the list of arguments for any which are object types. Unfortunately missing break statements meant that methods which have multiple object arguments (eg migrate as a virDomainPtr followed by a virConnectPtr) got added to multiple classes. The following incorrect methods are removed by this change virStream.download (dup of virStorageVol.download) virStream.screenshot (dup of virDomain.screenshot) virStream.upload (dup of virStorageVol.upload) virConnect.migrate (dup of virDomain.migrate) virConnect.migrate2 (dup of virDomain.migrate2) virConnect.migrate3 (dup of virDomain.migrate3) virConnect.migrateToURI3 (dup of virDomain.migrateToURI3) Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Daniel P. Berrange
-
Eric Blake