summaryrefslogtreecommitdiff
path: root/generator.py
diff options
context:
space:
mode:
authorPhilipp Hahn <hahn@univention.de>2020-07-27 10:02:25 +0200
committerJano Tomko <jtomko@redhat.com>2020-09-01 13:26:01 +0000
commit62d99b6dadc7ac434541ae62b8eb2f96de7be968 (patch)
tree53a93b32a05809f48360f3ec150b22e20b747d3e /generator.py
parent7f021c21d6a091ca33615852d6061e75b2500f3f (diff)
downloadlibvirt-python-62d99b6dadc7ac434541ae62b8eb2f96de7be968.tar.gz
generator: Merge common code of print_function_wrapper
Signed-off-by: Philipp Hahn <hahn@univention.de>
Diffstat (limited to 'generator.py')
-rwxr-xr-xgenerator.py35
1 files changed, 15 insertions, 20 deletions
diff --git a/generator.py b/generator.py
index a138dd5..8ccc6b2 100755
--- a/generator.py
+++ b/generator.py
@@ -632,35 +632,30 @@ function_skip_index_one = {
def print_function_wrapper(module, name, output, export, include):
+ """
+ :returns: -1 on failure, 0 on skip, 1 on success.
+ """
try:
if module == "libvirt":
(desc, ret, args, file, mod, cond) = functions[name]
- if module == "libvirt-lxc":
+ skip_function2, skip_impl2 = skip_function, skip_impl
+ elif module == "libvirt-lxc":
(desc, ret, args, file, mod, cond) = lxc_functions[name]
- if module == "libvirt-qemu":
+ skip_function2, skip_impl2 = lxc_skip_function, lxc_skip_impl
+ elif module == "libvirt-qemu":
(desc, ret, args, file, mod, cond) = qemu_functions[name]
+ skip_function2, skip_impl2 = qemu_skip_function, qemu_skip_impl
+ else:
+ raise ValueError(module)
except Exception:
print("failed to get function %s infos" % name)
return -1
- if module == "libvirt":
- if name in skip_function:
- return 0
- if name in skip_impl:
- # Don't delete the function entry in the caller.
- return 1
- elif module == "libvirt-lxc":
- if name in lxc_skip_function:
- return 0
- if name in lxc_skip_impl:
- # Don't delete the function entry in the caller.
- return 1
- elif module == "libvirt-qemu":
- if name in qemu_skip_function:
- return 0
- if name in qemu_skip_impl:
- # Don't delete the function entry in the caller.
- return 1
+ if name in skip_function2:
+ return 0
+ if name in skip_impl2:
+ # Don't delete the function entry in the caller.
+ return 1
c_call = ""
format = ""