Package 3.0.0b1

This commit is contained in:
Christian Heimes 2017-12-04 15:48:10 +01:00
parent 25fc6c9748
commit 92c2998e8d
5 changed files with 108 additions and 220 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ python-ldap-2.3.10.tar.gz
/python-ldap-2.4.16.tar.gz /python-ldap-2.4.16.tar.gz
/python-ldap-2.4.17.tar.gz /python-ldap-2.4.17.tar.gz
/python-ldap-2.4.25.tar.gz /python-ldap-2.4.25.tar.gz
/python-ldap-3.0.0b1.tar.gz

View File

@ -1,168 +0,0 @@
From a89bd2361a3971d0dc11908707509bbf5e1fd1ac Mon Sep 17 00:00:00 2001
From: Ilya Etingof <etingof@gmail.com>
Date: Wed, 11 Oct 2017 20:27:41 +0200
Subject: [PATCH] accommodate changed pyasn1 behaviour
pyasn1 versions prior to 0.2.3 indicate absent value by
returning `None` object, later pyasn1 versions use
the `noValue` sentinel object which is the basis for
the `.hasValue()` method call (and .isValue property).
This fix makes the code compatible with both `None` sentinel
and the `.hasValue()` test thus making it compatible with all
reasonable pyasn1 versions in circulation.
---
Index: Lib/ldap/syncrepl.py
===================================================================
RCS file: /cvsroot/python-ldap/python-ldap/Lib/ldap/syncrepl.py,v
retrieving revision 1.9
diff -u -r1.9 syncrepl.py
--- Lib/ldap/syncrepl.py 9 Oct 2017 15:09:28 -0000 1.9
+++ Lib/ldap/syncrepl.py 7 Nov 2017 13:40:32 -0000
@@ -131,11 +131,13 @@
d = decoder.decode(encodedControlValue, asn1Spec = syncStateValue())
state = d[0].getComponentByName('state')
uuid = UUID(bytes=d[0].getComponentByName('entryUUID'))
- self.cookie = d[0].getComponentByName('cookie')
+ cookie = d[0].getComponentByName('cookie')
+ if cookie is None or not cookie.hasValue():
+ self.cookie = None
+ else:
+ self.cookie = str(cookie)
self.state = self.__class__.opnames[int(state)]
self.entryUUID = str(uuid)
- if self.cookie is not None:
- self.cookie = str(self.cookie)
KNOWN_RESPONSE_CONTROLS[SyncStateControl.controlType] = SyncStateControl
@@ -165,10 +167,10 @@
def decodeControlValue(self, encodedControlValue):
d = decoder.decode(encodedControlValue, asn1Spec = syncDoneValue())
- self.cookie = d[0].getComponentByName('cookie')
+ cookie = d[0].getComponentByName('cookie')
+ if cookie is not None and cookie.hasValue():
+ self.cookie = str(cookie)
self.refreshDeletes = d[0].getComponentByName('refreshDeletes')
- if self.cookie is not None:
- self.cookie = str(self.cookie)
if self.refreshDeletes is not None:
self.refreshDeletes = bool(self.refreshDeletes)
@@ -263,7 +265,7 @@
for attr in [ 'newcookie', 'refreshDelete', 'refreshPresent', 'syncIdSet']:
comp = d[0].getComponentByName(attr)
- if comp is not None:
+ if comp is not None and comp.hasValue():
if attr == 'newcookie':
self.newcookie = str(comp)
@@ -272,7 +274,7 @@
val = dict()
cookie = comp.getComponentByName('cookie')
- if cookie is not None:
+ if cookie is not None and cookie.hasValue():
val['cookie'] = str(cookie)
if attr.startswith('refresh'):
Index: Lib/ldap/controls/ppolicy.py
===================================================================
RCS file: /cvsroot/python-ldap/python-ldap/Lib/ldap/controls/ppolicy.py,v
retrieving revision 1.6
diff -u -r1.6 ppolicy.py
--- Lib/ldap/controls/ppolicy.py 9 Oct 2017 15:09:28 -0000 1.6
+++ Lib/ldap/controls/ppolicy.py 7 Nov 2017 13:40:32 -0000
@@ -71,7 +71,7 @@
def decodeControlValue(self,encodedControlValue):
ppolicyValue,_ = decoder.decode(encodedControlValue,asn1Spec=PasswordPolicyResponseValue())
warning = ppolicyValue.getComponentByName('warning')
- if warning is None:
+ if warning is None or not warning.hasValue():
self.timeBeforeExpiration,self.graceAuthNsRemaining = None,None
else:
timeBeforeExpiration = warning.getComponentByName('timeBeforeExpiration')
@@ -85,7 +85,7 @@
else:
self.graceAuthNsRemaining = None
error = ppolicyValue.getComponentByName('error')
- if error is None:
+ if error is None or not error.hasValue():
self.error = None
else:
self.error = int(error)
Index: Lib/ldap/controls/psearch.py
===================================================================
RCS file: /cvsroot/python-ldap/python-ldap/Lib/ldap/controls/psearch.py,v
retrieving revision 1.6
diff -u -r1.6 psearch.py
--- Lib/ldap/controls/psearch.py 9 Oct 2017 15:09:28 -0000 1.6
+++ Lib/ldap/controls/psearch.py 7 Nov 2017 13:40:32 -0000
@@ -115,18 +115,16 @@
def decodeControlValue(self,encodedControlValue):
ecncValue,_ = decoder.decode(encodedControlValue,asn1Spec=EntryChangeNotificationValue())
self.changeType = int(ecncValue.getComponentByName('changeType'))
- if len(ecncValue)==3:
- self.previousDN = str(ecncValue.getComponentByName('previousDN'))
- self.changeNumber = int(ecncValue.getComponentByName('changeNumber'))
- elif len(ecncValue)==2:
- if self.changeType==8:
- self.previousDN = str(ecncValue.getComponentByName('previousDN'))
- self.changeNumber = None
- else:
- self.previousDN = None
- self.changeNumber = int(ecncValue.getComponentByName('changeNumber'))
+ previousDN = ecncValue.getComponentByName('previousDN')
+ if previousDN is None or not previousDN.hasValue():
+ self.previousDN = None
else:
- self.previousDN,self.changeNumber = None,None
+ self.previousDN = str(previousDN)
+ changeNumber = ecncValue.getComponentByName('changeNumber')
+ if changeNumber is None or not changeNumber.hasValue():
+ self.changeNumber = None
+ else:
+ self.changeNumber = int(changeNumber)
return (self.changeType,self.previousDN,self.changeNumber)
KNOWN_RESPONSE_CONTROLS[EntryChangeNotificationControl.controlType] = EntryChangeNotificationControl
Index: Lib/ldap/controls/sss.py
===================================================================
RCS file: /cvsroot/python-ldap/python-ldap/Lib/ldap/controls/sss.py,v
retrieving revision 1.5
diff -u -r1.5 sss.py
--- Lib/ldap/controls/sss.py 9 Oct 2017 15:09:28 -0000 1.5
+++ Lib/ldap/controls/sss.py 7 Nov 2017 13:40:32 -0000
@@ -121,7 +121,9 @@
assert not rest, 'all data could not be decoded'
self.result = int(p.getComponentByName('sortResult'))
self.result_code = p.getComponentByName('sortResult').prettyOut(self.result)
- self.attribute_type_error = p.getComponentByName('attributeType')
+ attribute_type_error = p.getComponentByName('attributeType')
+ if attribute_type_error is not None and attribute_type_error.hasValue():
+ self.attribute_type_error = attribute_type_error
KNOWN_RESPONSE_CONTROLS[SSSRequestControl.controlType] = SSSRequestControl
Index: Lib/ldap/controls/vlv.py
===================================================================
RCS file: /cvsroot/python-ldap/python-ldap/Lib/ldap/controls/vlv.py,v
retrieving revision 1.5
diff -u -r1.5 vlv.py
--- Lib/ldap/controls/vlv.py 9 Oct 2017 15:09:28 -0000 1.5
+++ Lib/ldap/controls/vlv.py 7 Nov 2017 13:40:32 -0000
@@ -130,8 +130,9 @@
self.result = int(p.getComponentByName('virtualListViewResult'))
self.result_code = p.getComponentByName('virtualListViewResult') \
.prettyOut(self.result)
- self.context_id = p.getComponentByName('contextID')
- if self.context_id:
- self.context_id = str(self.context_id)
+ context_id = p.getComponentByName('contextID')
+ if context_id is not None and context_id.hasValue():
+ self.context_id = str(context_id)
+
KNOWN_RESPONSE_CONTROLS[VLVResponseControl.controlType] = VLVResponseControl

