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/python-ldap/, dev-python/python-ldap/files/
Date: Sat, 14 May 2022 02:52:23
Message-Id: 1652495565.8790accf926841f422f9cbe95a1e27e6c67457c6.sam@gentoo
1 commit: 8790accf926841f422f9cbe95a1e27e6c67457c6
2 Author: Dennis Lamm <expeditioneer <AT> gentoo <DOT> org>
3 AuthorDate: Wed Mar 23 07:20:32 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sat May 14 02:32:45 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8790accf
7
8 dev-python/python-ldap: added openldap 2.6 support
9
10 Bug: https://bugs.gentoo.org/835637
11 Signed-off-by: Dennis Lamm <expeditioneer <AT> gentoo.org>
12 Package-Manager: Portage-3.0.30, Repoman-3.0.3
13 Closes: https://github.com/gentoo/gentoo/pull/24721
14 Signed-off-by: Sam James <sam <AT> gentoo.org>
15
16 .../files/python-ldap-3.4.0-openldap-2.6.patch | 33 ++++++++
17 dev-python/python-ldap/python-ldap-3.4.0-r1.ebuild | 97 ++++++++++++++++++++++
18 2 files changed, 130 insertions(+)
19
20 diff --git a/dev-python/python-ldap/files/python-ldap-3.4.0-openldap-2.6.patch b/dev-python/python-ldap/files/python-ldap-3.4.0-openldap-2.6.patch
21 new file mode 100644
22 index 000000000000..0af86698f4bf
23 --- /dev/null
24 +++ b/dev-python/python-ldap/files/python-ldap-3.4.0-openldap-2.6.patch
25 @@ -0,0 +1,33 @@
26 +From 536a7671151e3070481736e5d6159987df920d8b Mon Sep 17 00:00:00 2001
27 +From: Simon Pichugin <spichugi@××××××.com>
28 +Date: Wed, 9 Feb 2022 16:06:14 -0800
29 +Subject: [PATCH] Always use 'ldap' library
30 +
31 +---
32 + setup.py | 4 +++-
33 + 1 file changed, 3 insertions(+), 1 deletion(-)
34 +
35 +diff --git a/setup.py b/setup.py
36 +index 119b571..851223e 100644
37 +--- a/setup.py
38 ++++ b/setup.py
39 +@@ -37,6 +37,8 @@ if cfg.has_section('_ldap'):
40 + for name in dir(LDAP_CLASS):
41 + if cfg.has_option('_ldap', name):
42 + setattr(LDAP_CLASS, name, cfg.get('_ldap', name).split())
43 ++#-- Overwrite it as 'ldap' is the always correct library we have in Fedora 34+
44 ++LDAP_CLASS.libs = ['ldap', 'lber']
45 +
46 + for i in range(len(LDAP_CLASS.defines)):
47 + LDAP_CLASS.defines[i]=((LDAP_CLASS.defines[i],None))
48 +@@ -132,7 +134,7 @@ setup(
49 + extra_objects = LDAP_CLASS.extra_objects,
50 + runtime_library_dirs = (not sys.platform.startswith("win"))*LDAP_CLASS.library_dirs,
51 + define_macros = LDAP_CLASS.defines + \
52 +- ('ldap_r' in LDAP_CLASS.libs or 'oldap_r' in LDAP_CLASS.libs)*[('HAVE_LIBLDAP_R',None)] + \
53 ++ ('ldap' in LDAP_CLASS.libs or 'oldap' in LDAP_CLASS.libs)*[('HAVE_LIBLDAP_R',None)] + \
54 + ('sasl' in LDAP_CLASS.libs or 'sasl2' in LDAP_CLASS.libs or 'libsasl' in LDAP_CLASS.libs)*[('HAVE_SASL',None)] + \
55 + ('ssl' in LDAP_CLASS.libs and 'crypto' in LDAP_CLASS.libs)*[('HAVE_TLS',None)] + \
56 + [
57 +--
58 +2.31.1
59
60 diff --git a/dev-python/python-ldap/python-ldap-3.4.0-r1.ebuild b/dev-python/python-ldap/python-ldap-3.4.0-r1.ebuild
61 new file mode 100644
62 index 000000000000..51eca9aab9f6
63 --- /dev/null
64 +++ b/dev-python/python-ldap/python-ldap-3.4.0-r1.ebuild
65 @@ -0,0 +1,97 @@
66 +# Copyright 1999-2022 Gentoo Authors
67 +# Distributed under the terms of the GNU General Public License v2
68 +
69 +EAPI=8
70 +
71 +DISTUTILS_USE_PEP517=setuptools
72 +PYTHON_COMPAT=( pypy3 python3_{8..10} )
73 +
74 +inherit distutils-r1
75 +
76 +DESCRIPTION="Various LDAP-related Python modules"
77 +HOMEPAGE="
78 + https://www.python-ldap.org/en/latest/
79 + https://pypi.org/project/python-ldap/
80 + https://github.com/python-ldap/python-ldap"
81 +if [[ ${PV} == *9999* ]]; then
82 + EGIT_REPO_URI="https://github.com/python-ldap/python-ldap.git"
83 + inherit git-r3
84 +else
85 + SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
86 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-solaris"
87 +fi
88 +
89 +LICENSE="MIT PSF-2"
90 +SLOT="0"
91 +IUSE="examples sasl ssl"
92 +
93 +# < dep on openldap for bug #835637, ldap_r is gone
94 +RDEPEND="
95 + >=dev-python/pyasn1-0.3.7[${PYTHON_USEDEP}]
96 + >=dev-python/pyasn1-modules-0.1.5[${PYTHON_USEDEP}]
97 + >=net-nds/openldap-2.6:=[sasl?,ssl?]
98 +"
99 +# We do not link against cyrus-sasl but we use some
100 +# of its headers during the build.
101 +DEPEND="
102 + >=net-nds/openldap-2.6:=[sasl?,ssl?]
103 + sasl? ( >=dev-libs/cyrus-sasl-2.1 )
104 +"
105 +
106 +distutils_enable_tests pytest
107 +distutils_enable_sphinx Doc
108 +
109 +# Commit with this Patch from Fedora Rawhide
110 +# https://src.fedoraproject.org/rpms/python-ldap/c/a237d9b212bd1581e07f4f1a8f54c26a7190843c?branch=rawhide
111 +# Workaround till this PR is merged upstream
112 +# https://github.com/python-ldap/python-ldap/pull/458
113 +PATCHES=( "${FILESDIR}"/${P}-openldap-2.6.patch )
114 +
115 +python_prepare_all() {
116 + # The live ebuild won't compile if setuptools_scm < 1.16.2 is installed
117 + # https://github.com/pypa/setuptools_scm/issues/228
118 + if [[ ${PV} == *9999* ]]; then
119 + rm -r .git || die
120 + fi
121 +
122 + if ! use sasl; then
123 + sed -i 's/HAVE_SASL//g' setup.cfg || die
124 + fi
125 + if ! use ssl; then
126 + sed -i 's/HAVE_TLS//g' setup.cfg || die
127 + fi
128 +
129 + distutils-r1_python_prepare_all
130 +}
131 +
132 +python_test() {
133 + # Run all tests which don't require slapd
134 + local EPYTEST_IGNORE=(
135 + t_bind.py
136 + t_cext.py
137 + t_edit.py
138 + t_ldapobject.py
139 + t_ldap_options.py
140 + t_ldap_sasl.py
141 + t_ldap_schema_subentry.py
142 + t_ldap_syncrepl.py
143 + t_slapdobject.py
144 + )
145 + pushd Tests >/dev/null || die
146 + epytest
147 + popd > /dev/null || die
148 +}
149 +
150 +python_install() {
151 + distutils-r1_python_install
152 + python_optimize
153 +}
154 +
155 +python_install_all() {
156 + if use examples; then
157 + docinto examples
158 + dodoc -r Demo/.
159 + docompress -x /usr/share/doc/${PF}/examples
160 + fi
161 + distutils-r1_python_install_all
162 +}