Accepting request 783429 from Virtualization
- Update to 6.1.0 - Add all new APIs and constants in libvirt 6.1.0 - Stop building for python2 Dropped patches: revert-b22e4f24.patch OBS-URL: https://build.opensuse.org/request/show/783429 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-libvirt-python?expand=0&rev=31
This commit is contained in:
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:785f64755fc78a0eafecef74676fecf2bbbd2eaa6587ef697119ef6e1a68dbfd
|
|
||||||
size 196791
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
-----BEGIN PGP SIGNATURE-----
|
|
||||||
|
|
||||||
iQEzBAABCAAdFiEE20ZoG7ka3OoXD6LUFViLJllr6l0FAl4fLyIACgkQFViLJllr
|
|
||||||
6l308wgApVwdA5ArrGzrT68vmX1IramfH9iEcdfbD+F+dbrxchUoqLIKP0bz2oyS
|
|
||||||
P7uyEObRtqkTmhT9O6+w9Tv5mvKJs5UdG6+phBYdHBStLoq4MxK6Tmlsw2r7cApv
|
|
||||||
Mg2jRjgKUxEkTF5J4oHT1+txhzX7lIgQ3TL6ajHsXtxoIvBdbRxZy2bth6J17S+M
|
|
||||||
gQyr14FQBj9luKZHGye4QpYQU7jclbvnaRJ96Q3zZwzALkCVTuGMRkzP2xG66dMO
|
|
||||||
6yzuh1qKzvgZecDvqi6uJ1Ylx3yrBkAZ8/1J5bxbT58LTaF+ebjrnavsAmqxejeY
|
|
||||||
TYyA1/o5I2R2sUyiVkozhBclLCNNaA==
|
|
||||||
=LgBP
|
|
||||||
-----END PGP SIGNATURE-----
|
|
||||||
3
libvirt-python-6.1.0.tar.gz
Normal file
3
libvirt-python-6.1.0.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:be644f4809c0e1d368e3ac065df3c66a26dcfe61ecb607ee9706e1799f22c35a
|
||||||
|
size 196848
|
||||||
11
libvirt-python-6.1.0.tar.gz.asc
Normal file
11
libvirt-python-6.1.0.tar.gz.asc
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
-----BEGIN PGP SIGNATURE-----
|
||||||
|
|
||||||
|
iQEzBAABCAAdFiEE20ZoG7ka3OoXD6LUFViLJllr6l0FAl5eYUIACgkQFViLJllr
|
||||||
|
6l0TfwgAwagNNYaUxYHc9Gf4GrnifaQFrWkfsXC/zpcH0P9jWQ2T05wpyUKTwqRs
|
||||||
|
BGMCmXwgzjzYTunjhZ3scyFwGmslJmTN/TEZq4eyLJVKiydklReepngKOrR7KrxV
|
||||||
|
miqTjD2XehUCj7zltGUN+uHX0rHyP5JO/rzmPP0b9u8TimnTlQyWyM9zRfAv7UqS
|
||||||
|
er5VlAckVqQ203uRV6hzNZq2ReXxVACtvlr/vaVDF15K4gd8l9jf8risu4Y+R8V4
|
||||||
|
kckh2LINirCNAyhVPRH5Ln2+GX0lt8VPDT7iUN+D0AZ+soFRo/D4YG4H5rgFwlzi
|
||||||
|
dsPyAvG/4qnAuWtoiPqxh7pvG+mlTA==
|
||||||
|
=CARu
|
||||||
|
-----END PGP SIGNATURE-----
|
||||||
@@ -1,3 +1,15 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Mar 10 01:53:51 UTC 2020 - James Fehlig <jfehlig@suse.com>
|
||||||
|
|
||||||
|
- Update to 6.1.0
|
||||||
|
- Add all new APIs and constants in libvirt 6.1.0
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Feb 6 23:16:01 UTC 2020 - James Fehlig <jfehlig@suse.com>
|
||||||
|
|
||||||
|
- Stop building for python2
|
||||||
|
Dropped patches: revert-b22e4f24.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Jan 15 19:33:21 UTC 2020 - James Fehlig <jfehlig@suse.com>
|
Wed Jan 15 19:33:21 UTC 2020 - James Fehlig <jfehlig@suse.com>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-libvirt-python
|
# spec file for package python-libvirt-python
|
||||||
#
|
#
|
||||||
# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
|
# Copyright (c) 2020 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@@ -16,11 +16,14 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
# No longer build for python2. Support was dropped upstream in the 6.0.0 release
|
||||||
|
%define skip_python2 1
|
||||||
|
|
||||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||||
%define srcname libvirt-python
|
%define srcname libvirt-python
|
||||||
Name: python-libvirt-python
|
Name: python-libvirt-python
|
||||||
URL: https://libvirt.org/
|
URL: https://libvirt.org/
|
||||||
Version: 6.0.0
|
Version: 6.1.0
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Library providing a virtualization API
|
Summary: Library providing a virtualization API
|
||||||
License: LGPL-2.1-or-later
|
License: LGPL-2.1-or-later
|
||||||
@@ -28,7 +31,6 @@ Group: Development/Languages/Python
|
|||||||
Source0: %{srcname}-%{version}.tar.gz
|
Source0: %{srcname}-%{version}.tar.gz
|
||||||
Source1: %{srcname}-%{version}.tar.gz.asc
|
Source1: %{srcname}-%{version}.tar.gz.asc
|
||||||
Source2: python-libvirt-python.keyring
|
Source2: python-libvirt-python.keyring
|
||||||
Patch0: revert-b22e4f24.patch
|
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: libvirt-devel = %{version}
|
BuildRequires: libvirt-devel = %{version}
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
@@ -50,7 +52,6 @@ of recent versions of Linux (v2.6.20+).
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n %{srcname}-%{version}
|
%setup -q -n %{srcname}-%{version}
|
||||||
%patch0 -p1
|
|
||||||
|
|
||||||
# Unset execute bit for example scripts; it can introduce spurious
|
# Unset execute bit for example scripts; it can introduce spurious
|
||||||
# RPM dependencies, like /usr/bin/python which can pull in python2
|
# RPM dependencies, like /usr/bin/python which can pull in python2
|
||||||
|
|||||||
@@ -1,855 +0,0 @@
|
|||||||
commit 5d143f0c339ce1b05b43cba9b45a549a0f225463
|
|
||||||
Author: Jim Fehlig <jfehlig@suse.com>
|
|
||||||
Date: Thu Jan 16 15:34:22 2020 -0700
|
|
||||||
|
|
||||||
Revert "Drop support for python 2"
|
|
||||||
|
|
||||||
This reverts commit b22e4f2441078aec048b9503fde2b45e78710ce1.
|
|
||||||
|
|
||||||
On SUSE, we'll keep python2 binding for a bit longer.
|
|
||||||
|
|
||||||
Index: libvirt-python-6.0.0/examples/consolecallback.py
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/examples/consolecallback.py
|
|
||||||
+++ libvirt-python-6.0.0/examples/consolecallback.py
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/env python3
|
|
||||||
+#!/usr/bin/env python
|
|
||||||
# consolecallback - provide a persistent console that survives guest reboots
|
|
||||||
|
|
||||||
import sys, os, logging, libvirt, tty, termios, atexit
|
|
||||||
Index: libvirt-python-6.0.0/examples/dominfo.py
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/examples/dominfo.py
|
|
||||||
+++ libvirt-python-6.0.0/examples/dominfo.py
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/env python3
|
|
||||||
+#!/usr/bin/env python
|
|
||||||
# dominfo - print some information about a domain
|
|
||||||
|
|
||||||
import libvirt
|
|
||||||
Index: libvirt-python-6.0.0/examples/domipaddrs.py
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/examples/domipaddrs.py
|
|
||||||
+++ libvirt-python-6.0.0/examples/domipaddrs.py
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/env python3
|
|
||||||
+#!/usr/bin/env python
|
|
||||||
# domipaddrs - print domain interfaces along with their MAC and IP addresses
|
|
||||||
|
|
||||||
import libvirt
|
|
||||||
Index: libvirt-python-6.0.0/examples/domrestore.py
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/examples/domrestore.py
|
|
||||||
+++ libvirt-python-6.0.0/examples/domrestore.py
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/env python3
|
|
||||||
+#!/usr/bin/env python
|
|
||||||
# domstart - make sure a given domU is running, if not start it
|
|
||||||
|
|
||||||
import libvirt
|
|
||||||
Index: libvirt-python-6.0.0/examples/domsave.py
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/examples/domsave.py
|
|
||||||
+++ libvirt-python-6.0.0/examples/domsave.py
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/env python3
|
|
||||||
+#!/usr/bin/env python
|
|
||||||
# domstart - make sure a given domU is running, if not start it
|
|
||||||
|
|
||||||
import libvirt
|
|
||||||
Index: libvirt-python-6.0.0/examples/domstart.py
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/examples/domstart.py
|
|
||||||
+++ libvirt-python-6.0.0/examples/domstart.py
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/env python3
|
|
||||||
+#!/usr/bin/env python
|
|
||||||
# domstart - make sure a given domU is running, if not start it
|
|
||||||
|
|
||||||
import libvirt
|
|
||||||
Index: libvirt-python-6.0.0/examples/esxlist.py
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/examples/esxlist.py
|
|
||||||
+++ libvirt-python-6.0.0/examples/esxlist.py
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/env python3
|
|
||||||
+#!/usr/bin/env python
|
|
||||||
# esxlist - list active domains of an ESX host and print some info.
|
|
||||||
# also demonstrates how to use the libvirt.openAuth() method
|
|
||||||
|
|
||||||
Index: libvirt-python-6.0.0/examples/event-test.py
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/examples/event-test.py
|
|
||||||
+++ libvirt-python-6.0.0/examples/event-test.py
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/env python3
|
|
||||||
+#!/usr/bin/env python
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
Index: libvirt-python-6.0.0/examples/guest-vcpus/guest-vcpu-daemon.py
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/examples/guest-vcpus/guest-vcpu-daemon.py
|
|
||||||
+++ libvirt-python-6.0.0/examples/guest-vcpus/guest-vcpu-daemon.py
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/env python3
|
|
||||||
+#!/usr/bin/env python
|
|
||||||
|
|
||||||
import libvirt
|
|
||||||
import threading
|
|
||||||
Index: libvirt-python-6.0.0/examples/guest-vcpus/guest-vcpu.py
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/examples/guest-vcpus/guest-vcpu.py
|
|
||||||
+++ libvirt-python-6.0.0/examples/guest-vcpus/guest-vcpu.py
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/env python3
|
|
||||||
+#!/usr/bin/env python
|
|
||||||
|
|
||||||
import libvirt
|
|
||||||
import sys
|
|
||||||
Index: libvirt-python-6.0.0/examples/nodestats.py
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/examples/nodestats.py
|
|
||||||
+++ libvirt-python-6.0.0/examples/nodestats.py
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/env python3
|
|
||||||
+#!/usr/bin/env python
|
|
||||||
# Print some host NUMA node statistics
|
|
||||||
#
|
|
||||||
# Authors:
|
|
||||||
Index: libvirt-python-6.0.0/examples/topology.py
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/examples/topology.py
|
|
||||||
+++ libvirt-python-6.0.0/examples/topology.py
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/env python3
|
|
||||||
+#!/usr/bin/env python
|
|
||||||
# Parse topology information from the capabilities XML and use
|
|
||||||
# them to calculate host topology
|
|
||||||
#
|
|
||||||
Index: libvirt-python-6.0.0/generator.py
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/generator.py
|
|
||||||
+++ libvirt-python-6.0.0/generator.py
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/env python3
|
|
||||||
+#!/usr/bin/env python
|
|
||||||
#
|
|
||||||
# generate python wrappers from the XML API description
|
|
||||||
#
|
|
||||||
Index: libvirt-python-6.0.0/libvirt-lxc-override.c
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/libvirt-lxc-override.c
|
|
||||||
+++ libvirt-python-6.0.0/libvirt-lxc-override.c
|
|
||||||
@@ -4,13 +4,13 @@
|
|
||||||
* entry points where an automatically generated stub is
|
|
||||||
* unpractical
|
|
||||||
*
|
|
||||||
- * Copyright (C) 2012-2019 Red Hat, Inc.
|
|
||||||
+ * Copyright (C) 2012-2013 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* Daniel Veillard <veillard@redhat.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Horrible kludge to work around even more horrible name-space pollution
|
|
||||||
- via Python.h. That file includes /usr/include/python3.x/pyconfig*.h,
|
|
||||||
+ via Python.h. That file includes /usr/include/python2.5/pyconfig*.h,
|
|
||||||
which has over 180 autoconf-style HAVE_* definitions. Shame on them. */
|
|
||||||
#undef HAVE_PTHREAD_H
|
|
||||||
|
|
||||||
@@ -21,10 +21,18 @@
|
|
||||||
#include "libvirt-utils.h"
|
|
||||||
#include "build/libvirt-lxc.h"
|
|
||||||
|
|
||||||
-#ifndef __CYGWIN__
|
|
||||||
+#if PY_MAJOR_VERSION > 2
|
|
||||||
+# ifndef __CYGWIN__
|
|
||||||
extern PyObject *PyInit_libvirtmod_lxc(void);
|
|
||||||
-#else
|
|
||||||
+# else
|
|
||||||
extern PyObject *PyInit_cygvirtmod_lxc(void);
|
|
||||||
+# endif
|
|
||||||
+#else
|
|
||||||
+# ifndef __CYGWIN__
|
|
||||||
+extern void initlibvirtmod_lxc(void);
|
|
||||||
+# else
|
|
||||||
+extern void initcygvirtmod_lxc(void);
|
|
||||||
+# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
@@ -99,13 +107,14 @@ 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,
|
|
||||||
@@ -116,11 +125,11 @@ static struct PyModuleDef moduledef = {
|
|
||||||
};
|
|
||||||
|
|
||||||
PyObject *
|
|
||||||
-#ifndef __CYGWIN__
|
|
||||||
+# ifndef __CYGWIN__
|
|
||||||
PyInit_libvirtmod_lxc
|
|
||||||
-#else
|
|
||||||
+# else
|
|
||||||
PyInit_cygvirtmod_lxc
|
|
||||||
-#endif
|
|
||||||
+# endif
|
|
||||||
(void)
|
|
||||||
{
|
|
||||||
PyObject *module;
|
|
||||||
@@ -132,3 +141,25 @@ 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 */
|
|
||||||
Index: libvirt-python-6.0.0/libvirt-override.c
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/libvirt-override.c
|
|
||||||
+++ libvirt-python-6.0.0/libvirt-override.c
|
|
||||||
@@ -4,13 +4,13 @@
|
|
||||||
* entry points where an automatically generated stub is
|
|
||||||
* unpractical
|
|
||||||
*
|
|
||||||
- * Copyright (C) 2005-2019 Red Hat, Inc.
|
|
||||||
+ * Copyright (C) 2005, 2007-2015 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* Daniel Veillard <veillard@redhat.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Horrible kludge to work around even more horrible name-space pollution
|
|
||||||
- via Python.h. That file includes /usr/include/python3.x/pyconfig*.h,
|
|
||||||
+ via Python.h. That file includes /usr/include/python2.5/pyconfig*.h,
|
|
||||||
which has over 180 autoconf-style HAVE_* definitions. Shame on them. */
|
|
||||||
#undef HAVE_PTHREAD_H
|
|
||||||
|
|
||||||
@@ -25,10 +25,18 @@
|
|
||||||
#include "build/libvirt.h"
|
|
||||||
#include "libvirt-utils.h"
|
|
||||||
|
|
||||||
-#ifndef __CYGWIN__
|
|
||||||
+#if PY_MAJOR_VERSION > 2
|
|
||||||
+# ifndef __CYGWIN__
|
|
||||||
extern PyObject *PyInit_libvirtmod(void);
|
|
||||||
-#else
|
|
||||||
+# else
|
|
||||||
extern PyObject *PyInit_cygvirtmod(void);
|
|
||||||
+# endif
|
|
||||||
+#else
|
|
||||||
+# ifndef __CYGWIN__
|
|
||||||
+extern void initlibvirtmod(void);
|
|
||||||
+# else
|
|
||||||
+extern void initcygvirtmod(void);
|
|
||||||
+# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
@@ -10628,13 +10636,14 @@ static PyMethodDef libvirtMethods[] = {
|
|
||||||
{NULL, NULL, 0, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
+#if PY_MAJOR_VERSION > 2
|
|
||||||
static struct PyModuleDef moduledef = {
|
|
||||||
PyModuleDef_HEAD_INIT,
|
|
||||||
-#ifndef __CYGWIN__
|
|
||||||
+# ifndef __CYGWIN__
|
|
||||||
"libvirtmod",
|
|
||||||
-#else
|
|
||||||
+# else
|
|
||||||
"cygvirtmod",
|
|
||||||
-#endif
|
|
||||||
+# endif
|
|
||||||
NULL,
|
|
||||||
-1,
|
|
||||||
libvirtMethods,
|
|
||||||
@@ -10645,11 +10654,11 @@ static struct PyModuleDef moduledef = {
|
|
||||||
};
|
|
||||||
|
|
||||||
PyObject *
|
|
||||||
-#ifndef __CYGWIN__
|
|
||||||
+# ifndef __CYGWIN__
|
|
||||||
PyInit_libvirtmod
|
|
||||||
-#else
|
|
||||||
+# else
|
|
||||||
PyInit_cygvirtmod
|
|
||||||
-#endif
|
|
||||||
+# endif
|
|
||||||
(void)
|
|
||||||
{
|
|
||||||
PyObject *module;
|
|
||||||
@@ -10661,3 +10670,25 @@ PyInit_cygvirtmod
|
|
||||||
|
|
||||||
return module;
|
|
||||||
}
|
|
||||||
+#else /* ! PY_MAJOR_VERSION > 2 */
|
|
||||||
+void
|
|
||||||
+# ifndef __CYGWIN__
|
|
||||||
+initlibvirtmod
|
|
||||||
+# else
|
|
||||||
+initcygvirtmod
|
|
||||||
+# endif
|
|
||||||
+(void)
|
|
||||||
+{
|
|
||||||
+ if (virInitialize() < 0)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ /* initialize the python extension module */
|
|
||||||
+ Py_InitModule((char *)
|
|
||||||
+# ifndef __CYGWIN__
|
|
||||||
+ "libvirtmod",
|
|
||||||
+# else
|
|
||||||
+ "cygvirtmod",
|
|
||||||
+# endif
|
|
||||||
+ libvirtMethods);
|
|
||||||
+}
|
|
||||||
+#endif /* ! PY_MAJOR_VERSION > 2 */
|
|
||||||
Index: libvirt-python-6.0.0/libvirt-qemu-override.c
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/libvirt-qemu-override.c
|
|
||||||
+++ libvirt-python-6.0.0/libvirt-qemu-override.c
|
|
||||||
@@ -4,13 +4,13 @@
|
|
||||||
* entry points where an automatically generated stub is
|
|
||||||
* unpractical
|
|
||||||
*
|
|
||||||
- * Copyright (C) 2011-2019 Red Hat, Inc.
|
|
||||||
+ * Copyright (C) 2011-2014 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* Daniel Veillard <veillard@redhat.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Horrible kludge to work around even more horrible name-space pollution
|
|
||||||
- via Python.h. That file includes /usr/include/python3.x/pyconfig*.h,
|
|
||||||
+ via Python.h. That file includes /usr/include/python2.5/pyconfig*.h,
|
|
||||||
which has over 180 autoconf-style HAVE_* definitions. Shame on them. */
|
|
||||||
#undef HAVE_PTHREAD_H
|
|
||||||
|
|
||||||
@@ -21,10 +21,18 @@
|
|
||||||
#include "libvirt-utils.h"
|
|
||||||
#include "build/libvirt-qemu.h"
|
|
||||||
|
|
||||||
-#ifndef __CYGWIN__
|
|
||||||
+#if PY_MAJOR_VERSION > 2
|
|
||||||
+# ifndef __CYGWIN__
|
|
||||||
extern PyObject *PyInit_libvirtmod_qemu(void);
|
|
||||||
-#else
|
|
||||||
+# else
|
|
||||||
extern PyObject *PyInit_cygvirtmod_qemu(void);
|
|
||||||
+# endif
|
|
||||||
+#else
|
|
||||||
+# ifndef __CYGWIN__
|
|
||||||
+extern void initlibvirtmod_qemu(void);
|
|
||||||
+# else
|
|
||||||
+extern void initcygvirtmod_qemu(void);
|
|
||||||
+# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
@@ -343,13 +351,14 @@ static PyMethodDef libvirtQemuMethods[]
|
|
||||||
{NULL, NULL, 0, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
+#if PY_MAJOR_VERSION > 2
|
|
||||||
static struct PyModuleDef moduledef = {
|
|
||||||
PyModuleDef_HEAD_INIT,
|
|
||||||
-#ifndef __CYGWIN__
|
|
||||||
+# ifndef __CYGWIN__
|
|
||||||
"libvirtmod_qemu",
|
|
||||||
-#else
|
|
||||||
+# else
|
|
||||||
"cygvirtmod_qemu",
|
|
||||||
-#endif
|
|
||||||
+# endif
|
|
||||||
NULL,
|
|
||||||
-1,
|
|
||||||
libvirtQemuMethods,
|
|
||||||
@@ -360,11 +369,11 @@ static struct PyModuleDef moduledef = {
|
|
||||||
};
|
|
||||||
|
|
||||||
PyObject *
|
|
||||||
-#ifndef __CYGWIN__
|
|
||||||
+# ifndef __CYGWIN__
|
|
||||||
PyInit_libvirtmod_qemu
|
|
||||||
-#else
|
|
||||||
+# else
|
|
||||||
PyInit_cygvirtmod_qemu
|
|
||||||
-#endif
|
|
||||||
+# endif
|
|
||||||
(void)
|
|
||||||
{
|
|
||||||
PyObject *module;
|
|
||||||
@@ -376,3 +385,25 @@ PyInit_cygvirtmod_qemu
|
|
||||||
|
|
||||||
return module;
|
|
||||||
}
|
|
||||||
+#else /* ! PY_MAJOR_VERSION > 2 */
|
|
||||||
+void
|
|
||||||
+# ifndef __CYGWIN__
|
|
||||||
+initlibvirtmod_qemu
|
|
||||||
+# else
|
|
||||||
+initcygvirtmod_qemu
|
|
||||||
+# endif
|
|
||||||
+(void)
|
|
||||||
+{
|
|
||||||
+ if (virInitialize() < 0)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ /* initialize the python extension module */
|
|
||||||
+ Py_InitModule((char *)
|
|
||||||
+# ifndef __CYGWIN__
|
|
||||||
+ "libvirtmod_qemu",
|
|
||||||
+# else
|
|
||||||
+ "cygvirtmod_qemu",
|
|
||||||
+# endif
|
|
||||||
+ libvirtQemuMethods);
|
|
||||||
+}
|
|
||||||
+#endif /* ! PY_MAJOR_VERSION > 2 */
|
|
||||||
Index: libvirt-python-6.0.0/libvirt-utils.c
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/libvirt-utils.c
|
|
||||||
+++ libvirt-python-6.0.0/libvirt-utils.c
|
|
||||||
@@ -1,7 +1,7 @@
|
|
||||||
/*
|
|
||||||
* libvirt-utils.c: misc helper APIs for python binding
|
|
||||||
*
|
|
||||||
- * Copyright (C) 2013-2019 Red Hat, Inc.
|
|
||||||
+ * Copyright (C) 2013 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
@@ -274,7 +274,11 @@ setPyVirTypedParameter(PyObject *info,
|
|
||||||
int nparams)
|
|
||||||
{
|
|
||||||
PyObject *key, *value;
|
|
||||||
+#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION <= 4
|
|
||||||
+ int pos = 0;
|
|
||||||
+#else
|
|
||||||
Py_ssize_t pos = 0;
|
|
||||||
+#endif
|
|
||||||
virTypedParameterPtr temp = NULL, ret = NULL;
|
|
||||||
Py_ssize_t size;
|
|
||||||
ssize_t i;
|
|
||||||
@@ -412,6 +416,13 @@ virPyDictToTypedParamOne(virTypedParamet
|
|
||||||
type = VIR_TYPED_PARAM_LLONG;
|
|
||||||
else
|
|
||||||
type = VIR_TYPED_PARAM_ULLONG;
|
|
||||||
+#if PY_MAJOR_VERSION < 3
|
|
||||||
+ } else if (PyInt_Check(value)) {
|
|
||||||
+ if (PyInt_AS_LONG(value) < 0)
|
|
||||||
+ type = VIR_TYPED_PARAM_LLONG;
|
|
||||||
+ else
|
|
||||||
+ type = VIR_TYPED_PARAM_ULLONG;
|
|
||||||
+#endif
|
|
||||||
} else if (PyFloat_Check(value)) {
|
|
||||||
type = VIR_TYPED_PARAM_DOUBLE;
|
|
||||||
}
|
|
||||||
@@ -509,7 +520,11 @@ virPyDictToTypedParams(PyObject *dict,
|
|
||||||
{
|
|
||||||
PyObject *key;
|
|
||||||
PyObject *value;
|
|
||||||
+#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION <= 4
|
|
||||||
+ int pos = 0;
|
|
||||||
+#else
|
|
||||||
Py_ssize_t pos = 0;
|
|
||||||
+#endif
|
|
||||||
virTypedParameterPtr params = NULL;
|
|
||||||
int n = 0;
|
|
||||||
int max = 0;
|
|
||||||
Index: libvirt-python-6.0.0/libvirt-utils.h
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/libvirt-utils.h
|
|
||||||
+++ libvirt-python-6.0.0/libvirt-utils.h
|
|
||||||
@@ -139,7 +139,11 @@ int virReallocN(void *ptrptr, size_t siz
|
|
||||||
void virFree(void *ptrptr) ATTRIBUTE_NONNULL(1);
|
|
||||||
|
|
||||||
|
|
||||||
-# define libvirt_PyString_Check PyUnicode_Check
|
|
||||||
+# if PY_MAJOR_VERSION > 2
|
|
||||||
+# define libvirt_PyString_Check PyUnicode_Check
|
|
||||||
+# else
|
|
||||||
+# define libvirt_PyString_Check PyString_Check
|
|
||||||
+# endif
|
|
||||||
|
|
||||||
|
|
||||||
#define VIR_N_ELEMENTS(array) (sizeof(array) / sizeof(*(array)))
|
|
||||||
Index: libvirt-python-6.0.0/sanitytest.py
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/sanitytest.py
|
|
||||||
+++ libvirt-python-6.0.0/sanitytest.py
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/env python3
|
|
||||||
+#!/usr/bin/env python
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import lxml
|
|
||||||
Index: libvirt-python-6.0.0/setup.py
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/setup.py
|
|
||||||
+++ libvirt-python-6.0.0/setup.py
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/env python3
|
|
||||||
+#!/usr/bin/env python
|
|
||||||
|
|
||||||
from distutils.core import setup, Extension, Command
|
|
||||||
from distutils.command.build import build
|
|
||||||
@@ -17,10 +17,6 @@ import re
|
|
||||||
import shutil
|
|
||||||
import time
|
|
||||||
|
|
||||||
-if sys.version_info[0] != 3:
|
|
||||||
- print("libvirt-python requires Python 3.x to build")
|
|
||||||
- sys.exit(1)
|
|
||||||
-
|
|
||||||
MIN_LIBVIRT = "0.9.11"
|
|
||||||
MIN_LIBVIRT_LXC = "1.0.2"
|
|
||||||
|
|
||||||
@@ -346,7 +342,7 @@ setup(name = 'libvirt-python',
|
|
||||||
description = 'The libvirt virtualization API python binding',
|
|
||||||
long_description =
|
|
||||||
'''The libvirt-python package provides a module that permits applications
|
|
||||||
-written in the Python 3.x programming language to call the interface
|
|
||||||
+written in the Python programming language to call the interface
|
|
||||||
supplied by the libvirt library, to manage the virtualization capabilities
|
|
||||||
of recent versions of Linux (and other OSes).''',
|
|
||||||
license = 'LGPLv2+',
|
|
||||||
@@ -367,6 +363,7 @@ of recent versions of Linux (and other O
|
|
||||||
"Intended Audience :: Developers",
|
|
||||||
"License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)",
|
|
||||||
"Programming Language :: Python",
|
|
||||||
+ "Programming Language :: Python :: 2",
|
|
||||||
"Programming Language :: Python :: 3",
|
|
||||||
]
|
|
||||||
)
|
|
||||||
Index: libvirt-python-6.0.0/typewrappers.c
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/typewrappers.c
|
|
||||||
+++ libvirt-python-6.0.0/typewrappers.c
|
|
||||||
@@ -2,88 +2,141 @@
|
|
||||||
* types.c: converter functions between the internal representation
|
|
||||||
* and the Python objects
|
|
||||||
*
|
|
||||||
- * Copyright (C) 2005-2019 Red Hat, Inc.
|
|
||||||
+ * Copyright (C) 2005, 2007, 2012 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* Daniel Veillard <veillard@redhat.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Horrible kludge to work around even more horrible name-space pollution
|
|
||||||
- * via Python.h. That file includes /usr/include/python3.x/pyconfig*.h,
|
|
||||||
- * which has over 180 autoconf-style HAVE_* definitions. Shame on them. */
|
|
||||||
+ * via Python.h. That file includes /usr/include/python2.5/pyconfig*.h,
|
|
||||||
+ * which has over 180 autoconf-style HAVE_* definitions. Shame on them. */
|
|
||||||
#undef HAVE_PTHREAD_H
|
|
||||||
|
|
||||||
#include "typewrappers.h"
|
|
||||||
#include "libvirt-utils.h"
|
|
||||||
|
|
||||||
+#ifndef Py_CAPSULE_H
|
|
||||||
+typedef void(*PyCapsule_Destructor)(void *, void *);
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
static PyObject *
|
|
||||||
libvirt_buildPyObject(void *cobj,
|
|
||||||
const char *name,
|
|
||||||
PyCapsule_Destructor destr)
|
|
||||||
{
|
|
||||||
- return PyCapsule_New(cobj, name, destr);
|
|
||||||
+ PyObject *ret;
|
|
||||||
+
|
|
||||||
+#ifdef Py_CAPSULE_H
|
|
||||||
+ ret = PyCapsule_New(cobj, name, destr);
|
|
||||||
+#else
|
|
||||||
+ ret = PyCObject_FromVoidPtrAndDesc(cobj, (void *) name, destr);
|
|
||||||
+#endif /* _TEST_CAPSULE */
|
|
||||||
+
|
|
||||||
+ return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
PyObject *
|
|
||||||
libvirt_intWrap(int val)
|
|
||||||
{
|
|
||||||
- return PyLong_FromLong((long) val);
|
|
||||||
+ PyObject *ret;
|
|
||||||
+#if PY_MAJOR_VERSION > 2
|
|
||||||
+ ret = PyLong_FromLong((long) val);
|
|
||||||
+#else
|
|
||||||
+ ret = PyInt_FromLong((long) val);
|
|
||||||
+#endif
|
|
||||||
+ return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
PyObject *
|
|
||||||
libvirt_uintWrap(uint val)
|
|
||||||
{
|
|
||||||
- return PyLong_FromLong((long) val);
|
|
||||||
+ PyObject *ret;
|
|
||||||
+#if PY_MAJOR_VERSION > 2
|
|
||||||
+ ret = PyLong_FromLong((long) val);
|
|
||||||
+#else
|
|
||||||
+ ret = PyInt_FromLong((long) val);
|
|
||||||
+#endif
|
|
||||||
+ return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
PyObject *
|
|
||||||
libvirt_longWrap(long val)
|
|
||||||
{
|
|
||||||
- return PyLong_FromLong(val);
|
|
||||||
+ PyObject *ret;
|
|
||||||
+ ret = PyLong_FromLong(val);
|
|
||||||
+ return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
PyObject *
|
|
||||||
libvirt_ulongWrap(unsigned long val)
|
|
||||||
{
|
|
||||||
- return PyLong_FromLong(val);
|
|
||||||
+ PyObject *ret;
|
|
||||||
+ ret = PyLong_FromLong(val);
|
|
||||||
+ return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
PyObject *
|
|
||||||
libvirt_longlongWrap(long long val)
|
|
||||||
{
|
|
||||||
- return PyLong_FromLongLong(val);
|
|
||||||
+ PyObject *ret;
|
|
||||||
+ ret = PyLong_FromLongLong(val);
|
|
||||||
+ return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
PyObject *
|
|
||||||
libvirt_ulonglongWrap(unsigned long long val)
|
|
||||||
{
|
|
||||||
- return PyLong_FromUnsignedLongLong(val);
|
|
||||||
+ PyObject *ret;
|
|
||||||
+ ret = PyLong_FromUnsignedLongLong(val);
|
|
||||||
+ return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
PyObject *
|
|
||||||
libvirt_charPtrSizeWrap(char *str, Py_ssize_t size)
|
|
||||||
{
|
|
||||||
+ PyObject *ret;
|
|
||||||
+
|
|
||||||
if (str == NULL) {
|
|
||||||
return VIR_PY_NONE;
|
|
||||||
}
|
|
||||||
- return PyBytes_FromStringAndSize(str, size);
|
|
||||||
+#if PY_MAJOR_VERSION > 2
|
|
||||||
+ ret = PyBytes_FromStringAndSize(str, size);
|
|
||||||
+#else
|
|
||||||
+ ret = PyString_FromStringAndSize(str, size);
|
|
||||||
+#endif
|
|
||||||
+ return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
PyObject *
|
|
||||||
libvirt_charPtrWrap(char *str)
|
|
||||||
{
|
|
||||||
+ PyObject *ret;
|
|
||||||
+
|
|
||||||
if (str == NULL) {
|
|
||||||
return VIR_PY_NONE;
|
|
||||||
}
|
|
||||||
- return PyUnicode_FromString(str);
|
|
||||||
+#if PY_MAJOR_VERSION > 2
|
|
||||||
+ ret = PyUnicode_FromString(str);
|
|
||||||
+#else
|
|
||||||
+ ret = PyString_FromString(str);
|
|
||||||
+#endif
|
|
||||||
+ return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
PyObject *
|
|
||||||
libvirt_constcharPtrWrap(const char *str)
|
|
||||||
{
|
|
||||||
+ PyObject *ret;
|
|
||||||
+
|
|
||||||
if (str == NULL) {
|
|
||||||
return VIR_PY_NONE;
|
|
||||||
}
|
|
||||||
- return PyUnicode_FromString(str);
|
|
||||||
+#if PY_MAJOR_VERSION > 2
|
|
||||||
+ ret = PyUnicode_FromString(str);
|
|
||||||
+#else
|
|
||||||
+ ret = PyString_FromString(str);
|
|
||||||
+#endif
|
|
||||||
+ return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
PyObject *
|
|
||||||
@@ -110,7 +163,11 @@ libvirt_intUnwrap(PyObject *obj,
|
|
||||||
* to C long type directly. If it is of PyLong_Type, PyInt_AsLong
|
|
||||||
* will call PyLong_AsLong() to deal with it automatically.
|
|
||||||
*/
|
|
||||||
+#if PY_MAJOR_VERSION > 2
|
|
||||||
long_val = PyLong_AsLong(obj);
|
|
||||||
+#else
|
|
||||||
+ long_val = PyInt_AsLong(obj);
|
|
||||||
+#endif
|
|
||||||
if ((long_val == -1) && PyErr_Occurred())
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
@@ -139,7 +196,11 @@ libvirt_uintUnwrap(PyObject *obj,
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#if PY_MAJOR_VERSION > 2
|
|
||||||
long_val = PyLong_AsLong(obj);
|
|
||||||
+#else
|
|
||||||
+ long_val = PyInt_AsLong(obj);
|
|
||||||
+#endif
|
|
||||||
if ((long_val == -1) && PyErr_Occurred())
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
@@ -208,7 +269,14 @@ libvirt_longlongUnwrap(PyObject *obj,
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#if PY_MAJOR_VERSION == 2
|
|
||||||
+ /* If obj is of PyInt_Type, PyLong_AsLongLong
|
|
||||||
+ * will call PyInt_AsLong() to handle it automatically.
|
|
||||||
+ */
|
|
||||||
+ if (PyInt_Check(obj) || PyLong_Check(obj))
|
|
||||||
+#else
|
|
||||||
if (PyLong_Check(obj))
|
|
||||||
+#endif
|
|
||||||
llong_val = PyLong_AsLongLong(obj);
|
|
||||||
else
|
|
||||||
PyErr_SetString(PyExc_TypeError, "an integer is required");
|
|
||||||
@@ -231,7 +299,21 @@ libvirt_ulonglongUnwrap(PyObject *obj,
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#if PY_MAJOR_VERSION == 2
|
|
||||||
+ /* The PyLong_AsUnsignedLongLong doesn't check the type of
|
|
||||||
+ * obj, only accept argument of PyLong_Type, so we check it instead.
|
|
||||||
+ */
|
|
||||||
+ if (PyInt_Check(obj)) {
|
|
||||||
+ long long llong_val = PyInt_AsLong(obj);
|
|
||||||
+ if (llong_val < 0)
|
|
||||||
+ PyErr_SetString(PyExc_OverflowError,
|
|
||||||
+ "negative Python int cannot be converted to C unsigned long long");
|
|
||||||
+ else
|
|
||||||
+ ullong_val = llong_val;
|
|
||||||
+ } else if (PyLong_Check(obj)) {
|
|
||||||
+#else
|
|
||||||
if (PyLong_Check(obj)) {
|
|
||||||
+#endif
|
|
||||||
ullong_val = PyLong_AsUnsignedLongLong(obj);
|
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError, "an integer is required");
|
|
||||||
@@ -285,7 +367,9 @@ int
|
|
||||||
libvirt_charPtrUnwrap(PyObject *obj,
|
|
||||||
char **str)
|
|
||||||
{
|
|
||||||
+#if PY_MAJOR_VERSION > 2
|
|
||||||
PyObject *bytes;
|
|
||||||
+#endif
|
|
||||||
const char *ret;
|
|
||||||
*str = NULL;
|
|
||||||
if (!obj) {
|
|
||||||
@@ -293,15 +377,21 @@ libvirt_charPtrUnwrap(PyObject *obj,
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#if PY_MAJOR_VERSION > 2
|
|
||||||
if (!(bytes = PyUnicode_AsUTF8String(obj)))
|
|
||||||
return -1;
|
|
||||||
ret = PyBytes_AsString(bytes);
|
|
||||||
+#else
|
|
||||||
+ ret = PyString_AsString(obj);
|
|
||||||
+#endif
|
|
||||||
if (ret) {
|
|
||||||
*str = strdup(ret);
|
|
||||||
if (!*str)
|
|
||||||
PyErr_NoMemory();
|
|
||||||
}
|
|
||||||
+#if PY_MAJOR_VERSION > 2
|
|
||||||
Py_DECREF(bytes);
|
|
||||||
+#endif
|
|
||||||
return ret && *str ? 0 : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -310,6 +400,10 @@ libvirt_charPtrSizeUnwrap(PyObject *obj,
|
|
||||||
char **str,
|
|
||||||
Py_ssize_t *size)
|
|
||||||
{
|
|
||||||
+ int ret;
|
|
||||||
+#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION <= 4
|
|
||||||
+ int isize;
|
|
||||||
+#endif
|
|
||||||
*str = NULL;
|
|
||||||
*size = 0;
|
|
||||||
if (!obj) {
|
|
||||||
@@ -317,7 +411,18 @@ libvirt_charPtrSizeUnwrap(PyObject *obj,
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
- return PyBytes_AsStringAndSize(obj, str, size);
|
|
||||||
+#if PY_MAJOR_VERSION > 2
|
|
||||||
+ ret = PyBytes_AsStringAndSize(obj, str, size);
|
|
||||||
+#else
|
|
||||||
+# if PY_MINOR_VERSION <= 4
|
|
||||||
+ ret = PyString_AsStringAndSize(obj, str, &isize);
|
|
||||||
+ *size = isize;
|
|
||||||
+# else
|
|
||||||
+ ret = PyString_AsStringAndSize(obj, str, size);
|
|
||||||
+# endif
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+ return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
PyObject *
|
|
||||||
Index: libvirt-python-6.0.0/typewrappers.h
|
|
||||||
===================================================================
|
|
||||||
--- libvirt-python-6.0.0.orig/typewrappers.h
|
|
||||||
+++ libvirt-python-6.0.0/typewrappers.h
|
|
||||||
@@ -22,6 +22,11 @@
|
|
||||||
# define ATTRIBUTE_UNUSED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+/* Work around really old python. */
|
|
||||||
+#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5
|
|
||||||
+typedef ssize_t Py_ssize_t;
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
#if !LIBVIR_CHECK_VERSION(4, 5, 0)
|
|
||||||
typedef struct _virNWFilterBinding *virNWFilterBindingPtr;
|
|
||||||
#endif
|
|
||||||
Reference in New Issue
Block a user