From b22e4f2441078aec048b9503fde2b45e78710ce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 4 Dec 2019 10:27:36 +0000 Subject: Drop support for python 2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit python2 will be end of life by the time of the next libvirt release. All our supported build targets, including CentOS7, have a python3 build available. Reviewed-by: Michal Privoznik Signed-off-by: Daniel P. Berrangé --- libvirt-lxc-override.c | 51 ++++++++++---------------------------------------- 1 file changed, 10 insertions(+), 41 deletions(-) (limited to 'libvirt-lxc-override.c') diff --git a/libvirt-lxc-override.c b/libvirt-lxc-override.c index d7af154..138ba5b 100644 --- a/libvirt-lxc-override.c +++ b/libvirt-lxc-override.c @@ -4,13 +4,13 @@ * entry points where an automatically generated stub is * unpractical * - * Copyright (C) 2012-2013 Red Hat, Inc. + * Copyright (C) 2012-2019 Red Hat, Inc. * * Daniel Veillard */ /* Horrible kludge to work around even more horrible name-space pollution - via Python.h. That file includes /usr/include/python2.5/pyconfig*.h, + via Python.h. That file includes /usr/include/python3.x/pyconfig*.h, which has over 180 autoconf-style HAVE_* definitions. Shame on them. */ #undef HAVE_PTHREAD_H @@ -21,18 +21,10 @@ #include "libvirt-utils.h" #include "build/libvirt-lxc.h" -#if PY_MAJOR_VERSION > 2 -# ifndef __CYGWIN__ +#ifndef __CYGWIN__ extern PyObject *PyInit_libvirtmod_lxc(void); -# else -extern PyObject *PyInit_cygvirtmod_lxc(void); -# endif #else -# ifndef __CYGWIN__ -extern void initlibvirtmod_lxc(void); -# else -extern void initcygvirtmod_lxc(void); -# endif +extern PyObject *PyInit_cygvirtmod_lxc(void); #endif #if 0 @@ -107,14 +99,13 @@ static PyMethodDef libvirtLxcMethods[] = { {NULL, NULL, 0, NULL} }; -#if PY_MAJOR_VERSION > 2 static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, -# ifndef __CYGWIN__ +#ifndef __CYGWIN__ "libvirtmod_lxc", -# else +#else "cygvirtmod_lxc", -# endif +#endif NULL, -1, libvirtLxcMethods, @@ -125,11 +116,11 @@ static struct PyModuleDef moduledef = { }; PyObject * -# ifndef __CYGWIN__ +#ifndef __CYGWIN__ PyInit_libvirtmod_lxc -# else +#else PyInit_cygvirtmod_lxc -# endif +#endif (void) { PyObject *module; @@ -141,25 +132,3 @@ PyInit_cygvirtmod_lxc return module; } -#else /* ! PY_MAJOR_VERSION > 2 */ -void -# ifndef __CYGWIN__ -initlibvirtmod_lxc -# else -initcygvirtmod_lxc -# endif -(void) -{ - if (virInitialize() < 0) - return; - - /* initialize the python extension module */ - Py_InitModule((char *) -# ifndef __CYGWIN__ - "libvirtmod_lxc", -# else - "cygvirtmod_lxc", -# endif - libvirtLxcMethods); -} -#endif /* ! PY_MAJOR_VERSION > 2 */ -- cgit v1.2.1