mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-26 18:41:17 +00:00
Make python generator fail build on any missing APIs
This commit is contained in:
parent
62094f72f6
commit
c9b7eae903
@ -1,3 +1,10 @@
|
||||
Mon Jan 21 10:52:04 EST 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* python/generator.py: Abort with non-zero status if any functions
|
||||
are marked as failed.
|
||||
* python/libvir.c: Don't do manual virDomainFree/virNetworkFree/
|
||||
virConnectFree since the generator creates them without issue
|
||||
|
||||
Mon Jan 21 10:39:04 EST 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* python/generator.py: mark VCPU / schedular related functions
|
||||
|
@ -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)
|
||||
|
@ -23,14 +23,6 @@ extern void initlibvirtmod(void);
|
||||
extern void initcygvirtmod(void);
|
||||
#endif
|
||||
|
||||
PyObject *libvirt_virDomainGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args);
|
||||
PyObject *libvirt_virNetworkGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args);
|
||||
PyObject *libvirt_virGetLastError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args);
|
||||
PyObject *libvirt_virConnGetLastError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args);
|
||||
PyObject * libvirt_virDomainBlockStats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args);
|
||||
PyObject * libvirt_virDomainInterfaceStats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args);
|
||||
PyObject * libvirt_virNodeGetCellsFreeMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args);
|
||||
|
||||
/* The two-statement sequence "Py_INCREF(Py_None); return Py_None;"
|
||||
is so common that we encapsulate it here. Now, each use is simply
|
||||
return VIR_PY_NONE; */
|
||||
@ -42,7 +34,7 @@ PyObject * libvirt_virNodeGetCellsFreeMemory(PyObject *self ATTRIBUTE_UNUSED, Py
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
PyObject *
|
||||
static PyObject *
|
||||
libvirt_virDomainBlockStats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||
virDomainPtr domain;
|
||||
PyObject *pyobj_domain;
|
||||
@ -71,7 +63,7 @@ libvirt_virDomainBlockStats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||
return(info);
|
||||
}
|
||||
|
||||
PyObject *
|
||||
static PyObject *
|
||||
libvirt_virDomainInterfaceStats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||
virDomainPtr domain;
|
||||
PyObject *pyobj_domain;
|
||||
@ -424,7 +416,7 @@ libvirt_virDomainPinVcpu(PyObject *self ATTRIBUTE_UNUSED,
|
||||
static PyObject *libvirt_virPythonErrorFuncHandler = NULL;
|
||||
static PyObject *libvirt_virPythonErrorFuncCtxt = NULL;
|
||||
|
||||
PyObject *
|
||||
static PyObject *
|
||||
libvirt_virGetLastError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED)
|
||||
{
|
||||
virError err;
|
||||
@ -448,7 +440,7 @@ libvirt_virGetLastError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUT
|
||||
return info;
|
||||
}
|
||||
|
||||
PyObject *
|
||||
static PyObject *
|
||||
libvirt_virConnGetLastError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
||||
{
|
||||
virError err;
|
||||
@ -716,41 +708,6 @@ libvirt_virGetVersion (PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
||||
return Py_BuildValue ((char *) "kk", libVer, typeVer);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
libvirt_virDomainFree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||
PyObject *py_retval;
|
||||
int c_retval;
|
||||
virDomainPtr domain;
|
||||
PyObject *pyobj_domain;
|
||||
|
||||
if (!PyArg_ParseTuple(args, (char *)"O:virDomainFree", &pyobj_domain))
|
||||
return(NULL);
|
||||
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
|
||||
|
||||
LIBVIRT_BEGIN_ALLOW_THREADS;
|
||||
c_retval = virDomainFree(domain);
|
||||
LIBVIRT_END_ALLOW_THREADS;
|
||||
py_retval = libvirt_intWrap((int) c_retval);
|
||||
return(py_retval);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
libvirt_virConnectClose(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||
PyObject *py_retval;
|
||||
int c_retval;
|
||||
virConnectPtr conn;
|
||||
PyObject *pyobj_conn;
|
||||
|
||||
if (!PyArg_ParseTuple(args, (char *)"O:virConnectClose", &pyobj_conn))
|
||||
return(NULL);
|
||||
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
|
||||
|
||||
LIBVIRT_BEGIN_ALLOW_THREADS;
|
||||
c_retval = virConnectClose(conn);
|
||||
LIBVIRT_END_ALLOW_THREADS;
|
||||
py_retval = libvirt_intWrap((int) c_retval);
|
||||
return(py_retval);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
libvirt_virConnectListDomainsID(PyObject *self ATTRIBUTE_UNUSED,
|
||||
@ -874,7 +831,7 @@ libvirt_virNodeGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||
return(py_retval);
|
||||
}
|
||||
|
||||
PyObject *
|
||||
static PyObject *
|
||||
libvirt_virDomainGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||
PyObject *py_retval;
|
||||
unsigned char uuid[VIR_UUID_BUFLEN];
|
||||
@ -923,25 +880,6 @@ libvirt_virDomainLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||
}
|
||||
|
||||
|
||||
static PyObject *
|
||||
libvirt_virNetworkFree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||
PyObject *py_retval;
|
||||
int c_retval;
|
||||
virNetworkPtr domain;
|
||||
PyObject *pyobj_domain;
|
||||
|
||||
if (!PyArg_ParseTuple(args, (char *)"O:virNetworkFree", &pyobj_domain))
|
||||
return(NULL);
|
||||
domain = (virNetworkPtr) PyvirNetwork_Get(pyobj_domain);
|
||||
|
||||
LIBVIRT_BEGIN_ALLOW_THREADS;
|
||||
c_retval = virNetworkFree(domain);
|
||||
LIBVIRT_END_ALLOW_THREADS;
|
||||
py_retval = libvirt_intWrap((int) c_retval);
|
||||
return(py_retval);
|
||||
}
|
||||
|
||||
|
||||
static PyObject *
|
||||
libvirt_virConnectListNetworks(PyObject *self ATTRIBUTE_UNUSED,
|
||||
PyObject *args) {
|
||||
@ -1026,7 +964,7 @@ libvirt_virConnectListDefinedNetworks(PyObject *self ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
|
||||
PyObject *
|
||||
static PyObject *
|
||||
libvirt_virNetworkGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||
PyObject *py_retval;
|
||||
unsigned char uuid[VIR_UUID_BUFLEN];
|
||||
@ -1075,7 +1013,7 @@ libvirt_virNetworkLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
||||
}
|
||||
|
||||
|
||||
PyObject *
|
||||
static PyObject *
|
||||
libvirt_virDomainGetAutostart(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||
PyObject *py_retval;
|
||||
int c_retval, autostart;
|
||||
@ -1098,7 +1036,7 @@ libvirt_virDomainGetAutostart(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||
}
|
||||
|
||||
|
||||
PyObject *
|
||||
static PyObject *
|
||||
libvirt_virNetworkGetAutostart(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||
PyObject *py_retval;
|
||||
int c_retval, autostart;
|
||||
@ -1120,8 +1058,8 @@ libvirt_virNetworkGetAutostart(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
||||
return(py_retval);
|
||||
}
|
||||
|
||||
PyObject * libvirt_virNodeGetCellsFreeMemory(PyObject *self ATTRIBUTE_UNUSED,
|
||||
PyObject *args)
|
||||
static PyObject *
|
||||
libvirt_virNodeGetCellsFreeMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
||||
{
|
||||
PyObject *py_retval;
|
||||
PyObject *pyobj_conn;
|
||||
@ -1167,9 +1105,7 @@ error:
|
||||
static PyMethodDef libvirtMethods[] = {
|
||||
#include "libvirt-export.c"
|
||||
{(char *) "virGetVersion", libvirt_virGetVersion, METH_VARARGS, NULL},
|
||||
{(char *) "virDomainFree", libvirt_virDomainFree, METH_VARARGS, NULL},
|
||||
{(char *) "virConnectOpenAuth", libvirt_virConnectOpenAuth, METH_VARARGS, NULL},
|
||||
{(char *) "virConnectClose", libvirt_virConnectClose, METH_VARARGS, NULL},
|
||||
{(char *) "virConnectListDomainsID", libvirt_virConnectListDomainsID, METH_VARARGS, NULL},
|
||||
{(char *) "virConnectListDefinedDomains", libvirt_virConnectListDefinedDomains, METH_VARARGS, NULL},
|
||||
{(char *) "virDomainGetInfo", libvirt_virDomainGetInfo, METH_VARARGS, NULL},
|
||||
@ -1179,7 +1115,6 @@ static PyMethodDef libvirtMethods[] = {
|
||||
{(char *) "virRegisterErrorHandler", libvirt_virRegisterErrorHandler, METH_VARARGS, NULL},
|
||||
{(char *) "virGetLastError", libvirt_virGetLastError, METH_VARARGS, NULL},
|
||||
{(char *) "virConnGetLastError", libvirt_virConnGetLastError, METH_VARARGS, NULL},
|
||||
{(char *) "virNetworkFree", libvirt_virNetworkFree, METH_VARARGS, NULL},
|
||||
{(char *) "virConnectListNetworks", libvirt_virConnectListNetworks, METH_VARARGS, NULL},
|
||||
{(char *) "virConnectListDefinedNetworks", libvirt_virConnectListDefinedNetworks, METH_VARARGS, NULL},
|
||||
{(char *) "virNetworkGetUUID", libvirt_virNetworkGetUUID, METH_VARARGS, NULL},
|
||||
|
Loading…
Reference in New Issue
Block a user