From 9f0ee9798563efe4ce9759f5d8c0ca6aa47a6838 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sun, 18 Dec 2022 20:15:06 +0800 Subject: [PATCH] pybind/mgr/prometheus: avoid using distutils to silence warnings like: 4: prometheus/module.py:35 4: /var/ssd/ceph/src/pybind/mgr/prometheus/module.py:35: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead. 4: v = StrictVersion(cherrypy.__version__) Signed-off-by: Kefu Chai --- src/pybind/mgr/prometheus/module.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index 6366469e99e..12564314f3c 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -1,6 +1,6 @@ import cherrypy from collections import defaultdict -from distutils.version import StrictVersion +from packaging.version import Version import json import math import os @@ -32,10 +32,10 @@ DEFAULT_PORT = 9283 # ipv6 isn't yet configured / supported and CherryPy throws an uncaught # exception. if cherrypy is not None: - v = StrictVersion(cherrypy.__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. - if StrictVersion("3.1.2") <= v < StrictVersion("3.2.3"): + if Version("3.1.2") <= v < Version("3.2.3"): # https://github.com/cherrypy/cherrypy/issues/1100 from cherrypy.process import servers servers.wait_for_occupied_port = lambda host, port: None -- 2.39.5