upgpkg: ocaml-topkg 1.0.5-2
[arch-packages.git] / 389-ds-base / trunk / bcf5e9f.patch
blobe1c52c011eb2a83aa5e547f950b247ba5c98b606
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'
7 Bug Description:
9 Arch Linux ships python-setuptools stripped of vendored packages.
10 This makes lib389 fail with ModuleNotFoundError on import.
12 Fix Description:
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!)
21 ---
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
28 import operator
29 import subprocess
30 import math
31 -from pkg_resources.extern.packaging.version import LegacyVersion
32 +# Setuptools ships with 'packaging' module, let's use it from there
33 +try:
34 + from pkg_resources.extern.packaging.version import LegacyVersion
35 +# Fallback to a normal 'packaging' module in case 'setuptools' is stripped
36 +except:
37 + from packaging.version import LegacyVersion
38 from socket import getfqdn
39 from ldapurl import LDAPUrl
40 from contextlib import closing