From 68b5766be9b0d88a6c2c78e267bdf0128bf6cec5 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Thu, 22 Feb 2024 18:01:59 +0530 Subject: [PATCH] cephfs-shell: don't use pkg_resources since its deprecated Currently, cephfs-shell prints warnings, hangs and aborts when launched. This occurs because Python module "pkg_resources" has been deprecated. We use that module only checking version of other Python modules used in cephfs-shell. Use "Version" from "packaging.version" instead. Fixes: https://tracker.ceph.com/issues/64538 Signed-off-by: Rishabh Dave --- src/tools/cephfs/shell/cephfs-shell | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/tools/cephfs/shell/cephfs-shell b/src/tools/cephfs/shell/cephfs-shell index b93f41e90b0d6..9449007a80b97 100755 --- a/src/tools/cephfs/shell/cephfs-shell +++ b/src/tools/cephfs/shell/cephfs-shell @@ -16,13 +16,12 @@ import shlex import stat import errno -from pkg_resources import packaging # type: ignore - from cmd2 import Cmd from cmd2 import __version__ as cmd2_version +from packaging.version import Version + # XXX: In cmd2 versions < 1.0.1, we'll get SystemExit(2) instead of # Cmd2ArgparseError -Version = packaging.version.Version if Version(cmd2_version) >= Version("1.0.1"): from cmd2.exceptions import Cmd2ArgparseError else: -- 2.39.5