1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-07-14 16:59:34 +03:00

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 <>).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik
2024-04-26 17:49:32 +02:00
committed by Daniel P. Berrangé
parent dcd4218837
commit a6b8929083
5 changed files with 8 additions and 7 deletions

View File

@ -892,7 +892,7 @@ def emit_c_code(module: str) -> None:
wrapper.write("#include <Python.h>\n") wrapper.write("#include <Python.h>\n")
wrapper.write("#include <libvirt/%s.h>\n" % (module,)) wrapper.write("#include <libvirt/%s.h>\n" % (module,))
wrapper.write("#include \"typewrappers.h\"\n") wrapper.write("#include \"typewrappers.h\"\n")
wrapper.write("#include \"%s/%s.h\"\n\n" % (buildDir, module)) wrapper.write("#include \"%s.h\"\n\n" % (module))
for function in sorted(functions): for function in sorted(functions):
if print_function_wrapper(package, function, wrapper, export, include): if print_function_wrapper(package, function, wrapper, export, include):

View File

@ -19,7 +19,7 @@
#include <libvirt/virterror.h> #include <libvirt/virterror.h>
#include "typewrappers.h" #include "typewrappers.h"
#include "libvirt-utils.h" #include "libvirt-utils.h"
#include "build/libvirt-lxc.h" #include "libvirt-lxc.h"
#ifndef __CYGWIN__ #ifndef __CYGWIN__
extern PyObject *PyInit_libvirtmod_lxc(void); extern PyObject *PyInit_libvirtmod_lxc(void);
@ -94,7 +94,7 @@ libvirt_lxc_virDomainLxcOpenNamespace(PyObject *self ATTRIBUTE_UNUSED,
* * * *
************************************************************************/ ************************************************************************/
static PyMethodDef libvirtLxcMethods[] = { static PyMethodDef libvirtLxcMethods[] = {
#include "build/libvirt-lxc-export.c.inc" #include "libvirt-lxc-export.c.inc"
{(char *) "virDomainLxcOpenNamespace", libvirt_lxc_virDomainLxcOpenNamespace, METH_VARARGS, NULL}, {(char *) "virDomainLxcOpenNamespace", libvirt_lxc_virDomainLxcOpenNamespace, METH_VARARGS, NULL},
{NULL, NULL, 0, NULL} {NULL, NULL, 0, NULL}
}; };

View File

@ -26,7 +26,7 @@
#include <libvirt/virterror.h> #include <libvirt/virterror.h>
#include <stddef.h> #include <stddef.h>
#include "typewrappers.h" #include "typewrappers.h"
#include "build/libvirt.h" #include "libvirt.h"
#include "libvirt-utils.h" #include "libvirt-utils.h"
#ifndef __CYGWIN__ #ifndef __CYGWIN__
@ -10930,7 +10930,7 @@ libvirt_virDomainFDAssociate(PyObject *self ATTRIBUTE_UNUSED,
* * * *
************************************************************************/ ************************************************************************/
static PyMethodDef libvirtMethods[] = { static PyMethodDef libvirtMethods[] = {
#include "build/libvirt-export.c.inc" #include "libvirt-export.c.inc"
{(char *) "virGetVersion", libvirt_virGetVersion, METH_VARARGS, NULL}, {(char *) "virGetVersion", libvirt_virGetVersion, METH_VARARGS, NULL},
{(char *) "virConnectGetVersion", libvirt_virConnectGetVersion, METH_VARARGS, NULL}, {(char *) "virConnectGetVersion", libvirt_virConnectGetVersion, METH_VARARGS, NULL},
#if LIBVIR_CHECK_VERSION(1, 1, 3) #if LIBVIR_CHECK_VERSION(1, 1, 3)

View File

@ -20,7 +20,7 @@
#include <libvirt/virterror.h> #include <libvirt/virterror.h>
#include "typewrappers.h" #include "typewrappers.h"
#include "libvirt-utils.h" #include "libvirt-utils.h"
#include "build/libvirt-qemu.h" #include "libvirt-qemu.h"
#ifndef __CYGWIN__ #ifndef __CYGWIN__
# include <fcntl.h> # include <fcntl.h>
#endif #endif
@ -447,7 +447,7 @@ libvirt_qemu_virDomainQemuMonitorCommandWithFiles(PyObject *self ATTRIBUTE_UNUSE
* * * *
************************************************************************/ ************************************************************************/
static PyMethodDef libvirtQemuMethods[] = { static PyMethodDef libvirtQemuMethods[] = {
#include "build/libvirt-qemu-export.c.inc" #include "libvirt-qemu-export.c.inc"
{(char *) "virDomainQemuMonitorCommand", libvirt_qemu_virDomainQemuMonitorCommand, METH_VARARGS, NULL}, {(char *) "virDomainQemuMonitorCommand", libvirt_qemu_virDomainQemuMonitorCommand, METH_VARARGS, NULL},
#if LIBVIR_CHECK_VERSION(0, 10, 0) #if LIBVIR_CHECK_VERSION(0, 10, 0)
{(char *) "virDomainQemuAgentCommand", libvirt_qemu_virDomainQemuAgentCommand, METH_VARARGS, NULL}, {(char *) "virDomainQemuAgentCommand", libvirt_qemu_virDomainQemuAgentCommand, METH_VARARGS, NULL},

View File

@ -87,6 +87,7 @@ def get_module_lists():
ldflags = get_pkgconfig_data(["--libs-only-L"], "libvirt", False).split() ldflags = get_pkgconfig_data(["--libs-only-L"], "libvirt", False).split()
cflags = get_pkgconfig_data(["--cflags"], "libvirt", False).split() cflags = get_pkgconfig_data(["--cflags"], "libvirt", False).split()
cflags += ["-Ibuild"]
cflags += ["-Wp,-DPy_LIMITED_API=0x03060000"] cflags += ["-Wp,-DPy_LIMITED_API=0x03060000"]
module = Extension("libvirtmod", module = Extension("libvirtmod",