Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pykerberos/, dev-python/pykerberos/files/
Date: Tue, 30 Aug 2022 20:50:39
Message-Id: 1661892618.498e9d93ab5b819e4bc6929ca12af7e1aa45d684.sam@gentoo
1 commit: 498e9d93ab5b819e4bc6929ca12af7e1aa45d684
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Tue Aug 30 20:50:18 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Tue Aug 30 20:50:18 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=498e9d93
7
8 dev-python/pykerberos: fix Python 3.10 compatibility
9
10 Closes: https://bugs.gentoo.org/867421
11 Signed-off-by: Sam James <sam <AT> gentoo.org>
12
13 .../files/pykerberos-1.3.1-python3.10.patch | 33 +++++++++++++++
14 dev-python/pykerberos/pykerberos-1.3.1-r1.ebuild | 48 ++++++++++++++++++++++
15 2 files changed, 81 insertions(+)
16
17 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
18 new file mode 100644
19 index 000000000000..7e760187de56
20 --- /dev/null
21 +++ b/dev-python/pykerberos/files/pykerberos-1.3.1-python3.10.patch
22 @@ -0,0 +1,33 @@
23 +https://bugs.gentoo.org/867421
24 +https://github.com/apple/ccs-pykerberos/pull/89
25 +
26 +From 1e1666af51bb11ea5c6dd442415ce765073737c3 Mon Sep 17 00:00:00 2001
27 +From: stevenpackardblp <77253966+stevenpackardblp@××××××××××××××××××××.com>
28 +Date: Sun, 24 Oct 2021 23:03:41 -0400
29 +Subject: [PATCH] Use Py_ssize_t type
30 +
31 +Python 3.10 requires that the `Py_ssize_t` type is used for string lengths instead of `int`.
32 +--- a/src/kerberos.c
33 ++++ b/src/kerberos.c
34 +@@ -14,6 +14,7 @@
35 + * limitations under the License.
36 + **/
37 +
38 ++#define PY_SSIZE_T_CLEAN
39 + #include <Python.h>
40 +
41 + #include "kerberosbasic.h"
42 +@@ -244,9 +245,9 @@ static PyObject *channelBindings(PyObject *self, PyObject *args, PyObject* keywd
43 + char *initiator_address = NULL;
44 + char *acceptor_address = NULL;
45 + char *application_data = NULL;
46 +- int initiator_length = 0;
47 +- int acceptor_length = 0;
48 +- int application_length = 0;
49 ++ Py_ssize_t initiator_length = 0;
50 ++ Py_ssize_t acceptor_length = 0;
51 ++ Py_ssize_t application_length = 0;
52 +
53 + PyObject *pychan_bindings = NULL;
54 + struct gss_channel_bindings_struct *input_chan_bindings;
55 +
56
57 diff --git a/dev-python/pykerberos/pykerberos-1.3.1-r1.ebuild b/dev-python/pykerberos/pykerberos-1.3.1-r1.ebuild
58 new file mode 100644
59 index 000000000000..cc46bbefeab8
60 --- /dev/null
61 +++ b/dev-python/pykerberos/pykerberos-1.3.1-r1.ebuild
62 @@ -0,0 +1,48 @@
63 +# Copyright 1999-2022 Gentoo Authors
64 +# Distributed under the terms of the GNU General Public License v2
65 +
66 +EAPI=7
67 +
68 +PYTHON_COMPAT=( python3_{8..10} )
69 +inherit distutils-r1
70 +
71 +MY_P=PyKerberos-${PV}
72 +DESCRIPTION="A high-level Python wrapper for Kerberos/GSSAPI operations"
73 +HOMEPAGE="
74 + https://www.calendarserver.org/PyKerberos.html
75 + https://github.com/apple/ccs-pykerberos/
76 + https://pypi.org/project/kerberos/"
77 +SRC_URI="
78 + https://github.com/apple/ccs-pykerberos/archive/${MY_P}.tar.gz"
79 +S=${WORKDIR}/ccs-pykerberos-${MY_P}
80 +
81 +LICENSE="Apache-2.0"
82 +SLOT="0"
83 +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc64 ~riscv ~x86"
84 +# test environment is non-trivial to set up, so just use docker
85 +# (see python_test below)
86 +# also for alpha/beta Python releases support:
87 +# https://github.com/apple/ccs-pykerberos/pull/83/commits/5f1130a1305b5f6e7d7d8b41067c4713f0c8950f
88 +RESTRICT="test"
89 +
90 +RDEPEND="app-crypt/mit-krb5"
91 +DEPEND="${RDEPEND}"
92 +
93 +PATCHES=(
94 + "${FILESDIR}"/${PN}-1.3.1-python3.10.patch
95 +)
96 +
97 +python_test() {
98 + set -- docker run \
99 + -v "${PWD}:/app" \
100 + -w /app \
101 + -e PYENV=$("${EPYTHON}" -c 'import sys; print(sys.version.split()[0])') \
102 + -e KERBEROS_USERNAME=administrator \
103 + -e KERBEROS_PASSWORD=Password01 \
104 + -e KERBEROS_REALM=example.com \
105 + -e KERBEROS_PORT=80 \
106 + ubuntu:16.04 \
107 + /bin/bash .travis.sh
108 + echo "${@}" >&2
109 + "${@}" || die "Tests failed with ${EPYTHON}"
110 +}