summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am40
-rwxr-xr-xgenerator.py50
-rw-r--r--libvir.c44
-rw-r--r--libvirt-python-api.xml (renamed from libvir-python-api.xml)0
-rw-r--r--libvirt_wrap.h (renamed from libvir_wrap.h)20
-rw-r--r--types.c34
6 files changed, 94 insertions, 94 deletions
diff --git a/Makefile.am b/Makefile.am
index 0921e32..b0eb78e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-# Makefile for libvir python library
+# Makefile for libvirt python library
INCLUDES = \
-I$(PYTHON_INCLUDES) \
@@ -6,7 +6,7 @@ INCLUDES = \
-I$(top_builddir)/include \
-I$(top_builddir)/$(subdir)
-DOCS_DIR = $(datadir)/doc/libvir-python-$(LIBVIR_VERSION)
+DOCS_DIR = $(datadir)/doc/libvirt-python-$(LIBVIR_VERSION)
DOCS = ${srcdir}/TODO
@@ -14,40 +14,40 @@ EXTRA_DIST = \
libvir.c \
types.c \
generator.py \
- libvir_wrap.h \
- libvir.py \
- libvir-python-api.xml \
+ libvirt_wrap.h \
+ libvirt.py \
+ libvirt-python-api.xml \
$(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
-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
-libvirmod_la_LIBADD = $(mylibs)
+libvirtmod_la_SOURCES = libvir.c types.c libvirt-py.c libvirt-py.h
+libvirtmod_la_LIBADD = $(mylibs)
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(pythondir)
- @INSTALL@ -m 0644 libvir.py $(DESTDIR)$(pythondir)
+ @INSTALL@ -m 0644 libvirt.py $(DESTDIR)$(pythondir)
$(mkinstalldirs) $(DESTDIR)$(DOCS_DIR)
@(for doc in $(DOCS) ; \
do @INSTALL@ -m 0644 $$doc $(DESTDIR)$(DOCS_DIR) ; done)
GENERATE = generator.py
-API_DESC = $(top_srcdir)/docs/libvir-api.xml $(srcdir)/libvir-python-api.xml
-GENERATED= libvir.py \
- libvir-export.c \
- libvirclass.txt \
- libvir-py.c \
- libvir-py.h
+API_DESC = $(top_srcdir)/docs/libvirt-api.xml $(srcdir)/libvirt-python-api.xml
+GENERATED= libvirt.py \
+ libvirt-export.c \
+ libvirtclass.txt \
+ libvirt-py.c \
+ libvirt-py.h
-CLEANFILES= $(GENERATED) gen_prog libvir.py
+CLEANFILES= $(GENERATED) gen_prog libvirt.py
$(GENERATED): gen_prog
@@ -55,7 +55,7 @@ gen_prog: $(srcdir)/$(GENERATE) $(API_DESC)
$(PYTHON) $(srcdir)/$(GENERATE) $(srcdir)
touch gen_prog
-$(libvirmod_la_OBJECTS): $(GENERATED)
+$(libvirtmod_la_OBJECTS): $(GENERATED)
else
all:
diff --git a/generator.py b/generator.py
index 0c22482..c336f61 100755
--- a/generator.py
+++ b/generator.py
@@ -20,7 +20,7 @@ else:
#######################################################################
#
# That part if purely the API acquisition phase from the
-# libvir API description
+# libvirt API description
#
#######################################################################
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])
else:
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"
elif py_return_types.has_key(ret[0]):
(f, t, n, c) = py_return_types[ret[0]]
c_return = " %s c_retval;\n" % (ret[0])
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"
else:
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)
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))
if file == "python":
@@ -399,7 +399,7 @@ def print_function_wrapper(name, output, export, include):
return 1
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")
if format == "":
output.write(" ATTRIBUTE_UNUSED")
@@ -432,14 +432,14 @@ def buildStubs():
global unknown_types
try:
- f = open(os.path.join(srcPref,"libvir-api.xml"))
+ f = open(os.path.join(srcPref,"libvirt-api.xml"))
data = f.read()
(parser, target) = getparser()
parser.feed(data)
parser.close()
except IOError, msg:
try:
- f = open(os.path.join(srcPref,"..","docs","libvir-api.xml"))
+ f = open(os.path.join(srcPref,"..","docs","libvirt-api.xml"))
data = f.read()
(parser, target) = getparser()
parser.feed(data)
@@ -449,11 +449,11 @@ def buildStubs():
sys.exit(1)
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")
try:
- f = open(os.path.join(srcPref,"libvir-python-api.xml"))
+ f = open(os.path.join(srcPref,"libvirt-python-api.xml"))
data = f.read()
(parser, target) = getparser()
parser.feed(data)
@@ -462,22 +462,22 @@ def buildStubs():
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)
nb_wrap = 0
failed = 0
skipped = 0
- include = open("libvir-py.h", "w")
+ include = open("libvirt-py.h", "w")
include.write("/* Generated */\n\n")
- export = open("libvir-export.c", "w")
+ export = open("libvirt-export.c", "w")
export.write("/* Generated */\n\n")
- wrapper = open("libvir-py.c", "w")
+ wrapper = open("libvirt-py.c", "w")
wrapper.write("/* Generated */\n\n")
wrapper.write("#include <Python.h>\n")
- wrapper.write("#include <libvir.h>\n")
- wrapper.write("#include \"libvir_wrap.h\"\n")
- wrapper.write("#include \"libvir-py.h\"\n\n")
+ wrapper.write("#include <libvirt.h>\n")
+ wrapper.write("#include \"libvirt_wrap.h\"\n")
+ wrapper.write("#include \"libvirt-py.h\"\n\n")
for function in functions.keys():
ret = print_function_wrapper(function, wrapper, export, include)
if ret < 0:
@@ -685,19 +685,19 @@ def buildWrappers():
info = (0, func, name, ret, args, file)
function_classes['None'].append(info)
- classes = open("libvir.py", "w")
+ classes = open("libvirt.py", "w")
classes.write("""#!/usr/bin/python -u
#
-# Those are the autogenerated Python bindings for libvir.
-# Check python/generator.py in the source distribution of libvir
+# 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 libvirmod\n")
+ classes.write("import libvirtmod\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("#\n# Global functions of the module\n#\n\n")
@@ -732,7 +732,7 @@ def buildWrappers():
classes.write(" ret = ");
else:
classes.write(" ");
- classes.write("libvirmod.%s(" % name)
+ classes.write("libvirtmod.%s(" % name)
n = 0
for arg in args:
if n != 0:
@@ -788,7 +788,7 @@ def buildWrappers():
if classes_destructors.has_key(classname):
classes.write(" def __del__(self):\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.write(" self._o = None\n\n");
destruct=classes_destructors[classname]
@@ -836,7 +836,7 @@ def buildWrappers():
classes.write(" ret = ");
else:
classes.write(" ");
- classes.write("libvirmod.%s(" % name)
+ classes.write("libvirtmod.%s(" % name)
n = 0
for arg in args:
if n != 0:
diff --git a/libvir.c b/libvir.c
index 5956fdd..ffc9c03 100644
--- a/libvir.c
+++ b/libvir.c
@@ -10,14 +10,14 @@
*/
#include <Python.h>
-#include <libvir.h>
-#include "libvir_wrap.h"
-#include "libvir-py.h"
+#include <libvirt.h>
+#include "libvirt_wrap.h"
+#include "libvirt-py.h"
void initlibvirmod(void);
static PyObject *
-libvir_virDomainFree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+libvirt_virDomainFree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
int c_retval;
virDomainPtr domain;
@@ -28,12 +28,12 @@ libvir_virDomainFree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
c_retval = virDomainFree(domain);
- py_retval = libvir_intWrap((int) c_retval);
+ py_retval = libvirt_intWrap((int) c_retval);
return(py_retval);
}
static PyObject *
-libvir_virConnectClose(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+libvirt_virConnectClose(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
int c_retval;
virConnectPtr conn;
@@ -44,12 +44,12 @@ libvir_virConnectClose(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
c_retval = virConnectClose(conn);
- py_retval = libvir_intWrap((int) c_retval);
+ py_retval = libvirt_intWrap((int) c_retval);
return(py_retval);
}
static PyObject *
-libvir_virConnectListDomainsID(PyObject *self ATTRIBUTE_UNUSED,
+libvirt_virConnectListDomainsID(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args) {
PyObject *py_retval;
int ids[500], c_retval, i;
@@ -68,13 +68,13 @@ libvir_virConnectListDomainsID(PyObject *self ATTRIBUTE_UNUSED,
}
py_retval = PyList_New(c_retval);
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);
}
static PyObject *
-libvir_virDomainGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+libvirt_virDomainGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
int c_retval;
virDomainPtr domain;
@@ -91,12 +91,12 @@ libvir_virDomainGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return(Py_None);
}
py_retval = PyList_New(5);
- PyList_SetItem(py_retval, 0, libvir_intWrap((int) info.state));
- PyList_SetItem(py_retval, 1, libvir_longWrap((long) info.maxMem));
- PyList_SetItem(py_retval, 2, libvir_longWrap((long) info.memory));
- PyList_SetItem(py_retval, 3, libvir_intWrap((int) info.nrVirtCpu));
+ PyList_SetItem(py_retval, 0, libvirt_intWrap((int) info.state));
+ PyList_SetItem(py_retval, 1, libvirt_longWrap((long) info.maxMem));
+ PyList_SetItem(py_retval, 2, libvirt_longWrap((long) info.memory));
+ PyList_SetItem(py_retval, 3, libvirt_intWrap((int) info.nrVirtCpu));
PyList_SetItem(py_retval, 4,
- libvir_longlongWrap((unsigned long long) info.cpuTime));
+ libvirt_longlongWrap((unsigned long long) info.cpuTime));
return(py_retval);
}
@@ -105,12 +105,12 @@ libvir_virDomainGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
* The registration stuff *
* *
************************************************************************/
-static PyMethodDef libvirMethods[] = {
-#include "libvir-export.c"
- {(char *) "virDomainFree", libvir_virDomainFree, METH_VARARGS, NULL},
- {(char *) "virConnectClose", libvir_virConnectClose, METH_VARARGS, NULL},
- {(char *) "virConnectListDomainsID", libvir_virConnectListDomainsID, METH_VARARGS, NULL},
- {(char *) "virDomainGetInfo", libvir_virDomainGetInfo, METH_VARARGS, NULL},
+static PyMethodDef libvirtMethods[] = {
+#include "libvirt-export.c"
+ {(char *) "virDomainFree", libvirt_virDomainFree, METH_VARARGS, NULL},
+ {(char *) "virConnectClose", libvirt_virConnectClose, METH_VARARGS, NULL},
+ {(char *) "virConnectListDomainsID", libvirt_virConnectListDomainsID, METH_VARARGS, NULL},
+ {(char *) "virDomainGetInfo", libvirt_virDomainGetInfo, METH_VARARGS, NULL},
{NULL, NULL, 0, NULL}
};
@@ -123,7 +123,7 @@ initlibvirmod(void)
return;
/* intialize the python extension module */
- Py_InitModule((char *) "libvirmod", libvirMethods);
+ Py_InitModule((char *) "libvirtmod", libvirtMethods);
initialized = 1;
}
diff --git a/libvir-python-api.xml b/libvirt-python-api.xml
index d90da8a..d90da8a 100644
--- a/libvir-python-api.xml
+++ b/libvirt-python-api.xml
diff --git a/libvir_wrap.h b/libvirt_wrap.h
index 41400c0..5d1d3e3 100644
--- a/libvir_wrap.h
+++ b/libvirt_wrap.h
@@ -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.
*
@@ -7,7 +7,7 @@
*/
#include <Python.h>
-#include <libvir.h>
+#include <libvirt.h>
#ifdef __GNUC__
#ifdef ATTRIBUTE_UNUSED
@@ -38,12 +38,12 @@ typedef struct {
} PyvirDomain_Object;
-PyObject * libvir_intWrap(int val);
-PyObject * libvir_longWrap(long val);
-PyObject * libvir_longlongWrap(long long val);
-PyObject * libvir_charPtrWrap(char *str);
-PyObject * libvir_constcharPtrWrap(const char *str);
-PyObject * libvir_charPtrConstWrap(const char *str);
-PyObject * libvir_virConnectPtrWrap(virConnectPtr node);
-PyObject * libvir_virDomainPtrWrap(virDomainPtr node);
+PyObject * libvirt_intWrap(int val);
+PyObject * libvirt_longWrap(long val);
+PyObject * libvirt_longlongWrap(long long val);
+PyObject * libvirt_charPtrWrap(char *str);
+PyObject * libvirt_constcharPtrWrap(const char *str);
+PyObject * libvirt_charPtrConstWrap(const char *str);
+PyObject * libvirt_virConnectPtrWrap(virConnectPtr node);
+PyObject * libvirt_virDomainPtrWrap(virDomainPtr node);
diff --git a/types.c b/types.c
index 3015c1d..b98beef 100644
--- a/types.c
+++ b/types.c
@@ -7,51 +7,51 @@
* Daniel Veillard <veillard@redhat.com>
*/
-#include "libvir_wrap.h"
+#include "libvirt_wrap.h"
PyObject *
-libvir_intWrap(int val)
+libvirt_intWrap(int val)
{
PyObject *ret;
#ifdef DEBUG
- printf("libvir_intWrap: val = %d\n", val);
+ printf("libvirt_intWrap: val = %d\n", val);
#endif
ret = PyInt_FromLong((long) val);
return (ret);
}
PyObject *
-libvir_longWrap(long val)
+libvirt_longWrap(long val)
{
PyObject *ret;
#ifdef DEBUG
- printf("libvir_longWrap: val = %ld\n", val);
+ printf("libvirt_longWrap: val = %ld\n", val);
#endif
ret = PyInt_FromLong(val);
return (ret);
}
PyObject *
-libvir_longlongWrap(long long val)
+libvirt_longlongWrap(long long val)
{
PyObject *ret;
#ifdef DEBUG
- printf("libvir_longWrap: val = %ld\n", val);
+ printf("libvirt_longWrap: val = %ld\n", val);
#endif
ret = PyLong_FromUnsignedLongLong((unsigned long long) val);
return (ret);
}
PyObject *
-libvir_charPtrWrap(char *str)
+libvirt_charPtrWrap(char *str)
{
PyObject *ret;
#ifdef DEBUG
- printf("libvir_xmlcharPtrWrap: str = %s\n", str);
+ printf("libvirt_xmlcharPtrWrap: str = %s\n", str);
#endif
if (str == NULL) {
Py_INCREF(Py_None);
@@ -63,12 +63,12 @@ libvir_charPtrWrap(char *str)
}
PyObject *
-libvir_constcharPtrWrap(const char *str)
+libvirt_constcharPtrWrap(const char *str)
{
PyObject *ret;
#ifdef DEBUG
- printf("libvir_xmlcharPtrWrap: str = %s\n", str);
+ printf("libvirt_xmlcharPtrWrap: str = %s\n", str);
#endif
if (str == NULL) {
Py_INCREF(Py_None);
@@ -79,12 +79,12 @@ libvir_constcharPtrWrap(const char *str)
}
PyObject *
-libvir_charPtrConstWrap(const char *str)
+libvirt_charPtrConstWrap(const char *str)
{
PyObject *ret;
#ifdef DEBUG
- printf("libvir_xmlcharPtrWrap: str = %s\n", str);
+ printf("libvirt_xmlcharPtrWrap: str = %s\n", str);
#endif
if (str == NULL) {
Py_INCREF(Py_None);
@@ -95,12 +95,12 @@ libvir_charPtrConstWrap(const char *str)
}
PyObject *
-libvir_virDomainPtrWrap(virDomainPtr node)
+libvirt_virDomainPtrWrap(virDomainPtr node)
{
PyObject *ret;
#ifdef DEBUG
- printf("libvir_virDomainPtrWrap: node = %p\n", node);
+ printf("libvirt_virDomainPtrWrap: node = %p\n", node);
#endif
if (node == NULL) {
Py_INCREF(Py_None);
@@ -113,12 +113,12 @@ libvir_virDomainPtrWrap(virDomainPtr node)
}
PyObject *
-libvir_virConnectPtrWrap(virConnectPtr node)
+libvirt_virConnectPtrWrap(virConnectPtr node)
{
PyObject *ret;
#ifdef DEBUG
- printf("libvir_virConnectPtrWrap: node = %p\n", node);
+ printf("libvirt_virConnectPtrWrap: node = %p\n", node);
#endif
if (node == NULL) {
Py_INCREF(Py_None);