diff options
Diffstat (limited to 'generator.py')
-rwxr-xr-x | generator.py | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/generator.py b/generator.py index 005ac07..af44cae 100755 --- a/generator.py +++ b/generator.py @@ -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 |