commit:     498e9d93ab5b819e4bc6929ca12af7e1aa45d684
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 30 20:50:18 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Aug 30 20:50:18 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=498e9d93

dev-python/pykerberos: fix Python 3.10 compatibility

Closes: https://bugs.gentoo.org/867421
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/pykerberos-1.3.1-python3.10.patch        | 33 +++++++++++++++
 dev-python/pykerberos/pykerberos-1.3.1-r1.ebuild   | 48 ++++++++++++++++++++++
 2 files changed, 81 insertions(+)

diff --git a/dev-python/pykerberos/files/pykerberos-1.3.1-python3.10.patch 
b/dev-python/pykerberos/files/pykerberos-1.3.1-python3.10.patch
new file mode 100644
index 000000000000..7e760187de56
--- /dev/null
+++ b/dev-python/pykerberos/files/pykerberos-1.3.1-python3.10.patch
@@ -0,0 +1,33 @@
+https://bugs.gentoo.org/867421
+https://github.com/apple/ccs-pykerberos/pull/89
+
+From 1e1666af51bb11ea5c6dd442415ce765073737c3 Mon Sep 17 00:00:00 2001
+From: stevenpackardblp <77253966+stevenpackard...@users.noreply.github.com>
+Date: Sun, 24 Oct 2021 23:03:41 -0400
+Subject: [PATCH] Use Py_ssize_t type
+
+Python 3.10 requires that the `Py_ssize_t` type is used for string lengths 
instead of `int`.
+--- a/src/kerberos.c
++++ b/src/kerberos.c
+@@ -14,6 +14,7 @@
+  * limitations under the License.
+  **/
+ 
++#define PY_SSIZE_T_CLEAN
+ #include <Python.h>
+ 
+ #include "kerberosbasic.h"
+@@ -244,9 +245,9 @@ static PyObject *channelBindings(PyObject *self, PyObject 
*args, PyObject* keywd
+     char *initiator_address = NULL;
+     char *acceptor_address = NULL;
+     char *application_data = NULL;
+-    int initiator_length = 0;
+-    int acceptor_length = 0;
+-    int application_length = 0;
++    Py_ssize_t initiator_length = 0;
++    Py_ssize_t acceptor_length = 0;
++    Py_ssize_t application_length = 0;
+ 
+     PyObject *pychan_bindings = NULL;
+     struct gss_channel_bindings_struct *input_chan_bindings;
+

diff --git a/dev-python/pykerberos/pykerberos-1.3.1-r1.ebuild 
b/dev-python/pykerberos/pykerberos-1.3.1-r1.ebuild
new file mode 100644
index 000000000000..cc46bbefeab8
--- /dev/null
+++ b/dev-python/pykerberos/pykerberos-1.3.1-r1.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{8..10} )
+inherit distutils-r1
+
+MY_P=PyKerberos-${PV}
+DESCRIPTION="A high-level Python wrapper for Kerberos/GSSAPI operations"
+HOMEPAGE="
+       https://www.calendarserver.org/PyKerberos.html
+       https://github.com/apple/ccs-pykerberos/
+       https://pypi.org/project/kerberos/";
+SRC_URI="
+       https://github.com/apple/ccs-pykerberos/archive/${MY_P}.tar.gz";
+S=${WORKDIR}/ccs-pykerberos-${MY_P}
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc64 ~riscv ~x86"
+# test environment is non-trivial to set up, so just use docker
+# (see python_test below)
+# also for alpha/beta Python releases support:
+# 
https://github.com/apple/ccs-pykerberos/pull/83/commits/5f1130a1305b5f6e7d7d8b41067c4713f0c8950f
+RESTRICT="test"
+
+RDEPEND="app-crypt/mit-krb5"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.3.1-python3.10.patch
+)
+
+python_test() {
+       set -- docker run \
+               -v "${PWD}:/app" \
+               -w /app \
+               -e PYENV=$("${EPYTHON}" -c 'import sys; 
print(sys.version.split()[0])') \
+               -e KERBEROS_USERNAME=administrator \
+               -e KERBEROS_PASSWORD=Password01 \
+               -e KERBEROS_REALM=example.com \
+               -e KERBEROS_PORT=80 \
+               ubuntu:16.04 \
+               /bin/bash .travis.sh
+       echo "${@}" >&2
+       "${@}" || die "Tests failed with ${EPYTHON}"
+}

Reply via email to