View File

@ -1,16 +0,0 @@
diff --git a/setup.cfg b/setup.cfg
index aafa110..4dcf73a 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,8 +1,8 @@
[_ldap]
-library_dirs = /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64
-include_dirs = /usr/include /usr/include/sasl /usr/local/include /usr/local/include/sasl
+library_dirs = /usr/lib /usr/lib64
+include_dirs = /usr/include/sasl /usr/include
defines = HAVE_SASL HAVE_TLS HAVE_LIBLDAP_R
-extra_compile_args =
+extra_compile_args = -g
extra_objects =
libs = ldap_r

View File

@ -1,36 +1,34 @@
### Abstract ### ### Abstract ###
%global prerelease b1
Name: python-ldap Name: python-ldap
Version: 2.4.25 Version: 3.0.0
Release: 9%{?dist} Release: 0.1.%{prerelease}%{?dist}
Epoch: 0
License: Python License: Python
Group: System Environment/Libraries Group: System Environment/Libraries
Summary: An object-oriented API to access LDAP directory servers Summary: An object-oriented API to access LDAP directory servers
URL: http://python-ldap.sourceforge.net/ URL: http://python-ldap.org/
Source0: http://pypi.python.org/packages/source/p/python-ldap/python-ldap-%{version}.tar.gz Source0: https://files.pythonhosted.org/packages/source/p/%{name}/%{name}-%{version}%{prerelease}.tar.gz
### Patches ###
# Fedora specific patch
Patch0: python-ldap-2.4.16-dirs.patch
# Fix for pyasn1 >= 0.3
# https://github.com/pyldap/pyldap/pull/126
Patch1: accommodate-changed-pyasn1-behaviour.patch
### Dependencies ###
# LDAP controls, extop, syncrepl require pyasn1
### Build Dependencies ### ### Build Dependencies ###
BuildRequires: openldap-devel BuildRequires: openldap-devel
BuildRequires: openssl-devel BuildRequires: openssl-devel
BuildRequires: python2-devel
BuildRequires: cyrus-sasl-devel BuildRequires: cyrus-sasl-devel
BuildRequires: python2-devel
# we don't want to provide private python extension libs BuildRequires: python2-setuptools
%{?filter_setup: BuildRequires: python3-devel
%filter_provides_in %{python_sitearch}/.*\.so$ BuildRequires: python3-setuptools
%filter_setup # Test dependencies
} BuildRequires: /usr/bin/tox
BuildRequires: openldap-servers
BuildRequires: openldap-clients
BuildRequires: python2-coverage
BuildRequires: python2-pyasn1 >= 0.3.7
BuildRequires: python2-pyasn1-modules >= 0.1.5
BuildRequires: python3-coverage
BuildRequires: python3-pyasn1 >= 0.3.7
BuildRequires: python3-pyasn1-modules >= 0.1.5
%global _description\ %global _description\
python-ldap provides an object-oriented API for working with LDAP within\ python-ldap provides an object-oriented API for working with LDAP within\
@ -40,44 +38,117 @@ OpenLDAP 2.x libraries, and contains modules for other LDAP-related tasks\
%description %_description %description %_description
%package -n python2-ldap %package -n python2-ldap
Summary: %summary Summary: %summary
Requires: openldap Requires: openldap
Requires: python-pyasn1, python-pyasn1-modules Requires: python2-pyasn1 >= 0.3.7
Requires: python2-pyasn1-modules >= 0.1.5
Requires: python2-setuptools
Provides: python2-ldap%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python2-ldap} %{?python_provide:%python_provide python2-ldap}
%description -n python2-ldap %_description %description -n python2-ldap %_description
%prep
%setup -q -n python-ldap-%{version}
%patch0 -p1 -b .dirs
%patch1 -p0 -b accommodate-changed-pyasn1-behaviour.patch
# clean up cvs hidden files %package -n python3-ldap
rm -rf Demo/Lib/ldap/.cvsignore Demo/.cvsignore Demo/Lib/ldif/.cvsignore Demo/Lib/ldap/async/.cvsignore \ Summary: %{summary}
Demo/Lib/.cvsignore Demo/Lib/ldapurl/.cvsignore
Requires: openldap
Requires: python3-pyasn1 >= 0.3.7
Requires: python3-pyasn1-modules >= 0.1.5
Requires: python3-setuptools
%{?python_provide:%python_provide python3-ldap}
Obsoletes: python3-pyldap
Provides: python3-pyldap = %{version}-%{release}
Provides: python3-pyldap%{?_isa} = %{version}-%{release}
%description -n python3-ldap %_description
%prep
%setup -qc
sed -i 's|#! python|#!/usr/bin/python|g' %{name}-%{version}%{prerelease}/Demo/simplebrowse.py
mv %{name}-%{version}%{prerelease} python3
cp -a python{3,2}
# Fix interpreter # Fix interpreter
sed -i 's|#! python|#!/usr/bin/python|g' Demo/simplebrowse.py find python2 -name '*.py' | xargs sed -i '1s|^#!/usr/bin/env python|#!%{__python2}|'
find python3 -name '*.py' | xargs sed -i '1s|^#!/usr/bin/env python|#!%{__python3}|'
# Disable warnings in test to work around "'U' mode is deprecated"
# https://github.com/python-ldap/python-ldap/issues/96
sed -i 's,-Werror,-Wignore,g' python3/tox.ini
%build %build
%{__python} setup.py build pushd python2
%py2_build
popd
pushd python3
%py3_build
popd
%check
# don't download packages
export PIP_INDEX_URL=http://host.invalid./
export PIP_NO_DEPS=yes
pushd python2
LANG=C.UTF-8 TOXENV=py27 LOGLEVEL=10 tox --sitepackages
popd
pushd python3
LANG=C.UTF-8 TOXENV=py%{python3_version_nodots} LOGLEVEL=10 tox --sitepackages
popd
%install %install
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT pushd python2
%py2_install
popd
pushd python3
%py3_install
popd
%files -n python2-ldap %files -n python2-ldap
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc LICENCE CHANGES README TODO Demo %license python2/LICENCE
%doc python2/CHANGES python2/README python2/TODO python2/Demo
%{python_sitearch}/_ldap.so %{python_sitearch}/_ldap.so
%{python_sitearch}/dsml.py*
%{python_sitearch}/ldapurl.py* %{python_sitearch}/ldapurl.py*
%{python_sitearch}/ldif.py* %{python_sitearch}/ldif.py*
%{python_sitearch}/slapdtest/
%{python_sitearch}/ldap/ %{python_sitearch}/ldap/
%{python_sitearch}/python_ldap-%{version}-*.egg-info %{python_sitearch}/python_ldap-%{version}%{prerelease}-py2.7.egg-info
%files -n python3-ldap
%defattr(-,root,root,-)
%license python3/LICENCE
%doc python3/CHANGES python3/README python3/TODO python3/Demo
%{python3_sitearch}/_ldap.cpython-*.so
%{python3_sitearch}/ldapurl.py*
%{python3_sitearch}/ldif.py*
%{python3_sitearch}/__pycache__/*
%{python3_sitearch}/slapdtest/
%{python3_sitearch}/ldap/
%{python3_sitearch}/python_ldap-%{version}%{prerelease}-py%{python3_version}.egg-info
%changelog %changelog
* Mon Dec 04 2017 Christian Heimes <cheimes@redhat.com> - 0:2.5.99-1
- New upstream release 3.0.0b1 (RHBZ #1496470)
- Resolves RHBZ #1489184
- Enable unittests
- Remove dsml module
- Package python3-ldap, which obsoletes python3-pyldap
* Wed Nov 08 2017 Christian Heimes <cheimes@redhat.com> - 0:2.4.25-9 * Wed Nov 08 2017 Christian Heimes <cheimes@redhat.com> - 0:2.4.25-9
- Fix issue in pyasn1 patch - Fix issue in pyasn1 patch

View File

@ -1 +1 @@
21523bf21dbe566e0259030f66f7a487 python-ldap-2.4.25.tar.gz SHA512 (python-ldap-3.0.0b1.tar.gz) = 3c1114756ed6ac7e6c3ec6e39c0637dc40c07c4d3b28c460b9ed8450e63c492a4d44afb275dd00933f25b61c78f2d99d5924270684983526770463e1162320d7