mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-08-03 08:21:58 +03:00
Fix code for avoiding overrides of non-existant functions
When reading/writing a global variable from inside a method it must be declared as a global, otherwise a local variable by the same name will be used. Special case the virConnectListDomainsID method which is bizarrely renamed for no obvious reason. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
@ -187,16 +187,21 @@ class docParser(xml.sax.handler.ContentHandler):
|
|||||||
|
|
||||||
|
|
||||||
def function(name, desc, ret, args, file, module, cond):
|
def function(name, desc, ret, args, file, module, cond):
|
||||||
|
global onlyOverrides
|
||||||
if onlyOverrides and name not in functions:
|
if onlyOverrides and name not in functions:
|
||||||
return
|
return
|
||||||
|
if name == "virConnectListDomains":
|
||||||
|
name = "virConnectListDomainsID"
|
||||||
functions[name] = (desc, ret, args, file, module, cond)
|
functions[name] = (desc, ret, args, file, module, cond)
|
||||||
|
|
||||||
def qemu_function(name, desc, ret, args, file, module, cond):
|
def qemu_function(name, desc, ret, args, file, module, cond):
|
||||||
|
global onlyOverrides
|
||||||
if onlyOverrides and name not in qemu_functions:
|
if onlyOverrides and name not in qemu_functions:
|
||||||
return
|
return
|
||||||
qemu_functions[name] = (desc, ret, args, file, module, cond)
|
qemu_functions[name] = (desc, ret, args, file, module, cond)
|
||||||
|
|
||||||
def lxc_function(name, desc, ret, args, file, module, cond):
|
def lxc_function(name, desc, ret, args, file, module, cond):
|
||||||
|
global onlyOverrides
|
||||||
if onlyOverrides and name not in lxc_functions:
|
if onlyOverrides and name not in lxc_functions:
|
||||||
return
|
return
|
||||||
lxc_functions[name] = (desc, ret, args, file, module, cond)
|
lxc_functions[name] = (desc, ret, args, file, module, cond)
|
||||||
@ -786,6 +791,7 @@ def buildStubs(module, api_xml):
|
|||||||
global py_types
|
global py_types
|
||||||
global py_return_types
|
global py_return_types
|
||||||
global unknown_types
|
global unknown_types
|
||||||
|
global onlyOverrides
|
||||||
|
|
||||||
if module not in ["libvirt", "libvirt-qemu", "libvirt-lxc"]:
|
if module not in ["libvirt", "libvirt-qemu", "libvirt-lxc"]:
|
||||||
print "ERROR: Unknown module type: %s" % module
|
print "ERROR: Unknown module type: %s" % module
|
||||||
|
Reference in New Issue
Block a user