1 From bcf5e9f980b3725b82e8f1ae4b4778150f67e225 Mon Sep 17 00:00:00 2001
2 From: Viktor Ashirov <vashirov@redhat.com>
3 Date: Dec 10 2019 15:40:32 +0000
4 Subject: Issue 50771 - 1.4.2.5 doesn't compile due to error ModuleNotFoundError: No module named 'pkg_resources.extern'
9 Arch Linux ships python-setuptools stripped of vendored packages.
10 This makes lib389 fail with ModuleNotFoundError on import.
14 Use a fallback to `packaging` module.
16 Fixes: https://pagure.io/389-ds-base/issue/50771
17 Relates: https://pagure.io/389-ds-base/issue/50712
19 Reviewed by: mhonek (Thanks!)
23 diff --git a/src/lib389/lib389/utils.py b/src/lib389/lib389/utils.py
24 index 70a3a10..36422dd 100644
25 --- a/src/lib389/lib389/utils.py
26 +++ b/src/lib389/lib389/utils.py
27 @@ -40,7 +40,12 @@ import shlex
31 -from pkg_resources.extern.packaging.version import LegacyVersion
32 +# Setuptools ships with 'packaging' module, let's use it from there
34 + from pkg_resources.extern.packaging.version import LegacyVersion
35 +# Fallback to a normal 'packaging' module in case 'setuptools' is stripped
37 + from packaging.version import LegacyVersion
38 from socket import getfqdn
39 from ldapurl import LDAPUrl
40 from contextlib import closing