|
James Antill |
ee2eaf |
From 0b1456ed4c00a021389acea4b6b10d475986b660 Mon Sep 17 00:00:00 2001
|
|
James Antill |
ee2eaf |
Message-Id: <0b1456ed4c00a021389acea4b6b10d475986b660.1571920849.git.pmatilai@redhat.com>
|
|
James Antill |
ee2eaf |
In-Reply-To: <6b6c4d881dc6fc99f949dac4aaf9a513542f9956.1571920849.git.pmatilai@redhat.com>
|
|
James Antill |
ee2eaf |
References: <6b6c4d881dc6fc99f949dac4aaf9a513542f9956.1571920849.git.pmatilai@redhat.com>
|
|
James Antill |
ee2eaf |
From: Panu Matilainen <pmatilai@redhat.com>
|
|
James Antill |
ee2eaf |
Date: Thu, 4 Oct 2018 18:05:37 +0300
|
|
James Antill |
ee2eaf |
Subject: [PATCH 4/5] Bump the minimum Python version requirement to 2.7
|
|
James Antill |
ee2eaf |
|
|
James Antill |
ee2eaf |
Older Python versions are long since past their EOL, we don't need to
|
|
James Antill |
ee2eaf |
support them either. Python 2.7 is also the least incompatible version
|
|
James Antill |
ee2eaf |
compared to Python 3, going forward. Nuke the now unnecessary compat
|
|
James Antill |
ee2eaf |
macros.
|
|
James Antill |
ee2eaf |
|
|
James Antill |
ee2eaf |
(cherry picked from commit 3f3cb3eabf7bb49dcc6e691601f89500b3487e06)
|
|
James Antill |
ee2eaf |
---
|
|
James Antill |
ee2eaf |
configure.ac | 2 +-
|
|
James Antill |
ee2eaf |
python/header-py.c | 4 ++--
|
|
James Antill |
ee2eaf |
python/rpmsystem-py.h | 33 ---------------------------------
|
|
James Antill |
ee2eaf |
python/spec-py.c | 2 +-
|
|
James Antill |
ee2eaf |
4 files changed, 4 insertions(+), 37 deletions(-)
|
|
James Antill |
ee2eaf |
|
|
James Antill |
ee2eaf |
diff --git a/configure.ac b/configure.ac
|
|
James Antill |
ee2eaf |
index 34ea85f9f..4d1a48e5f 100644
|
|
James Antill |
ee2eaf |
--- a/configure.ac
|
|
James Antill |
ee2eaf |
+++ b/configure.ac
|
|
James Antill |
ee2eaf |
@@ -800,7 +800,7 @@ esac],
|
|
James Antill |
ee2eaf |
|
|
James Antill |
ee2eaf |
WITH_PYTHON_SUBPACKAGE=0
|
|
James Antill |
ee2eaf |
AS_IF([test "$enable_python" = yes],[
|
|
James Antill |
ee2eaf |
- AM_PATH_PYTHON([2.6],[
|
|
James Antill |
ee2eaf |
+ AM_PATH_PYTHON([2.7],[
|
|
James Antill |
ee2eaf |
PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}], [WITH_PYTHON_SUBPACKAGE=1])
|
|
James Antill |
ee2eaf |
AC_SUBST(PYTHON_CFLAGS)
|
|
James Antill |
ee2eaf |
AC_SUBST(PYTHON_LIB)
|
|
James Antill |
ee2eaf |
diff --git a/python/header-py.c b/python/header-py.c
|
|
James Antill |
ee2eaf |
index 628b48534..c9d54e869 100644
|
|
James Antill |
ee2eaf |
--- a/python/header-py.c
|
|
James Antill |
ee2eaf |
+++ b/python/header-py.c
|
|
James Antill |
ee2eaf |
@@ -376,8 +376,8 @@ static PyObject *hdr_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
|
|
James Antill |
ee2eaf |
|
|
James Antill |
ee2eaf |
if (obj == NULL) {
|
|
James Antill |
ee2eaf |
h = headerNew();
|
|
James Antill |
ee2eaf |
- } else if (CAPSULE_CHECK(obj)) {
|
|
James Antill |
ee2eaf |
- h = CAPSULE_EXTRACT(obj, "rpm._C_Header");
|
|
James Antill |
ee2eaf |
+ } else if (PyCapsule_CheckExact(obj)) {
|
|
James Antill |
ee2eaf |
+ h = PyCapsule_GetPointer(obj, "rpm._C_Header");
|
|
James Antill |
ee2eaf |
headerLink(h);
|
|
James Antill |
ee2eaf |
} else if (hdrObject_Check(obj)) {
|
|
James Antill |
ee2eaf |
h = headerCopy(((hdrObject*) obj)->h);
|
|
James Antill |
ee2eaf |
diff --git a/python/rpmsystem-py.h b/python/rpmsystem-py.h
|
|
James Antill |
ee2eaf |
index c8423e3dc..955d60cd3 100644
|
|
James Antill |
ee2eaf |
--- a/python/rpmsystem-py.h
|
|
James Antill |
ee2eaf |
+++ b/python/rpmsystem-py.h
|
|
James Antill |
ee2eaf |
@@ -9,39 +9,6 @@
|
|
James Antill |
ee2eaf |
#include <Python.h>
|
|
James Antill |
ee2eaf |
#include <structmember.h>
|
|
James Antill |
ee2eaf |
|
|
James Antill |
ee2eaf |
-#if ((PY_MAJOR_VERSION << 8) | (PY_MINOR_VERSION << 0)) < 0x0205
|
|
James Antill |
ee2eaf |
-typedef ssize_t Py_ssize_t;
|
|
James Antill |
ee2eaf |
-typedef Py_ssize_t (*lenfunc)(PyObject *);
|
|
James Antill |
ee2eaf |
-#endif
|
|
James Antill |
ee2eaf |
-
|
|
James Antill |
ee2eaf |
-/* Compatibility macros for Python < 2.6 */
|
|
James Antill |
ee2eaf |
-#ifndef PyVarObject_HEAD_INIT
|
|
James Antill |
ee2eaf |
-#define PyVarObject_HEAD_INIT(type, size) \
|
|
James Antill |
ee2eaf |
- PyObject_HEAD_INIT(type) size,
|
|
James Antill |
ee2eaf |
-#endif
|
|
James Antill |
ee2eaf |
-
|
|
James Antill |
ee2eaf |
-#ifndef Py_TYPE
|
|
James Antill |
ee2eaf |
-#define Py_TYPE(o) ((o)->ob_type)
|
|
James Antill |
ee2eaf |
-#endif
|
|
James Antill |
ee2eaf |
-
|
|
James Antill |
ee2eaf |
-#if ((PY_MAJOR_VERSION << 8) | (PY_MINOR_VERSION << 0)) < 0x0206
|
|
James Antill |
ee2eaf |
-#define PyBytes_Check PyString_Check
|
|
James Antill |
ee2eaf |
-#define PyBytes_FromString PyString_FromString
|
|
James Antill |
ee2eaf |
-#define PyBytes_FromStringAndSize PyString_FromStringAndSize
|
|
James Antill |
ee2eaf |
-#define PyBytes_Size PyString_Size
|
|
James Antill |
ee2eaf |
-#define PyBytes_AsString PyString_AsString
|
|
James Antill |
ee2eaf |
-#endif
|
|
James Antill |
ee2eaf |
-
|
|
James Antill |
ee2eaf |
-#if ((PY_MAJOR_VERSION << 8) | (PY_MINOR_VERSION << 0)) >= 0x0207
|
|
James Antill |
ee2eaf |
-#define CAPSULE_BUILD(ptr,name) PyCapsule_New(ptr, name, NULL)
|
|
James Antill |
ee2eaf |
-#define CAPSULE_CHECK(obj) PyCapsule_CheckExact(obj)
|
|
James Antill |
ee2eaf |
-#define CAPSULE_EXTRACT(obj,name) PyCapsule_GetPointer(obj, name)
|
|
James Antill |
ee2eaf |
-#else
|
|
James Antill |
ee2eaf |
-#define CAPSULE_BUILD(ptr,name) PyCObject_FromVoidPtr(ptr, NULL)
|
|
James Antill |
ee2eaf |
-#define CAPSULE_CHECK(obj) PyCObject_Check(obj)
|
|
James Antill |
ee2eaf |
-#define CAPSULE_EXTRACT(obj,name) PyCObject_AsVoidPtr(obj)
|
|
James Antill |
ee2eaf |
-#endif
|
|
James Antill |
ee2eaf |
-
|
|
James Antill |
ee2eaf |
/* For Python 3, use the PyLong type throughout in place of PyInt */
|
|
James Antill |
ee2eaf |
#if PY_MAJOR_VERSION >= 3
|
|
James Antill |
ee2eaf |
#define PyInt_Check PyLong_Check
|
|
James Antill |
ee2eaf |
diff --git a/python/spec-py.c b/python/spec-py.c
|
|
James Antill |
ee2eaf |
index fa7e58928..4efdbf4bf 100644
|
|
James Antill |
ee2eaf |
--- a/python/spec-py.c
|
|
James Antill |
ee2eaf |
+++ b/python/spec-py.c
|
|
James Antill |
ee2eaf |
@@ -34,7 +34,7 @@ static PyObject *makeHeader(Header h)
|
|
James Antill |
ee2eaf |
PyObject *rpmmod = PyImport_ImportModuleNoBlock("rpm");
|
|
James Antill |
ee2eaf |
if (rpmmod == NULL) return NULL;
|
|
James Antill |
ee2eaf |
|
|
James Antill |
ee2eaf |
- PyObject *ptr = CAPSULE_BUILD(h, "rpm._C_Header");
|
|
James Antill |
ee2eaf |
+ PyObject *ptr = PyCapsule_New(h, "rpm._C_Header", NULL);
|
|
James Antill |
ee2eaf |
PyObject *hdr = PyObject_CallMethod(rpmmod, "hdr", "(O)", ptr);
|
|
James Antill |
ee2eaf |
Py_XDECREF(ptr);
|
|
James Antill |
ee2eaf |
Py_XDECREF(rpmmod);
|
|
James Antill |
ee2eaf |
--
|
|
James Antill |
ee2eaf |
2.21.0
|
|
James Antill |
ee2eaf |
|