1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-08-02 04:21:59 +03:00

* TODO: updated

* python/Makefile.am python/generator.py python/libvir.c
  python/libvir.py: improved python binding, raise exception
  when an instance creation or lookup fails, and add support
  for the global error handler, per conn handler still needed
* python/tests/error.py python/tests/Makefile.am: adding a
  regression test
Daniel
This commit is contained in:
Daniel Veillard
2006-02-28 12:17:00 +00:00
parent 8a85b2bf23
commit 9600409e58
6 changed files with 186 additions and 15 deletions

View File

@ -251,7 +251,7 @@ foreign_encoding_args = (
#######################################################################
#
# This part writes the C <-> Python stubs libxml2-py.[ch] and
# This part writes the C <-> Python stubs libvirt2-py.[ch] and
# the table libxml2-export.c to add when registrering the Python module
#
#######################################################################
@ -691,17 +691,7 @@ def buildWrappers():
info = (0, func, name, ret, args, file)
function_classes['None'].append(info)
classes = open("libvirt.py", "w")
classes.write("""#!/usr/bin/python -u
#
# Those are the autogenerated Python bindings for libvirt.
# Check python/generator.py in the source distribution of libvirt
# to find out more about the generation process
#
""")
classes.write("import libvirtmod\n")
classes.write("import types\n\n")
classes = open("libvirtclass.py", "w")
txt = open("libvirtclass.txt", "w")
txt.write(" Generated Classes for libvir-python\n\n")
@ -754,7 +744,12 @@ def buildWrappers():
# Raise an exception
#
if functions_noexcept.has_key(name):
classes.write(" if ret is None:return None\n");
classes.write(" if ret is None:return None\n");
else:
classes.write(
" if ret is None:raise libvirtError('%s() failed')\n" %
(name))
classes.write(" return ");
classes.write(classes_type[ret[0]][1] % ("ret"));
classes.write("\n");
@ -867,6 +862,10 @@ def buildWrappers():
if functions_noexcept.has_key(name):
classes.write(
" if ret is None:return None\n");
else:
classes.write(
" if ret is None:raise libvirtError('%s() failed')\n" %
(name))
#
# generate the returned class wrapper for the object