[Pkg-libvirt-commits] [Git][libvirt-team/libvirt-python][upstream/latest] New upstream version 10.4.0
Pino Toscano (@pino)
gitlab at salsa.debian.org
Wed Jun 5 04:44:56 BST 2024
Pino Toscano pushed to branch upstream/latest at Libvirt Packaging Team / libvirt-python
Commits:
d76d7ed1 by Pino Toscano at 2024-06-04T23:57:38+02:00
New upstream version 10.4.0
- - - - -
10 changed files:
- ChangeLog
- PKG-INFO
- VERSION
- generator.py
- libvirt-lxc-override.c
- libvirt-override.c
- libvirt-python.spec
- libvirt-qemu-override.c
- setup.py
- tests/test_aio.py
Changes:
=====================================
ChangeLog
=====================================
@@ -1,3 +1,89 @@
+ 2024- 5- 2 Michal Privoznik <mprivozn at redhat.com>
+
+ ci: Drop CentOS 8 Stream and switch F38 to 40, Ubuntu 20.04 to 22.04
+ There a lot happening here, but that's because otherwise lcitool
+ fails to regenerate files. Firstly, CentOS 8 is dropped as it's
+ unsupported now. Secondly, Fedora 40 is introduced and Fedora 38
+ is dropped. And lastly, Ubuntu 24.04 is introduced and Ubuntu
+ 20.04 is dropped.
+
+
+
+ 2024- 5- 2 Michal Privoznik <mprivozn at redhat.com>
+
+ test_aio.py: Fix skip message
+ There are two unit tests in test_aio.py that are skipped if
+ Python is too new (3.10 or newer). But the message printed when
+ they are skipped mentions just 3.10 which is confusing. Change it
+ to "3.10+".
+
+
+
+ 2024- 5- 2 Michal Privoznik <mprivozn at redhat.com>
+
+ Switch to PyMODINIT_FUNC annotation
+ Instead of doing some 'extern ...' declaration magic to force
+ proper PyInit_libvirtmod*() symbol exposure in resulting .so we
+ can use what Python already offers - PyMODINIT_FUNC macro and
+ call it a day.
+
+
+
+ 2024- 5- 2 Michal Privoznik <mprivozn at redhat.com>
+
+ generator.py: Drop build/ prefix from #include
+ When -Ibuild flag is passed to compiler then build/ can be dropped
+ from includes. This is safe to do, because the prefix is only on
+ local includes (#include "") not system ones (#include <>).
+
+
+
+ 2024- 5- 2 Michal Privoznik <mprivozn at redhat.com>
+
+ generator.py: Switch from ${module}-export.c to ${module}-export.c.inc
+ The generator.py generates a (per module) table of functions it
+ generated code for and stores it in ${module}-export.c file. The
+ file is then #include-d in corresponding override.c in the table
+ of all methods implemented in the module.
+
+ Now, problem is with naming of the file because the ".c" suffix
+ might suggest the file needs to be compiled. Well, it doesn't.
+ It's way closer to being a header file, so change the suffix to
+ ".c.inc".
+
+
+
+ 2024- 5- 2 Michal Privoznik <mprivozn at redhat.com>
+
+ generator.py: Allow source and build dirs override
+ Soon generator.py is going to be ran from a build directory which
+ is different than the source directory. Allow specifying these
+ directories on the cmd line.
+
+ And while at it, introduce new "c+py" output mode in which both C
+ and Python files are generated. While this is a fallback mode if
+ no output mode is selected, we need this new mode so that
+ aforementioned directories can be specified.
+
+
+
+ 2024- 5- 2 Michal Privoznik <mprivozn at redhat.com>
+
+ setup.py: s/PY_VERSION/VERSION/
+ When generating spec file, @PY_VERSION@ is replaced with the
+ current version of libvirt-python. Well, it's not as obvious as
+ it could be: usually it's just @VERSION at . Worse, the PY_ prefix
+ may mislead readers into thinking it refers to python version.
+
+ Just drop the PY_ prefix.
+
+
+
+ 2024- 5- 2 Jiri Denemark <jdenemar at redhat.com>
+
+ Post-release version bump to 10.4.0
+
+
2024- 5- 1 Jelle van der Waa <jvanderwaa at redhat.com>
examples: replace logging.warn with logging.warning
=====================================
PKG-INFO
=====================================
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: libvirt-python
-Version: 10.3.0
+Version: 10.4.0
Summary: The libvirt virtualization API python binding
Home-page: http://www.libvirt.org
Maintainer: Libvirt Maintainers
=====================================
VERSION
=====================================
@@ -1 +1 @@
-10.3.0
+10.4.0
=====================================
generator.py
=====================================
@@ -31,6 +31,8 @@ quiet = True
#######################################################################
debug = 0
onlyOverrides = False
+sourceDir = "."
+buildDir = "build"
libvirt_headers = [
"libvirt",
@@ -49,6 +51,11 @@ libvirt_headers = [
"libvirt-stream",
]
+def openSourceFile(file: str, mode: str = "r", optional: bool = False):
+ path = os.path.join(sourceDir, file)
+ if optional and not os.path.exists(path):
+ return None
+ return open(path, mode)
def parse(data: IO[str]) -> None:
target = docParser()
@@ -297,7 +304,7 @@ py_types = {
#######################################################################
#
# This part writes the C <-> Python stubs libvirt.[ch] and
-# the table libvirt-export.c to add when registering the Python module
+# the table libvirt-export.c.inc to add when registering the Python module
#
#######################################################################
@@ -853,7 +860,7 @@ def load_apis(module: str, api_xml: str):
try:
onlyOverrides = True
- with open(override_api_xml) as stream:
+ with openSourceFile(override_api_xml) as stream:
parse(stream)
except IOError as msg:
print(override_api_xml, ":", msg)
@@ -869,9 +876,9 @@ def emit_c_code(module: str) -> None:
nb_wrap = 0
- header_file = "build/%s.h" % module
- export_file = "build/%s-export.c" % module
- wrapper_file = "build/%s.c" % module
+ header_file = "%s/%s.h" % (buildDir, module)
+ export_file = "%s/%s-export.c.inc" % (buildDir, module)
+ wrapper_file = "%s/%s.c" % (buildDir, module)
include = open(header_file, "w")
include.write("/* Generated by generator.py */\n\n")
@@ -885,7 +892,7 @@ def emit_c_code(module: str) -> None:
wrapper.write("#include <Python.h>\n")
wrapper.write("#include <libvirt/%s.h>\n" % (module,))
wrapper.write("#include \"typewrappers.h\"\n")
- wrapper.write("#include \"build/%s.h\"\n\n" % (module,))
+ wrapper.write("#include \"%s.h\"\n\n" % (module))
for function in sorted(functions):
if print_function_wrapper(package, function, wrapper, export, include):
@@ -1313,14 +1320,12 @@ def emit_py_code(module: str) -> None:
info = (0, func, name, ret, args, file, mod)
function_classes['None'].append(info)
- classes_file = "build/%s.py" % package
+ classes_file = "%s/%s.py" % (buildDir, package)
extra_file = "%s-override.py" % module
- extra = None
+ extra = openSourceFile(extra_file, "r", True)
classes = open(classes_file, "w")
- if os.path.exists(extra_file):
- extra = open(extra_file, "r")
classes.write("#\n")
classes.write("# WARNING WARNING WARNING WARNING\n")
classes.write("#\n")
@@ -1629,8 +1634,8 @@ def emit_py_code(module: str) -> None:
classes.write("\n")
# Append "<classname>.py" to class def, iff it exists
class_override = "%s-override-%s.py" % (module, classname)
- if os.path.exists(class_override):
- extra = open(class_override, "r")
+ extra = openSourceFile(class_override, "r", True)
+ if extra:
classes.write(" #\n")
classes.write(" # %s methods from %s.py (hand coded)\n" % (classname, classname))
classes.write(" #\n")
@@ -1776,6 +1781,11 @@ if sys.argv[1] not in ["libvirt", "libvirt-lxc", "libvirt-qemu"]:
print("ERROR: unknown module %s" % sys.argv[1])
sys.exit(1)
+if len(sys.argv) == 6:
+ buildDir = sys.argv[5]
+if len(sys.argv) >= 5:
+ sourceDir = sys.argv[4]
+
load_apis(sys.argv[1], sys.argv[2])
if validate_functions() < 0:
@@ -1786,12 +1796,12 @@ if not os.path.exists("build"):
os.mkdir("build")
output = None
-if len(sys.argv) == 4:
+if len(sys.argv) >= 4:
output = sys.argv[3]
-if output == "c" or output is None:
+if output == "c" or output == "c+py" or output is None:
emit_c_code(sys.argv[1])
-if output == "py" or output is None:
+if output == "py" or output == "c+py" or output is None:
emit_py_code(sys.argv[1])
sys.exit(0)
=====================================
libvirt-lxc-override.c
=====================================
@@ -19,13 +19,7 @@
#include <libvirt/virterror.h>
#include "typewrappers.h"
#include "libvirt-utils.h"
-#include "build/libvirt-lxc.h"
-
-#ifndef __CYGWIN__
-extern PyObject *PyInit_libvirtmod_lxc(void);
-#else
-extern PyObject *PyInit_cygvirtmod_lxc(void);
-#endif
+#include "libvirt-lxc.h"
#if 0
# define DEBUG_ERROR 1
@@ -94,7 +88,7 @@ libvirt_lxc_virDomainLxcOpenNamespace(PyObject *self ATTRIBUTE_UNUSED,
* *
************************************************************************/
static PyMethodDef libvirtLxcMethods[] = {
-#include "build/libvirt-lxc-export.c"
+#include "libvirt-lxc-export.c.inc"
{(char *) "virDomainLxcOpenNamespace", libvirt_lxc_virDomainLxcOpenNamespace, METH_VARARGS, NULL},
{NULL, NULL, 0, NULL}
};
@@ -115,7 +109,7 @@ static struct PyModuleDef moduledef = {
NULL
};
-PyObject *
+PyMODINIT_FUNC
#ifndef __CYGWIN__
PyInit_libvirtmod_lxc
#else
=====================================
libvirt-override.c
=====================================
@@ -26,15 +26,9 @@
#include <libvirt/virterror.h>
#include <stddef.h>
#include "typewrappers.h"
-#include "build/libvirt.h"
+#include "libvirt.h"
#include "libvirt-utils.h"
-#ifndef __CYGWIN__
-extern PyObject *PyInit_libvirtmod(void);
-#else
-extern PyObject *PyInit_cygvirtmod(void);
-#endif
-
#if 0
# define DEBUG_ERROR 1
#endif
@@ -10930,7 +10924,7 @@ libvirt_virDomainFDAssociate(PyObject *self ATTRIBUTE_UNUSED,
* *
************************************************************************/
static PyMethodDef libvirtMethods[] = {
-#include "build/libvirt-export.c"
+#include "libvirt-export.c.inc"
{(char *) "virGetVersion", libvirt_virGetVersion, METH_VARARGS, NULL},
{(char *) "virConnectGetVersion", libvirt_virConnectGetVersion, METH_VARARGS, NULL},
#if LIBVIR_CHECK_VERSION(1, 1, 3)
@@ -11227,7 +11221,7 @@ static struct PyModuleDef moduledef = {
NULL
};
-PyObject *
+PyMODINIT_FUNC
#ifndef __CYGWIN__
PyInit_libvirtmod
#else
=====================================
libvirt-python.spec
=====================================
@@ -14,7 +14,7 @@
Summary: The libvirt virtualization API python3 binding
Name: libvirt-python
-Version: 10.3.0
+Version: 10.4.0
Release: 1%{?dist}
Source0: https://libvirt.org/sources/python/%{name}-%{version}.tar.gz
Url: https://libvirt.org
=====================================
libvirt-qemu-override.c
=====================================
@@ -20,17 +20,11 @@
#include <libvirt/virterror.h>
#include "typewrappers.h"
#include "libvirt-utils.h"
-#include "build/libvirt-qemu.h"
+#include "libvirt-qemu.h"
#ifndef __CYGWIN__
# include <fcntl.h>
#endif
-#ifndef __CYGWIN__
-extern PyObject *PyInit_libvirtmod_qemu(void);
-#else
-extern PyObject *PyInit_cygvirtmod_qemu(void);
-#endif
-
#if 0
# define DEBUG_ERROR 1
#endif
@@ -447,7 +441,7 @@ libvirt_qemu_virDomainQemuMonitorCommandWithFiles(PyObject *self ATTRIBUTE_UNUSE
* *
************************************************************************/
static PyMethodDef libvirtQemuMethods[] = {
-#include "build/libvirt-qemu-export.c"
+#include "libvirt-qemu-export.c.inc"
{(char *) "virDomainQemuMonitorCommand", libvirt_qemu_virDomainQemuMonitorCommand, METH_VARARGS, NULL},
#if LIBVIR_CHECK_VERSION(0, 10, 0)
{(char *) "virDomainQemuAgentCommand", libvirt_qemu_virDomainQemuAgentCommand, METH_VARARGS, NULL},
@@ -478,7 +472,7 @@ static struct PyModuleDef moduledef = {
NULL
};
-PyObject *
+PyMODINIT_FUNC
#ifndef __CYGWIN__
PyInit_libvirtmod_qemu
#else
=====================================
setup.py
=====================================
@@ -87,6 +87,7 @@ def get_module_lists():
ldflags = get_pkgconfig_data(["--libs-only-L"], "libvirt", False).split()
cflags = get_pkgconfig_data(["--cflags"], "libvirt", False).split()
+ cflags += ["-Ibuild"]
cflags += ["-Wp,-DPy_LIMITED_API=0x03060000"]
module = Extension("libvirtmod",
@@ -196,7 +197,7 @@ class my_sdist(sdist):
def gen_rpm_spec(self):
return self._gen_from_in("libvirt-python.spec.in",
"libvirt-python.spec",
- "@PY_VERSION@",
+ "@VERSION@",
getVersion())
def gen_authors(self):
=====================================
tests/test_aio.py
=====================================
@@ -118,7 +118,7 @@ class TestLibvirtAio(unittest.TestCase):
@mock.patch('libvirt.virEventRegisterImpl',
side_effect=eventmock.virEventRegisterImplMock)
- @unittest.skipIf(sys.version_info >= (3,10), "test incompatible with 3.10")
+ @unittest.skipIf(sys.version_info >= (3,10), "test incompatible with 3.10+")
def testEventsPreInitImplicit(self, mock_event_register):
# Register libvirt events before starting the asyncio loop.
#
@@ -136,7 +136,7 @@ class TestLibvirtAio(unittest.TestCase):
@mock.patch('libvirt.virEventRegisterImpl',
side_effect=eventmock.virEventRegisterImplMock)
- @unittest.skipIf(sys.version_info >= (3,10), "test incompatible with 3.10")
+ @unittest.skipIf(sys.version_info >= (3,10), "test incompatible with 3.10+")
def testEventsImplicitLoopInit(self, mock_event_register):
# Register libvirt events before starting the asyncio loop.
#
View it on GitLab: https://salsa.debian.org/libvirt-team/libvirt-python/-/commit/d76d7ed1cfdf4563722c66bcfd1fcafd55a4bbdb
--
This project does not include diff previews in email notifications.
View it on GitLab: https://salsa.debian.org/libvirt-team/libvirt-python/-/commit/d76d7ed1cfdf4563722c66bcfd1fcafd55a4bbdb
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-libvirt-commits/attachments/20240605/7c802733/attachment-0001.htm>
More information about the Pkg-libvirt-commits
mailing list