]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/prometheus: s/pkg_resources.packaging/packaging/ 58623/head
authorKefu Chai <tchaikov@gmail.com>
Sat, 25 May 2024 05:50:43 +0000 (13:50 +0800)
committerAdam King <adking@redhat.com>
Tue, 16 Jul 2024 14:52:17 +0000 (10:52 -0400)
instead of relying on the internal implementation of pkg_resources,
let's import packaging directly.

in this change, we also add the dependency to the packaging module
in the packaging recipes.

See also https://github.com/pypa/setuptools/issues/4385

Fixes https://tracker.ceph.com/issues/66201
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
(cherry picked from commit 844b66de419d7bf5f622980b0de3c69b5ad8bc9c)

ceph.spec.in
debian/ceph-mgr-modules-core.requires
src/pybind/mgr/prometheus/module.py

index 75f38ec5473d6852e7e39f34419fd1436d7ef4ce..5f432779a89b6ac2d5da967f90eb33fabf8e153e 100644 (file)
@@ -689,6 +689,7 @@ BuildArch:      noarch
 Group:          System/Filesystems
 %endif
 Requires:       python%{python3_pkgversion}-bcrypt
+Requires:       python%{python3_pkgversion}-packaging
 Requires:       python%{python3_pkgversion}-pecan
 Requires:       python%{python3_pkgversion}-pyOpenSSL
 Requires:       python%{python3_pkgversion}-requests
index 9814e67b7108cf9ba99b11ddefa1c3f5fab285c3..b5d37b3a9ce8c44b315f7e7d4679baa3fddc940a 100644 (file)
@@ -1,5 +1,6 @@
 natsort
 CherryPy
+packaging
 pecan
 werkzeug
 requests
index 45a6c9f00137002d54909dd3dea466bdcefaf8b5..6f675e3be003853c6b7ea37a4f530810cf499bf5 100644 (file)
@@ -1,7 +1,6 @@
 import cherrypy
 import yaml
 from collections import defaultdict
-from pkg_resources import packaging  # type: ignore
 import json
 import math
 import os
@@ -9,6 +8,7 @@ import re
 import threading
 import time
 import enum
+from packaging import version  # type: ignore
 from collections import namedtuple
 
 from mgr_module import CLIReadCommand, MgrModule, MgrStandbyModule, PG_STATES, Option, ServiceInfoT, HandleCommandResult, CLIWriteCommand
@@ -34,7 +34,7 @@ DEFAULT_PORT = 9283
 # ipv6 isn't yet configured / supported and CherryPy throws an uncaught
 # exception.
 if cherrypy is not None:
-    Version = packaging.version.Version
+    Version = version.Version
     v = Version(cherrypy.__version__)
     # the issue was fixed in 3.2.3. it's present in 3.2.2 (current version on
     # centos:7) and back to at least 3.0.0.