diff --git a/.python-ldappool.metadata b/.python-ldappool.metadata new file mode 100644 index 0000000..6df1a28 --- /dev/null +++ b/.python-ldappool.metadata @@ -0,0 +1 @@ +e81bf628b8d81183eb22e90d332ba1e65cdd5cd2 SOURCES/ldappool-3.0.0.tar.gz diff --git a/SOURCES/.gitignore b/SOURCES/.gitignore new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/SOURCES/.gitignore diff --git a/SOURCES/0001-Fix-pep8-gate.patch b/SOURCES/0001-Fix-pep8-gate.patch new file mode 100644 index 0000000..5b2443e --- /dev/null +++ b/SOURCES/0001-Fix-pep8-gate.patch @@ -0,0 +1,45 @@ +From 39d22bf63d0923d86d37728de521b62e3c194c5e Mon Sep 17 00:00:00 2001 +From: Jimmy McCrory +Date: Fri, 5 May 2023 08:57:29 -0700 +Subject: [PATCH 1/2] Fix pep8 gate + +Update flake8-docstrings requirement. +Ignore missing docstring in __init__ methods. + +Change-Id: I966fe3fdc16765795f99e1f5984050baae305849 +--- + test-requirements.txt | 2 +- + tox.ini | 3 ++- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/test-requirements.txt b/test-requirements.txt +index b8e8e41..3e5e91e 100644 +--- a/test-requirements.txt ++++ b/test-requirements.txt +@@ -1,5 +1,5 @@ + hacking>=3.0,<3.1.0 # Apache-2.0 +-flake8-docstrings==0.2.1.post1 # MIT ++flake8-docstrings==1.7.0 # MIT + + coverage!=4.4,>=4.0 # Apache-2.0 + fixtures>=3.0.0 # Apache-2.0/BSD +diff --git a/tox.ini b/tox.ini +index 70f611f..a9fe5b8 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -41,10 +41,11 @@ commands = + # D103: Missing docstring in public function + # D104: Missing docstring in public package + # D105: Missing docstring in magic method ++# D107: Missing docstring in __init__ + # D200: One-line docstring should fit on one line with quotes + # D210: No whitespaces allowed surrounding docstring text + # D401: First line should be in imperative mood +-ignore = D100,D101,D102,D104,D105,D200,D210,D401 ++ignore = D100,D101,D102,D104,D105,D107,D200,D210,D401 + show-source = True + exclude = .venv,.tox,dist,doc,*egg,build + +-- +2.40.1 + diff --git a/SOURCES/0002-Remove-usage-of-six-library.patch b/SOURCES/0002-Remove-usage-of-six-library.patch new file mode 100644 index 0000000..a3abc20 --- /dev/null +++ b/SOURCES/0002-Remove-usage-of-six-library.patch @@ -0,0 +1,83 @@ +From a547bcc3f6fd5e6867b9761b657c684aaa1a059d Mon Sep 17 00:00:00 2001 +From: Takashi Kajinami +Date: Sun, 22 Aug 2021 13:45:22 +0900 +Subject: [PATCH 2/2] Remove usage of six library + +... because now ldappool supports Python 3 only. + +Change-Id: Ibeb60dbc81ef5b03f0732439ed07c2b672e78df5 +--- + ldappool/__init__.py | 22 ++++++---------------- + 1 file changed, 6 insertions(+), 16 deletions(-) + +diff --git a/ldappool/__init__.py b/ldappool/__init__.py +index 738cff8..e9c8971 100644 +--- a/ldappool/__init__.py ++++ b/ldappool/__init__.py +@@ -35,7 +35,6 @@ + # ***** END LICENSE BLOCK ***** + """ LDAP Connection Pool. + """ +-import codecs + from contextlib import contextmanager + import logging + from threading import RLock +@@ -45,29 +44,26 @@ import ldap + from ldap.ldapobject import ReconnectLDAPObject + from prettytable import PrettyTable + import re +-import six +-from six import PY2 + + log = logging.getLogger(__name__) +-_utf8_encoder = codecs.getencoder('utf-8') + + + def utf8_encode(value): + """Encode a basestring to UTF-8. + +- If the string is unicode encode it to UTF-8, if the string is +- str then assume it's already encoded. Otherwise raise a TypeError. ++ If the value is string, encode it to UTF-8, if the value is ++ bytes then assume it's already encoded. Otherwise raise a TypeError. + + :param value: A basestring + :returns: UTF-8 encoded version of value + :raises TypeError: If value is not basestring + """ +- if isinstance(value, six.text_type): +- return _utf8_encoder(value)[0] +- elif isinstance(value, six.binary_type): ++ if isinstance(value, str): ++ return value.encode('utf-8') ++ elif isinstance(value, bytes): + return value + else: +- raise TypeError("bytes or Unicode expected, got %s" ++ raise TypeError("bytes or str expected, got %s" + % type(value).__name__) + + +@@ -169,9 +165,6 @@ class ConnectionManager(object): + return len(self._pool) + + def _match(self, bind, passwd): +- if passwd is not None: +- if PY2: +- passwd = utf8_encode(passwd) + with self._pool_lock: + inactives = [] + +@@ -242,9 +235,6 @@ class ConnectionManager(object): + :raises BackendError: If unable to connect to LDAP + """ + connected = False +- if passwd is not None: +- if PY2: +- passwd = utf8_encode(passwd) + + # If multiple server URIs have been provided, loop through + # each one in turn in case of connection failures (server down, +-- +2.40.1 + diff --git a/SPECS/python-ldappool.spec b/SPECS/python-ldappool.spec new file mode 100644 index 0000000..f4ca0bb --- /dev/null +++ b/SPECS/python-ldappool.spec @@ -0,0 +1,202 @@ +%global srcname ldappool + +Name: python-%{srcname} + +Version: 3.0.0 +Release: 13%{?dist} +Url: https://github.com/openstack/ldappool +Summary: A connection pool for python-ldap +# Automatically converted from old format: MPLv1.1 and GPLv2+ and LGPLv2+ - review is highly recommended. +License: LicenseRef-Callaway-MPLv1.1 AND GPL-2.0-or-later AND LicenseRef-Callaway-LGPLv2+ +Source: https://files.pythonhosted.org/packages/source/l/%{srcname}/%{srcname}-%{version}.tar.gz +# TODO(jcapitao): remove the patches below once https://review.opendev.org/c/openstack/ldappool/+/805495 +# and https://review.opendev.org/c/openstack/ldappool/+/882455/ are merged and included in a new release +Patch0001: 0001-Fix-pep8-gate.patch +Patch0002: 0002-Remove-usage-of-six-library.patch +BuildArch: noarch + +%global _description\ +A simple connector pool for python-ldap.\ +\ +The pool keeps LDAP connectors alive and let you reuse them,\ +drastically reducing the time spent to initiate a ldap connection.\ +\ +The pool has useful features like:\ +\ +- transparent re-connection on failures or server restarts\ +- configurable pool size and connectors timeouts\ +- configurable max lifetime for connectors\ +- a context manager to simplify acquiring and releasing a connector + +%description %_description + +%package -n python3-%{srcname} +Summary: %summary +BuildRequires: python3-devel +BuildRequires: python3-ldap +BuildRequires: python3-pbr +BuildRequires: python3-stestr +BuildRequires: python3-testtools +BuildRequires: python3-testresources + +%description -n python3-%{srcname} %_description + +%prep +%autosetup -p1 -n %{srcname}-%{version} + +%build +%py3_build + +%install +%py3_install + +%check +PYTHON=python3 stestr-3 run + +# FIXME: add license files as soon as upstream adds them +# https://github.com/mozilla-services/ldappool/issues/2 + +%files -n python3-%{srcname} +%doc README.rst +%{python3_sitelib}/%{srcname} +%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info + +%changelog +* Sat Jan 18 2025 Fedora Release Engineering - 3.0.0-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Wed Sep 04 2024 Miroslav Suchý - 3.0.0-12 +- convert license to SPDX + +* Fri Jul 19 2024 Fedora Release Engineering - 3.0.0-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Sat Jun 08 2024 Python Maint - 3.0.0-10 +- Rebuilt for Python 3.13 + +* Fri Jan 26 2024 Fedora Release Engineering - 3.0.0-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Mon Jan 22 2024 Fedora Release Engineering - 3.0.0-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Jul 21 2023 Fedora Release Engineering - 3.0.0-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Mon Jul 03 2023 Python Maint - 3.0.0-6 +- Rebuilt for Python 3.12 + +* Tue May 23 2023 Joel Capitao - 3.0.0-5 +- Remove usage of six library + +* Fri Jan 20 2023 Fedora Release Engineering - 3.0.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Fri Jul 22 2022 Fedora Release Engineering - 3.0.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Thu Jun 16 2022 Python Maint - 3.0.0-2 +- Rebuilt for Python 3.11 + +* Wed Feb 23 2022 Karolina Kula - 3.0.0-1 +- Update to 3.0.0 +- Remove python2 subpackage + +* Fri Jan 21 2022 Fedora Release Engineering - 2.4.0-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Fri Jul 23 2021 Fedora Release Engineering - 2.4.0-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Fri Jun 04 2021 Python Maint - 2.4.0-10 +- Rebuilt for Python 3.10 + +* Wed Jan 27 2021 Fedora Release Engineering - 2.4.0-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Wed Jul 29 2020 Fedora Release Engineering - 2.4.0-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue May 26 2020 Miro Hrončok - 2.4.0-7 +- Rebuilt for Python 3.9 + +* Thu Jan 30 2020 Fedora Release Engineering - 2.4.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Oct 03 2019 Miro Hrončok - 2.4.0-5 +- Rebuilt for Python 3.8.0rc1 (#1748018) + +* Mon Aug 19 2019 Miro Hrončok - 2.4.0-4 +- Rebuilt for Python 3.8 + +* Fri Jul 26 2019 Fedora Release Engineering - 2.4.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Wed Feb 20 2019 Alfredo Moralejo - 2.4.0-2 +- Fix name for python-ldap requirement for compatibility with CentOS7 builds. + +* Wed Feb 13 2019 Alfredo Moralejo - 2.4.0-1 +- Update to 2.4.0 + +* Sat Feb 02 2019 Fedora Release Engineering - 2.1.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Thu Oct 11 2018 Miro Hrončok - 2.1.0-5 +- Python2 binary package has been removed + See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal + +* Sat Jul 14 2018 Fedora Release Engineering - 2.1.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Tue Jun 19 2018 Miro Hrončok - 2.1.0-3 +- Rebuilt for Python 3.7 + +* Tue Jun 19 2018 Miro Hrončok - 2.1.0-2 +- Rebuilt for Python 3.7 + +* Fri Apr 13 2018 Iryna Shcherbina - 2.1.0-1 +- Update to version 2.1.0 and run tests +- Add a Python 3 subpackage +- Add dependency on python-setuptools + +* Fri Feb 09 2018 Fedora Release Engineering - 1.0-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Jan 25 2018 Iryna Shcherbina - 1.0-11 +- Update Python 2 dependency declarations to new packaging standards + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + +* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek - 1.0-10 +- Python 2 binary package renamed to python2-ldappool + See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3 + +* Thu Jul 27 2017 Fedora Release Engineering - 1.0-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 1.0-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Tue Jul 19 2016 Fedora Release Engineering - 1.0-7 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Thu Feb 04 2016 Fedora Release Engineering - 1.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Thu Jun 18 2015 Fedora Release Engineering - 1.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 1.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sun Aug 04 2013 Fedora Release Engineering - 1.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Thu Feb 14 2013 Fedora Release Engineering - 1.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Sat Jul 21 2012 Fedora Release Engineering - 1.0-1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Tue Feb 28 2012 Haïkel Guémar - 1.0-0 +- initial packaging +