summaryrefslogtreecommitdiffstats
path: root/generator.py
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2008-01-21 15:55:53 +0000
committerDaniel P. Berrange <berrange@redhat.com>2008-01-21 15:55:53 +0000
commit56edce6413665a5b5184a27dbd836c5a735fb099 (patch)
treedd1c659945f91d18f4aa0071caf6fc6e70973d9c /generator.py
parente439de2b2dc5ea9bc0b680e70ec9616703a914f5 (diff)
downloadlibvirt-python-split-56edce6413665a5b5184a27dbd836c5a735fb099.tar.gz
libvirt-python-split-56edce6413665a5b5184a27dbd836c5a735fb099.tar.xz
libvirt-python-split-56edce6413665a5b5184a27dbd836c5a735fb099.zip
Make python generator fail build on any missing APIs
Diffstat (limited to 'generator.py')
-rwxr-xr-xgenerator.py50
1 files changed, 33 insertions, 17 deletions
diff --git a/generator.py b/generator.py
index 0b546c1..7625a93 100755
--- a/generator.py
+++ b/generator.py
@@ -212,7 +212,7 @@ skipped_modules = {
}
skipped_types = {
- 'int *': "usually a return type",
+# 'int *': "usually a return type",
}
#######################################################################
@@ -277,6 +277,8 @@ skip_impl = (
'virDomainLookupByUUID',
'virNetworkGetUUID',
'virNetworkLookupByUUID',
+ 'virDomainGetAutostart',
+ 'virNetworkGetAutostart',
'virDomainBlockStats',
'virDomainInterfaceStats',
'virNodeGetCellsFreeMemory',
@@ -287,18 +289,23 @@ skip_impl = (
'virDomainPinVcpu',
)
-def skip_function(name):
- if name == "virConnectClose":
- return 1
- if name == "virDomainFree":
- return 1
- if name == "virNetworkFree":
- return 1
- if name == "vshRunConsole":
- return 1
- if name == "virGetVersion":
- return 1
- return 0
+
+# These are functions which the generator skips completly - no python
+# or C code is generated. Generally should not be used for any more
+# functions than those already listed
+skip_function = (
+ 'virConnectListDomains', # Python API is called virConectListDomainsID for unknown reasons
+ 'virConnSetErrorFunc', # Not used in Python API XXX is this a bug ?
+ 'virResetError', # Not used in Python API XXX is this a bug ?
+ 'virConnectGetVersion', # Not used in Python API XXX is this a bug ?
+ 'virGetVersion', # Python C code is manually written
+ 'virSetErrorFunc', # Python API is called virRegisterErrorHandler for unknown reasons
+ 'virConnCopyLastError', # Python API is called virConnGetLastError instead
+ 'virCopyLastError', # Python API is called virGetLastError instead
+ 'virConnectOpenAuth', # Python C code is manually written
+ 'virDefaultErrorFunc', # Python virErrorFuncHandler impl calls this from C
+)
+
def print_function_wrapper(name, output, export, include):
global py_types
@@ -314,7 +321,7 @@ def print_function_wrapper(name, output, export, include):
if skipped_modules.has_key(file):
return 0
- if skip_function(name) == 1:
+ if name in skip_function:
return 0
if name in skip_impl:
# Don't delete the function entry in the caller.
@@ -527,13 +534,20 @@ def buildStubs():
export.close()
wrapper.close()
- print "Generated %d wrapper functions, %d failed, %d skipped\n" % (nb_wrap,
- failed, skipped);
+ print "Generated %d wrapper functions" % nb_wrap
+
print "Missing type converters: "
for type in unknown_types.keys():
print "%s:%d " % (type, len(unknown_types[type])),
print
+ for f in functions_failed:
+ print "ERROR: failed %s" % f
+
+ if failed > 0:
+ return -1
+ return 0
+
#######################################################################
#
# This part writes part of the Python front-end classes based on
@@ -1126,5 +1140,7 @@ def buildWrappers():
txt.close()
classes.close()
-buildStubs()
+if buildStubs() < 0:
+ sys.exit(1)
buildWrappers()
+sys.exit(0)