mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-12-22 08:23:46 +03:00
* //* : renamed the project libvirt , this affects all makefiles,
the specs, the icons, the docs, etc ... * configure.in: prepare for 0.0.3 Daniel
This commit is contained in:
40
Makefile.am
40
Makefile.am
@@ -1,4 +1,4 @@
|
|||||||
# Makefile for libvir python library
|
# Makefile for libvirt python library
|
||||||
|
|
||||||
INCLUDES = \
|
INCLUDES = \
|
||||||
-I$(PYTHON_INCLUDES) \
|
-I$(PYTHON_INCLUDES) \
|
||||||
@@ -6,7 +6,7 @@ INCLUDES = \
|
|||||||
-I$(top_builddir)/include \
|
-I$(top_builddir)/include \
|
||||||
-I$(top_builddir)/$(subdir)
|
-I$(top_builddir)/$(subdir)
|
||||||
|
|
||||||
DOCS_DIR = $(datadir)/doc/libvir-python-$(LIBVIR_VERSION)
|
DOCS_DIR = $(datadir)/doc/libvirt-python-$(LIBVIR_VERSION)
|
||||||
|
|
||||||
DOCS = ${srcdir}/TODO
|
DOCS = ${srcdir}/TODO
|
||||||
|
|
||||||
@@ -14,40 +14,40 @@ EXTRA_DIST = \
|
|||||||
libvir.c \
|
libvir.c \
|
||||||
types.c \
|
types.c \
|
||||||
generator.py \
|
generator.py \
|
||||||
libvir_wrap.h \
|
libvirt_wrap.h \
|
||||||
libvir.py \
|
libvirt.py \
|
||||||
libvir-python-api.xml \
|
libvirt-python-api.xml \
|
||||||
$(DOCS)
|
$(DOCS)
|
||||||
|
|
||||||
libvirmod_la_LDFLAGS = -module -avoid-version -L$(top_builddir)/src/.libs
|
libvirtmod_la_LDFLAGS = -module -avoid-version -L$(top_builddir)/src/.libs
|
||||||
|
|
||||||
if WITH_PYTHON
|
if WITH_PYTHON
|
||||||
mylibs = $(top_builddir)/src/libvir.la
|
mylibs = $(top_builddir)/src/libvirt.la
|
||||||
|
|
||||||
all-local: libvir.py
|
all-local: libvirt.py
|
||||||
|
|
||||||
python_LTLIBRARIES = libvirmod.la
|
python_LTLIBRARIES = libvirtmod.la
|
||||||
|
|
||||||
libvirmod_la_SOURCES = libvir.c types.c libvir-py.c
|
libvirtmod_la_SOURCES = libvir.c types.c libvirt-py.c libvirt-py.h
|
||||||
libvirmod_la_LIBADD = $(mylibs)
|
libvirtmod_la_LIBADD = $(mylibs)
|
||||||
|
|
||||||
|
|
||||||
install-data-local:
|
install-data-local:
|
||||||
$(mkinstalldirs) $(DESTDIR)$(pythondir)
|
$(mkinstalldirs) $(DESTDIR)$(pythondir)
|
||||||
@INSTALL@ -m 0644 libvir.py $(DESTDIR)$(pythondir)
|
@INSTALL@ -m 0644 libvirt.py $(DESTDIR)$(pythondir)
|
||||||
$(mkinstalldirs) $(DESTDIR)$(DOCS_DIR)
|
$(mkinstalldirs) $(DESTDIR)$(DOCS_DIR)
|
||||||
@(for doc in $(DOCS) ; \
|
@(for doc in $(DOCS) ; \
|
||||||
do @INSTALL@ -m 0644 $$doc $(DESTDIR)$(DOCS_DIR) ; done)
|
do @INSTALL@ -m 0644 $$doc $(DESTDIR)$(DOCS_DIR) ; done)
|
||||||
|
|
||||||
GENERATE = generator.py
|
GENERATE = generator.py
|
||||||
API_DESC = $(top_srcdir)/docs/libvir-api.xml $(srcdir)/libvir-python-api.xml
|
API_DESC = $(top_srcdir)/docs/libvirt-api.xml $(srcdir)/libvirt-python-api.xml
|
||||||
GENERATED= libvir.py \
|
GENERATED= libvirt.py \
|
||||||
libvir-export.c \
|
libvirt-export.c \
|
||||||
libvirclass.txt \
|
libvirtclass.txt \
|
||||||
libvir-py.c \
|
libvirt-py.c \
|
||||||
libvir-py.h
|
libvirt-py.h
|
||||||
|
|
||||||
CLEANFILES= $(GENERATED) gen_prog libvir.py
|
CLEANFILES= $(GENERATED) gen_prog libvirt.py
|
||||||
|
|
||||||
$(GENERATED): gen_prog
|
$(GENERATED): gen_prog
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ gen_prog: $(srcdir)/$(GENERATE) $(API_DESC)
|
|||||||
$(PYTHON) $(srcdir)/$(GENERATE) $(srcdir)
|
$(PYTHON) $(srcdir)/$(GENERATE) $(srcdir)
|
||||||
touch gen_prog
|
touch gen_prog
|
||||||
|
|
||||||
$(libvirmod_la_OBJECTS): $(GENERATED)
|
$(libvirtmod_la_OBJECTS): $(GENERATED)
|
||||||
|
|
||||||
else
|
else
|
||||||
all:
|
all:
|
||||||
|
|||||||
50
generator.py
50
generator.py
@@ -20,7 +20,7 @@ else:
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
#
|
#
|
||||||
# That part if purely the API acquisition phase from the
|
# That part if purely the API acquisition phase from the
|
||||||
# libvir API description
|
# libvirt API description
|
||||||
#
|
#
|
||||||
#######################################################################
|
#######################################################################
|
||||||
import os
|
import os
|
||||||
@@ -354,13 +354,13 @@ def print_function_wrapper(name, output, export, include):
|
|||||||
c_call = "\n c_retval = %s->%s;\n" % (args[0][0], ret[2])
|
c_call = "\n c_retval = %s->%s;\n" % (args[0][0], ret[2])
|
||||||
else:
|
else:
|
||||||
c_call = "\n c_retval = %s(%s);\n" % (name, c_call);
|
c_call = "\n c_retval = %s(%s);\n" % (name, c_call);
|
||||||
ret_convert = " py_retval = libvir_%sWrap((%s) c_retval);\n" % (n,c)
|
ret_convert = " py_retval = libvirt_%sWrap((%s) c_retval);\n" % (n,c)
|
||||||
ret_convert = ret_convert + " return(py_retval);\n"
|
ret_convert = ret_convert + " return(py_retval);\n"
|
||||||
elif py_return_types.has_key(ret[0]):
|
elif py_return_types.has_key(ret[0]):
|
||||||
(f, t, n, c) = py_return_types[ret[0]]
|
(f, t, n, c) = py_return_types[ret[0]]
|
||||||
c_return = " %s c_retval;\n" % (ret[0])
|
c_return = " %s c_retval;\n" % (ret[0])
|
||||||
c_call = "\n c_retval = %s(%s);\n" % (name, c_call);
|
c_call = "\n c_retval = %s(%s);\n" % (name, c_call);
|
||||||
ret_convert = " py_retval = libvir_%sWrap((%s) c_retval);\n" % (n,c)
|
ret_convert = " py_retval = libvirt_%sWrap((%s) c_retval);\n" % (n,c)
|
||||||
ret_convert = ret_convert + " return(py_retval);\n"
|
ret_convert = ret_convert + " return(py_retval);\n"
|
||||||
else:
|
else:
|
||||||
if skipped_types.has_key(ret[0]):
|
if skipped_types.has_key(ret[0]):
|
||||||
@@ -378,9 +378,9 @@ def print_function_wrapper(name, output, export, include):
|
|||||||
output.write("#if %s\n" % cond)
|
output.write("#if %s\n" % cond)
|
||||||
|
|
||||||
include.write("PyObject * ")
|
include.write("PyObject * ")
|
||||||
include.write("libvir_%s(PyObject *self, PyObject *args);\n" % (name));
|
include.write("libvirt_%s(PyObject *self, PyObject *args);\n" % (name));
|
||||||
|
|
||||||
export.write(" { (char *)\"%s\", libvir_%s, METH_VARARGS, NULL },\n" %
|
export.write(" { (char *)\"%s\", libvirt_%s, METH_VARARGS, NULL },\n" %
|
||||||
(name, name))
|
(name, name))
|
||||||
|
|
||||||
if file == "python":
|
if file == "python":
|
||||||
@@ -399,7 +399,7 @@ def print_function_wrapper(name, output, export, include):
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
output.write("PyObject *\n")
|
output.write("PyObject *\n")
|
||||||
output.write("libvir_%s(PyObject *self ATTRIBUTE_UNUSED," % (name))
|
output.write("libvirt_%s(PyObject *self ATTRIBUTE_UNUSED," % (name))
|
||||||
output.write(" PyObject *args")
|
output.write(" PyObject *args")
|
||||||
if format == "":
|
if format == "":
|
||||||
output.write(" ATTRIBUTE_UNUSED")
|
output.write(" ATTRIBUTE_UNUSED")
|
||||||
@@ -432,14 +432,14 @@ def buildStubs():
|
|||||||
global unknown_types
|
global unknown_types
|
||||||
|
|
||||||
try:
|
try:
|
||||||
f = open(os.path.join(srcPref,"libvir-api.xml"))
|
f = open(os.path.join(srcPref,"libvirt-api.xml"))
|
||||||
data = f.read()
|
data = f.read()
|
||||||
(parser, target) = getparser()
|
(parser, target) = getparser()
|
||||||
parser.feed(data)
|
parser.feed(data)
|
||||||
parser.close()
|
parser.close()
|
||||||
except IOError, msg:
|
except IOError, msg:
|
||||||
try:
|
try:
|
||||||
f = open(os.path.join(srcPref,"..","docs","libvir-api.xml"))
|
f = open(os.path.join(srcPref,"..","docs","libvirt-api.xml"))
|
||||||
data = f.read()
|
data = f.read()
|
||||||
(parser, target) = getparser()
|
(parser, target) = getparser()
|
||||||
parser.feed(data)
|
parser.feed(data)
|
||||||
@@ -449,11 +449,11 @@ def buildStubs():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
n = len(functions.keys())
|
n = len(functions.keys())
|
||||||
print "Found %d functions in libvir-api.xml" % (n)
|
print "Found %d functions in libvirt-api.xml" % (n)
|
||||||
|
|
||||||
py_types['pythonObject'] = ('O', "pythonObject", "pythonObject", "pythonObject")
|
py_types['pythonObject'] = ('O', "pythonObject", "pythonObject", "pythonObject")
|
||||||
try:
|
try:
|
||||||
f = open(os.path.join(srcPref,"libvir-python-api.xml"))
|
f = open(os.path.join(srcPref,"libvirt-python-api.xml"))
|
||||||
data = f.read()
|
data = f.read()
|
||||||
(parser, target) = getparser()
|
(parser, target) = getparser()
|
||||||
parser.feed(data)
|
parser.feed(data)
|
||||||
@@ -462,22 +462,22 @@ def buildStubs():
|
|||||||
print file, ":", msg
|
print file, ":", msg
|
||||||
|
|
||||||
|
|
||||||
print "Found %d functions in libvir-python-api.xml" % (
|
print "Found %d functions in libvirt-python-api.xml" % (
|
||||||
len(functions.keys()) - n)
|
len(functions.keys()) - n)
|
||||||
nb_wrap = 0
|
nb_wrap = 0
|
||||||
failed = 0
|
failed = 0
|
||||||
skipped = 0
|
skipped = 0
|
||||||
|
|
||||||
include = open("libvir-py.h", "w")
|
include = open("libvirt-py.h", "w")
|
||||||
include.write("/* Generated */\n\n")
|
include.write("/* Generated */\n\n")
|
||||||
export = open("libvir-export.c", "w")
|
export = open("libvirt-export.c", "w")
|
||||||
export.write("/* Generated */\n\n")
|
export.write("/* Generated */\n\n")
|
||||||
wrapper = open("libvir-py.c", "w")
|
wrapper = open("libvirt-py.c", "w")
|
||||||
wrapper.write("/* Generated */\n\n")
|
wrapper.write("/* Generated */\n\n")
|
||||||
wrapper.write("#include <Python.h>\n")
|
wrapper.write("#include <Python.h>\n")
|
||||||
wrapper.write("#include <libvir.h>\n")
|
wrapper.write("#include <libvirt.h>\n")
|
||||||
wrapper.write("#include \"libvir_wrap.h\"\n")
|
wrapper.write("#include \"libvirt_wrap.h\"\n")
|
||||||
wrapper.write("#include \"libvir-py.h\"\n\n")
|
wrapper.write("#include \"libvirt-py.h\"\n\n")
|
||||||
for function in functions.keys():
|
for function in functions.keys():
|
||||||
ret = print_function_wrapper(function, wrapper, export, include)
|
ret = print_function_wrapper(function, wrapper, export, include)
|
||||||
if ret < 0:
|
if ret < 0:
|
||||||
@@ -685,19 +685,19 @@ def buildWrappers():
|
|||||||
info = (0, func, name, ret, args, file)
|
info = (0, func, name, ret, args, file)
|
||||||
function_classes['None'].append(info)
|
function_classes['None'].append(info)
|
||||||
|
|
||||||
classes = open("libvir.py", "w")
|
classes = open("libvirt.py", "w")
|
||||||
classes.write("""#!/usr/bin/python -u
|
classes.write("""#!/usr/bin/python -u
|
||||||
#
|
#
|
||||||
# Those are the autogenerated Python bindings for libvir.
|
# Those are the autogenerated Python bindings for libvirt.
|
||||||
# Check python/generator.py in the source distribution of libvir
|
# Check python/generator.py in the source distribution of libvirt
|
||||||
# to find out more about the generation process
|
# to find out more about the generation process
|
||||||
#
|
#
|
||||||
""")
|
""")
|
||||||
|
|
||||||
classes.write("import libvirmod\n")
|
classes.write("import libvirtmod\n")
|
||||||
classes.write("import types\n\n")
|
classes.write("import types\n\n")
|
||||||
|
|
||||||
txt = open("libvirclass.txt", "w")
|
txt = open("libvirtclass.txt", "w")
|
||||||
txt.write(" Generated Classes for libvir-python\n\n")
|
txt.write(" Generated Classes for libvir-python\n\n")
|
||||||
|
|
||||||
txt.write("#\n# Global functions of the module\n#\n\n")
|
txt.write("#\n# Global functions of the module\n#\n\n")
|
||||||
@@ -732,7 +732,7 @@ def buildWrappers():
|
|||||||
classes.write(" ret = ");
|
classes.write(" ret = ");
|
||||||
else:
|
else:
|
||||||
classes.write(" ");
|
classes.write(" ");
|
||||||
classes.write("libvirmod.%s(" % name)
|
classes.write("libvirtmod.%s(" % name)
|
||||||
n = 0
|
n = 0
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if n != 0:
|
if n != 0:
|
||||||
@@ -788,7 +788,7 @@ def buildWrappers():
|
|||||||
if classes_destructors.has_key(classname):
|
if classes_destructors.has_key(classname):
|
||||||
classes.write(" def __del__(self):\n")
|
classes.write(" def __del__(self):\n")
|
||||||
classes.write(" if self._o != None:\n")
|
classes.write(" if self._o != None:\n")
|
||||||
classes.write(" libvirmod.%s(self._o)\n" %
|
classes.write(" libvirtmod.%s(self._o)\n" %
|
||||||
classes_destructors[classname]);
|
classes_destructors[classname]);
|
||||||
classes.write(" self._o = None\n\n");
|
classes.write(" self._o = None\n\n");
|
||||||
destruct=classes_destructors[classname]
|
destruct=classes_destructors[classname]
|
||||||
@@ -836,7 +836,7 @@ def buildWrappers():
|
|||||||
classes.write(" ret = ");
|
classes.write(" ret = ");
|
||||||
else:
|
else:
|
||||||
classes.write(" ");
|
classes.write(" ");
|
||||||
classes.write("libvirmod.%s(" % name)
|
classes.write("libvirtmod.%s(" % name)
|
||||||
n = 0
|
n = 0
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if n != 0:
|
if n != 0:
|
||||||
|
|||||||
44
libvir.c
44
libvir.c
@@ -10,14 +10,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
#include <libvir.h>
|
#include <libvirt.h>
|
||||||
#include "libvir_wrap.h"
|
#include "libvirt_wrap.h"
|
||||||
#include "libvir-py.h"
|
#include "libvirt-py.h"
|
||||||
|
|
||||||
void initlibvirmod(void);
|
void initlibvirmod(void);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
libvir_virDomainFree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
libvirt_virDomainFree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||||
PyObject *py_retval;
|
PyObject *py_retval;
|
||||||
int c_retval;
|
int c_retval;
|
||||||
virDomainPtr domain;
|
virDomainPtr domain;
|
||||||
@@ -28,12 +28,12 @@ libvir_virDomainFree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
|||||||
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
|
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
|
||||||
|
|
||||||
c_retval = virDomainFree(domain);
|
c_retval = virDomainFree(domain);
|
||||||
py_retval = libvir_intWrap((int) c_retval);
|
py_retval = libvirt_intWrap((int) c_retval);
|
||||||
return(py_retval);
|
return(py_retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
libvir_virConnectClose(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
libvirt_virConnectClose(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||||
PyObject *py_retval;
|
PyObject *py_retval;
|
||||||
int c_retval;
|
int c_retval;
|
||||||
virConnectPtr conn;
|
virConnectPtr conn;
|
||||||
@@ -44,12 +44,12 @@ libvir_virConnectClose(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
|||||||
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
|
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
|
||||||
|
|
||||||
c_retval = virConnectClose(conn);
|
c_retval = virConnectClose(conn);
|
||||||
py_retval = libvir_intWrap((int) c_retval);
|
py_retval = libvirt_intWrap((int) c_retval);
|
||||||
return(py_retval);
|
return(py_retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
libvir_virConnectListDomainsID(PyObject *self ATTRIBUTE_UNUSED,
|
libvirt_virConnectListDomainsID(PyObject *self ATTRIBUTE_UNUSED,
|
||||||
PyObject *args) {
|
PyObject *args) {
|
||||||
PyObject *py_retval;
|
PyObject *py_retval;
|
||||||
int ids[500], c_retval, i;
|
int ids[500], c_retval, i;
|
||||||
@@ -68,13 +68,13 @@ libvir_virConnectListDomainsID(PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
py_retval = PyList_New(c_retval);
|
py_retval = PyList_New(c_retval);
|
||||||
for (i = 0;i < c_retval;i++) {
|
for (i = 0;i < c_retval;i++) {
|
||||||
PyList_SetItem(py_retval, i, libvir_intWrap(ids[i]));
|
PyList_SetItem(py_retval, i, libvirt_intWrap(ids[i]));
|
||||||
}
|
}
|
||||||
return(py_retval);
|
return(py_retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
libvir_virDomainGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
libvirt_virDomainGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||||
PyObject *py_retval;
|
PyObject *py_retval;
|
||||||
int c_retval;
|
int c_retval;
|
||||||
virDomainPtr domain;
|
virDomainPtr domain;
|
||||||
@@ -91,12 +91,12 @@ libvir_virDomainGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
|||||||
return(Py_None);
|
return(Py_None);
|
||||||
}
|
}
|
||||||
py_retval = PyList_New(5);
|
py_retval = PyList_New(5);
|
||||||
PyList_SetItem(py_retval, 0, libvir_intWrap((int) info.state));
|
PyList_SetItem(py_retval, 0, libvirt_intWrap((int) info.state));
|
||||||
PyList_SetItem(py_retval, 1, libvir_longWrap((long) info.maxMem));
|
PyList_SetItem(py_retval, 1, libvirt_longWrap((long) info.maxMem));
|
||||||
PyList_SetItem(py_retval, 2, libvir_longWrap((long) info.memory));
|
PyList_SetItem(py_retval, 2, libvirt_longWrap((long) info.memory));
|
||||||
PyList_SetItem(py_retval, 3, libvir_intWrap((int) info.nrVirtCpu));
|
PyList_SetItem(py_retval, 3, libvirt_intWrap((int) info.nrVirtCpu));
|
||||||
PyList_SetItem(py_retval, 4,
|
PyList_SetItem(py_retval, 4,
|
||||||
libvir_longlongWrap((unsigned long long) info.cpuTime));
|
libvirt_longlongWrap((unsigned long long) info.cpuTime));
|
||||||
return(py_retval);
|
return(py_retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,12 +105,12 @@ libvir_virDomainGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
|||||||
* The registration stuff *
|
* The registration stuff *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static PyMethodDef libvirMethods[] = {
|
static PyMethodDef libvirtMethods[] = {
|
||||||
#include "libvir-export.c"
|
#include "libvirt-export.c"
|
||||||
{(char *) "virDomainFree", libvir_virDomainFree, METH_VARARGS, NULL},
|
{(char *) "virDomainFree", libvirt_virDomainFree, METH_VARARGS, NULL},
|
||||||
{(char *) "virConnectClose", libvir_virConnectClose, METH_VARARGS, NULL},
|
{(char *) "virConnectClose", libvirt_virConnectClose, METH_VARARGS, NULL},
|
||||||
{(char *) "virConnectListDomainsID", libvir_virConnectListDomainsID, METH_VARARGS, NULL},
|
{(char *) "virConnectListDomainsID", libvirt_virConnectListDomainsID, METH_VARARGS, NULL},
|
||||||
{(char *) "virDomainGetInfo", libvir_virDomainGetInfo, METH_VARARGS, NULL},
|
{(char *) "virDomainGetInfo", libvirt_virDomainGetInfo, METH_VARARGS, NULL},
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ initlibvirmod(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* intialize the python extension module */
|
/* intialize the python extension module */
|
||||||
Py_InitModule((char *) "libvirmod", libvirMethods);
|
Py_InitModule((char *) "libvirtmod", libvirtMethods);
|
||||||
|
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* libvir_wrap.h: type wrappers for libvir python bindings
|
* libvirt_wrap.h: type wrappers for libvir python bindings
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005 Red Hat, Inc.
|
* Copyright (C) 2005 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
#include <libvir.h>
|
#include <libvirt.h>
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#ifdef ATTRIBUTE_UNUSED
|
#ifdef ATTRIBUTE_UNUSED
|
||||||
@@ -38,12 +38,12 @@ typedef struct {
|
|||||||
} PyvirDomain_Object;
|
} PyvirDomain_Object;
|
||||||
|
|
||||||
|
|
||||||
PyObject * libvir_intWrap(int val);
|
PyObject * libvirt_intWrap(int val);
|
||||||
PyObject * libvir_longWrap(long val);
|
PyObject * libvirt_longWrap(long val);
|
||||||
PyObject * libvir_longlongWrap(long long val);
|
PyObject * libvirt_longlongWrap(long long val);
|
||||||
PyObject * libvir_charPtrWrap(char *str);
|
PyObject * libvirt_charPtrWrap(char *str);
|
||||||
PyObject * libvir_constcharPtrWrap(const char *str);
|
PyObject * libvirt_constcharPtrWrap(const char *str);
|
||||||
PyObject * libvir_charPtrConstWrap(const char *str);
|
PyObject * libvirt_charPtrConstWrap(const char *str);
|
||||||
PyObject * libvir_virConnectPtrWrap(virConnectPtr node);
|
PyObject * libvirt_virConnectPtrWrap(virConnectPtr node);
|
||||||
PyObject * libvir_virDomainPtrWrap(virDomainPtr node);
|
PyObject * libvirt_virDomainPtrWrap(virDomainPtr node);
|
||||||
|
|
||||||
34
types.c
34
types.c
@@ -7,51 +7,51 @@
|
|||||||
* Daniel Veillard <veillard@redhat.com>
|
* Daniel Veillard <veillard@redhat.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libvir_wrap.h"
|
#include "libvirt_wrap.h"
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
libvir_intWrap(int val)
|
libvirt_intWrap(int val)
|
||||||
{
|
{
|
||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("libvir_intWrap: val = %d\n", val);
|
printf("libvirt_intWrap: val = %d\n", val);
|
||||||
#endif
|
#endif
|
||||||
ret = PyInt_FromLong((long) val);
|
ret = PyInt_FromLong((long) val);
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
libvir_longWrap(long val)
|
libvirt_longWrap(long val)
|
||||||
{
|
{
|
||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("libvir_longWrap: val = %ld\n", val);
|
printf("libvirt_longWrap: val = %ld\n", val);
|
||||||
#endif
|
#endif
|
||||||
ret = PyInt_FromLong(val);
|
ret = PyInt_FromLong(val);
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
libvir_longlongWrap(long long val)
|
libvirt_longlongWrap(long long val)
|
||||||
{
|
{
|
||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("libvir_longWrap: val = %ld\n", val);
|
printf("libvirt_longWrap: val = %ld\n", val);
|
||||||
#endif
|
#endif
|
||||||
ret = PyLong_FromUnsignedLongLong((unsigned long long) val);
|
ret = PyLong_FromUnsignedLongLong((unsigned long long) val);
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
libvir_charPtrWrap(char *str)
|
libvirt_charPtrWrap(char *str)
|
||||||
{
|
{
|
||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("libvir_xmlcharPtrWrap: str = %s\n", str);
|
printf("libvirt_xmlcharPtrWrap: str = %s\n", str);
|
||||||
#endif
|
#endif
|
||||||
if (str == NULL) {
|
if (str == NULL) {
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
@@ -63,12 +63,12 @@ libvir_charPtrWrap(char *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
libvir_constcharPtrWrap(const char *str)
|
libvirt_constcharPtrWrap(const char *str)
|
||||||
{
|
{
|
||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("libvir_xmlcharPtrWrap: str = %s\n", str);
|
printf("libvirt_xmlcharPtrWrap: str = %s\n", str);
|
||||||
#endif
|
#endif
|
||||||
if (str == NULL) {
|
if (str == NULL) {
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
@@ -79,12 +79,12 @@ libvir_constcharPtrWrap(const char *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
libvir_charPtrConstWrap(const char *str)
|
libvirt_charPtrConstWrap(const char *str)
|
||||||
{
|
{
|
||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("libvir_xmlcharPtrWrap: str = %s\n", str);
|
printf("libvirt_xmlcharPtrWrap: str = %s\n", str);
|
||||||
#endif
|
#endif
|
||||||
if (str == NULL) {
|
if (str == NULL) {
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
@@ -95,12 +95,12 @@ libvir_charPtrConstWrap(const char *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
libvir_virDomainPtrWrap(virDomainPtr node)
|
libvirt_virDomainPtrWrap(virDomainPtr node)
|
||||||
{
|
{
|
||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("libvir_virDomainPtrWrap: node = %p\n", node);
|
printf("libvirt_virDomainPtrWrap: node = %p\n", node);
|
||||||
#endif
|
#endif
|
||||||
if (node == NULL) {
|
if (node == NULL) {
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
@@ -113,12 +113,12 @@ libvir_virDomainPtrWrap(virDomainPtr node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
libvir_virConnectPtrWrap(virConnectPtr node)
|
libvirt_virConnectPtrWrap(virConnectPtr node)
|
||||||
{
|
{
|
||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("libvir_virConnectPtrWrap: node = %p\n", node);
|
printf("libvirt_virConnectPtrWrap: node = %p\n", node);
|
||||||
#endif
|
#endif
|
||||||
if (node == NULL) {
|
if (node == NULL) {
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
|
|||||||
Reference in New Issue
Block a user