[libvirt] [libvirt-glib][PATCH 2/2] python: Introduce support for python3

Martin Kletzander mkletzan at redhat.com
Mon Aug 1 10:05:43 UTC 2016


On Mon, Aug 01, 2016 at 11:47:43AM +0200, Michal Privoznik wrote:
>Just like libvirt itself is able to work with both major version
>of python, libvirt-glib should do the same. Even the code I'm
>introducing here is copied from there (and changed slightly to
>reflect project name).
>
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>---
> python/libvirt-glib.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 44 insertions(+)
>
>diff --git a/python/libvirt-glib.c b/python/libvirt-glib.c
>index 1daca36..8b3920d 100644
>--- a/python/libvirt-glib.c
>+++ b/python/libvirt-glib.c
>@@ -17,11 +17,19 @@
> #include <glib.h>
> #include "libvirt-glib/libvirt-glib.h"
>
>+#if PY_MAJOR_VERSION > 2
>+# ifndef __CYGWIN__
>+extern PyObject *PyInit_libvirtglibmod(void);
>+# else
>+extern PyObject *PyInit_cygvirtglibmod(void);
>+# endif
>+#else
> #ifndef __CYGWIN__
> extern void initlibvirtglibmod(void);
> #else
> extern void initcygvirtglibmod(void);
> #endif

I'd expect this to be re-indented, but make syntax-check doesn't say
anything.  Other than that, I have no idea about glib, but the patches
work for me...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160801/80ad7bd1/attachment-0001.sig>


More information about the libvir-list mailing list