Make python-ldap optional for PyPI packages
python-ldap is a Python package with heavy C extensions. In order to build python-ldap, not only OpenLDAP development headers are necessary, but also OpenSSL, Cyrus SASL, and MIT KRB5 development headers. A fully functional ipaclient doesn't need an LDAP driver. It talks JSON RPC over HTTPS to a server. python-ldap is only used by ipapython.dn.DN to convert a string to a DN with ldap_str2dn(). The function is simple and can be wrapped with ctypes in a bunch of lines. Related: https://pagure.io/freeipa/issue/6468 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
1 parent
c314411130
commit
2a459ce0f2
8 files changed
+243
-12
No files matched your search
+8
-2
@@ -423,10 +423,16 @@ import sys
|
||||
import functools
|
||||
|
||||
import cryptography.x509
|
||||
from ldap.dn import str2dn, dn2str
|
||||
from ldap import DECODING_ERROR
|
||||
import six
|
||||
|
||||
try:
|
||||
from ldap import DECODING_ERROR
|
||||
except ImportError:
|
||||
from ipapython.dn_ctypes import str2dn, dn2str, DECODING_ERROR
|
||||
else:
|
||||
from ldap.dn import str2dn, dn2str
|
||||
|
||||
|
||||
if six.PY3:
|
||||
unicode = str
|
||||
|
||||
|
||||
Reference in new issue
Block a user