Skip to content

Commit 1afd0cc

Browse files
mart-ed-fence
authored andcommitted
[FIX] auth_ldap: replace the deprecated library by one up to date
At 795c7b0 the external dependencies was changed from trying to import 'ldap' to checking than 'pyldap' package was installed. The problem is that pyldap is a unmaintained library that should no longer be used, as explained on the package page: https://pypi.org/project/pyldap/ "The pyldap fork was merged back into python-ldap, and released as python-ldap 3.0.0." Having pyldap version >= 3.0 installs python-ldap automatically and will not cause any issue. The Debian control file package name is adapted to use the latest. The "ldap" externalm dependency defined in __manifest__.py will cause pkg_resources.get_distribution() to fail in both case ("python-lap" or "pyldap"), but the "import" fallback will succeed. For that reason, the log warning is turned into a log info. closes odoo#40249 Note: This library should be replaced by the pure python "ldap3" library. Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
1 parent c395eb9 commit 1afd0cc

File tree

9 files changed

+7
-9
lines changed

9 files changed

+7
-9
lines changed

addons/auth_ldap/README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Adds support for authentication by LDAP server.
33
This module allows users to login with their LDAP username and password, and
44
will automatically create Odoo users for them on the fly.
55

6-
**Note:** This module only work on servers who have Python's ``ldap`` module installed.
6+
**Note:** This module only work on servers that have Python's ``python-ldap`` module installed.
77

88
Configuration:
99
--------------

addons/auth_ldap/__manifest__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
'views/res_config_settings_views.xml',
1212
],
1313
'external_dependencies': {
14-
'python': ['pyldap'],
14+
'python': ['ldap'],
1515
}
1616
}

addons/point_of_sale/tools/posbox/overwrite_before_init/etc/init_posbox_image.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ PKGS_TO_INSTALL="
6868
python3-feedparser \
6969
python3-pil \
7070
python3-jinja2 \
71-
python3-ldap3 \
71+
python3-ldap \
7272
python3-lxml \
7373
python3-mako \
7474
python3-mock \

debian/control

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Replaces: tinyerp-server, openerp-server, openerp-web, openerp
5151
Recommends:
5252
${python3:Recommends},
5353
postgresql,
54-
python3-pyldap,
54+
python3-ldap,
5555
Description: Open Source Apps To Grow Your Business
5656
Odoo, formerly known as OpenERP, is a suite of open-source business apps
5757
written in Python and released under the LGPLv3 license. This suite of

odoo/addons/base/models/ir_module.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def _check_python_external_dependency(pydep):
315315
except pkg_resources.DistributionNotFound as e:
316316
try:
317317
importlib.import_module(pydep)
318-
_logger.warning("python external dependency %s should be replaced by it's PyPI package name", pydep)
318+
_logger.info("python external dependency on '%s' does not appear to be a valid PyPI package. Using a PyPI package name is recommended.", pydep)
319319
except ImportError:
320320
# backward compatibility attempt failed
321321
_logger.warning("DistributionNotFound: %s", e)

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ psutil==5.5.1
2828
psycopg2==2.7.7; sys_platform != 'win32'
2929
psycopg2==2.8.3; sys_platform == 'win32'
3030
pydot==1.4.1
31-
pyldap==2.4.28; sys_platform != 'win32'
31+
python-ldap==3.1.0; sys_platform != 'win32'
3232
pyparsing==2.2.0
3333
PyPDF2==1.26.0
3434
pyserial==3.4

setup.cfg

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ requires =
3333
python3-psycopg2
3434
python3-polib
3535
python3-pydot
36-
python3-pyldap
3736
python3-pyparsing
3837
python3-PyPDF2
3938
python3-pyserial

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
],
6060
python_requires='>=3.6',
6161
extras_require={
62-
'ldap': ['pyldap'],
62+
'ldap': ['python-ldap'],
6363
'SSL': ['pyopenssl'],
6464
},
6565
tests_require=[

setup/win32/winpy_requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ polib>=1.1.0
1919
psutil>=4.3.1
2020
psycopg2==2.7.1
2121
pydot==1.2.3
22-
pyldap>=2.4.28
2322
pyparsing==2.1.10
2423
PyPDF2==1.26.0
2524
pyserial==3.1.1

0 commit comments

Comments
 (0)