15
0

Accepting request 1216962 from devel:languages:python

- Add gcc14.patch to make it compatible with gcc14
  gh#nima/python-dmidecode#59

OBS-URL: https://build.opensuse.org/request/show/1216962
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-dmidecode?expand=0&rev=13
This commit is contained in:
2024-10-22 12:53:40 +00:00
committed by Git OBS Bridge
3 changed files with 82 additions and 0 deletions

74
gcc14.patch Normal file
View File

@@ -0,0 +1,74 @@
Index: python-dmidecode-3.12.3/src/dmidecodemodule.c
===================================================================
--- python-dmidecode-3.12.3.orig/src/dmidecodemodule.c
+++ python-dmidecode-3.12.3/src/dmidecodemodule.c
@@ -54,13 +54,13 @@
#include <mcheck.h>
#if (PY_VERSION_HEX < 0x03030000)
-char *PyUnicode_AsUTF8(PyObject *unicode) {
+const char *PyUnicode_AsUTF8(PyObject *unicode) {
PyObject *as_bytes = PyUnicode_AsUTF8String(unicode);
if (!as_bytes) {
return NULL;
}
- return PyBytes_AsString(as_bytes);
+ return (const char*)PyBytes_AsString(as_bytes);
}
#endif
@@ -479,7 +479,7 @@ xmlNode *__dmidecode_xml_getsection(opti
if(opt->type == -1) {
char *err = log_retrieve(opt->logdata, LOG_ERR);
log_clear_partial(opt->logdata, LOG_ERR, 0);
- _pyReturnError(PyExc_RuntimeError, "Invalid type id '%s' -- %s", typeid, err);
+ PyReturnError(PyExc_RuntimeError, "Invalid type id '%s' -- %s", typeid, err);
free(err);
return NULL;
}
@@ -657,7 +657,7 @@ static PyObject *dmidecode_get_slot(PyOb
static PyObject *dmidecode_get_section(PyObject *self, PyObject *args)
{
- char *section = NULL;
+ const char *section = NULL;
if (PyUnicode_Check(args)) {
section = PyUnicode_AsUTF8(args);
} else if (PyBytes_Check(args)) {
@@ -788,7 +788,7 @@ static PyObject *dmidecode_get_dev(PyObj
static PyObject *dmidecode_set_dev(PyObject * self, PyObject * arg)
{
- char *f = NULL;
+ const char *f = NULL;
if(PyUnicode_Check(arg)) {
f = PyUnicode_AsUTF8(arg);
} else if(PyBytes_Check(arg)) {
@@ -835,7 +835,7 @@ static PyObject *dmidecode_set_dev(PyObj
static PyObject *dmidecode_set_pythonxmlmap(PyObject * self, PyObject * arg)
{
- char *fname = NULL;
+ const char *fname = NULL;
if (PyUnicode_Check(arg)) {
fname = PyUnicode_AsUTF8(arg);
@@ -913,7 +913,7 @@ static PyMethodDef DMIDataMethods[] = {
{(char *)"pythonmap", dmidecode_set_pythonxmlmap, METH_O,
(char *) "Use another python dict map definition. The default file is " PYTHON_XML_MAP},
- {(char *)"xmlapi", dmidecode_xmlapi, METH_VARARGS | METH_KEYWORDS,
+ {(char *)"xmlapi", (PyCFunction)dmidecode_xmlapi, METH_VARARGS | METH_KEYWORDS,
(char *) "Internal API for retrieving data as raw XML data"},
@@ -1024,7 +1024,7 @@ initdmidecodemod(void)
// Assign this options struct to the module as well with a destructor, that way it will
// clean up the memory for us.
// TODO: destructor has wrong type under py3?
- PyModule_AddObject(module, "options", PyCapsule_New(opt, NULL, destruct_options));
+ PyModule_AddObject(module, "options", PyCapsule_New(opt, NULL, (PyCapsule_Destructor)destruct_options));
global_options = opt;
#ifdef IS_PY3K
return module;

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Oct 22 06:56:53 UTC 2024 - Daniel Garcia <daniel.garcia@suse.com>
- Add gcc14.patch to make it compatible with gcc14
gh#nima/python-dmidecode#59
-------------------------------------------------------------------
Tue Feb 13 12:46:21 UTC 2024 - Daniel Garcia <daniel.garcia@suse.com>

View File

@@ -37,6 +37,8 @@ Patch2: 31-version_info-v-version.patch
# PATCH-FIX-UPSTREAM detect-lib-with-py3.patch gh#nima/python-dmidecode#36 mcepl@suse.com
# Make the code future-proof against removal of distutils module.
Patch3: detect-lib-with-py3.patch
# PATCH-FIX-UPSTREAM gcc14.patch gh#nima/python-dmidecode#59 -- daniel.garcia@suse.com
Patch4: gcc14.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes