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>
|
Mon Jan 21 10:39:04 EST 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
* python/generator.py: mark VCPU / schedular related functions
|
* python/generator.py: mark VCPU / schedular related functions
|
||||||
|
@ -212,7 +212,7 @@ skipped_modules = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
skipped_types = {
|
skipped_types = {
|
||||||
'int *': "usually a return type",
|
# 'int *': "usually a return type",
|
||||||
}
|
}
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
@ -277,6 +277,8 @@ skip_impl = (
|
|||||||
'virDomainLookupByUUID',
|
'virDomainLookupByUUID',
|
||||||
'virNetworkGetUUID',
|
'virNetworkGetUUID',
|
||||||
'virNetworkLookupByUUID',
|
'virNetworkLookupByUUID',
|
||||||
|
'virDomainGetAutostart',
|
||||||
|
'virNetworkGetAutostart',
|
||||||
'virDomainBlockStats',
|
'virDomainBlockStats',
|
||||||
'virDomainInterfaceStats',
|
'virDomainInterfaceStats',
|
||||||
'virNodeGetCellsFreeMemory',
|
'virNodeGetCellsFreeMemory',
|
||||||
@ -287,18 +289,23 @@ skip_impl = (
|
|||||||
'virDomainPinVcpu',
|
'virDomainPinVcpu',
|
||||||
)
|
)
|
||||||
|
|
||||||
def skip_function(name):
|
|
||||||
if name == "virConnectClose":
|
# These are functions which the generator skips completly - no python
|
||||||
return 1
|
# or C code is generated. Generally should not be used for any more
|
||||||
if name == "virDomainFree":
|
# functions than those already listed
|
||||||
return 1
|
skip_function = (
|
||||||
if name == "virNetworkFree":
|
'virConnectListDomains', # Python API is called virConectListDomainsID for unknown reasons
|
||||||
return 1
|
'virConnSetErrorFunc', # Not used in Python API XXX is this a bug ?
|
||||||
if name == "vshRunConsole":
|
'virResetError', # Not used in Python API XXX is this a bug ?
|
||||||
return 1
|
'virConnectGetVersion', # Not used in Python API XXX is this a bug ?
|
||||||
if name == "virGetVersion":
|
'virGetVersion', # Python C code is manually written
|
||||||
return 1
|
'virSetErrorFunc', # Python API is called virRegisterErrorHandler for unknown reasons
|
||||||
return 0
|
'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):
|
def print_function_wrapper(name, output, export, include):
|
||||||
global py_types
|
global py_types
|
||||||
@ -314,7 +321,7 @@ def print_function_wrapper(name, output, export, include):
|
|||||||
|
|
||||||
if skipped_modules.has_key(file):
|
if skipped_modules.has_key(file):
|
||||||
return 0
|
return 0
|
||||||
if skip_function(name) == 1:
|
if name in skip_function:
|
||||||
return 0
|
return 0
|
||||||
if name in skip_impl:
|
if name in skip_impl:
|
||||||
# Don't delete the function entry in the caller.
|
# Don't delete the function entry in the caller.
|
||||||
@ -527,13 +534,20 @@ def buildStubs():
|
|||||||
export.close()
|
export.close()
|
||||||
wrapper.close()
|
wrapper.close()
|
||||||
|
|
||||||
print "Generated %d wrapper functions, %d failed, %d skipped\n" % (nb_wrap,
|
print "Generated %d wrapper functions" % nb_wrap
|
||||||
failed, skipped);
|
|
||||||
print "Missing type converters: "
|
print "Missing type converters: "
|
||||||
for type in unknown_types.keys():
|
for type in unknown_types.keys():
|
||||||
print "%s:%d " % (type, len(unknown_types[type])),
|
print "%s:%d " % (type, len(unknown_types[type])),
|
||||||
print
|
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
|
# This part writes part of the Python front-end classes based on
|
||||||
@ -1126,5 +1140,7 @@ def buildWrappers():
|
|||||||
txt.close()
|
txt.close()
|
||||||
classes.close()
|
classes.close()
|
||||||
|
|
||||||
buildStubs()
|
if buildStubs() < 0:
|
||||||
|
sys.exit(1)
|
||||||
buildWrappers()
|
buildWrappers()
|
||||||
|
sys.exit(0)
|
||||||
|
@ -23,14 +23,6 @@ extern void initlibvirtmod(void);
|
|||||||
extern void initcygvirtmod(void);
|
extern void initcygvirtmod(void);
|
||||||
#endif
|
#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;"
|
/* The two-statement sequence "Py_INCREF(Py_None); return Py_None;"
|
||||||
is so common that we encapsulate it here. Now, each use is simply
|
is so common that we encapsulate it here. Now, each use is simply
|
||||||
return VIR_PY_NONE; */
|
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) {
|
libvirt_virDomainBlockStats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||||
virDomainPtr domain;
|
virDomainPtr domain;
|
||||||
PyObject *pyobj_domain;
|
PyObject *pyobj_domain;
|
||||||
@ -71,7 +63,7 @@ libvirt_virDomainBlockStats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
|||||||
return(info);
|
return(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
static PyObject *
|
||||||
libvirt_virDomainInterfaceStats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
libvirt_virDomainInterfaceStats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||||
virDomainPtr domain;
|
virDomainPtr domain;
|
||||||
PyObject *pyobj_domain;
|
PyObject *pyobj_domain;
|
||||||
@ -424,7 +416,7 @@ libvirt_virDomainPinVcpu(PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
static PyObject *libvirt_virPythonErrorFuncHandler = NULL;
|
static PyObject *libvirt_virPythonErrorFuncHandler = NULL;
|
||||||
static PyObject *libvirt_virPythonErrorFuncCtxt = NULL;
|
static PyObject *libvirt_virPythonErrorFuncCtxt = NULL;
|
||||||
|
|
||||||
PyObject *
|
static PyObject *
|
||||||
libvirt_virGetLastError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED)
|
libvirt_virGetLastError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
virError err;
|
virError err;
|
||||||
@ -448,7 +440,7 @@ libvirt_virGetLastError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUT
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
static PyObject *
|
||||||
libvirt_virConnGetLastError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
libvirt_virConnGetLastError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
||||||
{
|
{
|
||||||
virError err;
|
virError err;
|
||||||
@ -716,41 +708,6 @@ libvirt_virGetVersion (PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
|||||||
return Py_BuildValue ((char *) "kk", libVer, typeVer);
|
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 *
|
static PyObject *
|
||||||
libvirt_virConnectListDomainsID(PyObject *self ATTRIBUTE_UNUSED,
|
libvirt_virConnectListDomainsID(PyObject *self ATTRIBUTE_UNUSED,
|
||||||
@ -874,7 +831,7 @@ libvirt_virNodeGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
|||||||
return(py_retval);
|
return(py_retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
static PyObject *
|
||||||
libvirt_virDomainGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
libvirt_virDomainGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||||
PyObject *py_retval;
|
PyObject *py_retval;
|
||||||
unsigned char uuid[VIR_UUID_BUFLEN];
|
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 *
|
static PyObject *
|
||||||
libvirt_virConnectListNetworks(PyObject *self ATTRIBUTE_UNUSED,
|
libvirt_virConnectListNetworks(PyObject *self ATTRIBUTE_UNUSED,
|
||||||
PyObject *args) {
|
PyObject *args) {
|
||||||
@ -1026,7 +964,7 @@ libvirt_virConnectListDefinedNetworks(PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PyObject *
|
static PyObject *
|
||||||
libvirt_virNetworkGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
libvirt_virNetworkGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||||
PyObject *py_retval;
|
PyObject *py_retval;
|
||||||
unsigned char uuid[VIR_UUID_BUFLEN];
|
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) {
|
libvirt_virDomainGetAutostart(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||||
PyObject *py_retval;
|
PyObject *py_retval;
|
||||||
int c_retval, autostart;
|
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) {
|
libvirt_virNetworkGetAutostart(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||||
PyObject *py_retval;
|
PyObject *py_retval;
|
||||||
int c_retval, autostart;
|
int c_retval, autostart;
|
||||||
@ -1120,8 +1058,8 @@ libvirt_virNetworkGetAutostart(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
|||||||
return(py_retval);
|
return(py_retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject * libvirt_virNodeGetCellsFreeMemory(PyObject *self ATTRIBUTE_UNUSED,
|
static PyObject *
|
||||||
PyObject *args)
|
libvirt_virNodeGetCellsFreeMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
||||||
{
|
{
|
||||||
PyObject *py_retval;
|
PyObject *py_retval;
|
||||||
PyObject *pyobj_conn;
|
PyObject *pyobj_conn;
|
||||||
@ -1167,9 +1105,7 @@ error:
|
|||||||
static PyMethodDef libvirtMethods[] = {
|
static PyMethodDef libvirtMethods[] = {
|
||||||
#include "libvirt-export.c"
|
#include "libvirt-export.c"
|
||||||
{(char *) "virGetVersion", libvirt_virGetVersion, METH_VARARGS, NULL},
|
{(char *) "virGetVersion", libvirt_virGetVersion, METH_VARARGS, NULL},
|
||||||
{(char *) "virDomainFree", libvirt_virDomainFree, METH_VARARGS, NULL},
|
|
||||||
{(char *) "virConnectOpenAuth", libvirt_virConnectOpenAuth, 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 *) "virConnectListDomainsID", libvirt_virConnectListDomainsID, METH_VARARGS, NULL},
|
||||||
{(char *) "virConnectListDefinedDomains", libvirt_virConnectListDefinedDomains, METH_VARARGS, NULL},
|
{(char *) "virConnectListDefinedDomains", libvirt_virConnectListDefinedDomains, METH_VARARGS, NULL},
|
||||||
{(char *) "virDomainGetInfo", libvirt_virDomainGetInfo, 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 *) "virRegisterErrorHandler", libvirt_virRegisterErrorHandler, METH_VARARGS, NULL},
|
||||||
{(char *) "virGetLastError", libvirt_virGetLastError, METH_VARARGS, NULL},
|
{(char *) "virGetLastError", libvirt_virGetLastError, METH_VARARGS, NULL},
|
||||||
{(char *) "virConnGetLastError", libvirt_virConnGetLastError, 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 *) "virConnectListNetworks", libvirt_virConnectListNetworks, METH_VARARGS, NULL},
|
||||||
{(char *) "virConnectListDefinedNetworks", libvirt_virConnectListDefinedNetworks, METH_VARARGS, NULL},
|
{(char *) "virConnectListDefinedNetworks", libvirt_virConnectListDefinedNetworks, METH_VARARGS, NULL},
|
||||||
{(char *) "virNetworkGetUUID", libvirt_virNetworkGetUUID, METH_VARARGS, NULL},
|
{(char *) "virNetworkGetUUID", libvirt_virNetworkGetUUID, METH_VARARGS, NULL},
|
||||||
|
Loading…
Reference in New Issue
Block a user