[PATCH] Drop python2 support and the dependency on python-six

Tomas Hrnciar thrnciar at redhat.com
Tue Jun 23 05:24:28 PDT 2026


Hi,

I'd like to propose a patch which removes support for Python 2 and
drops the dependency on python-six. Python 2 has been EOL since
January 2020 and we are trying to remove python-six from distribution.
This patch drops the remaining six usage.

Thanks,
Tomáš Hrnčiar
---
 README                 | 3 ---
 nvmet/nvme.py          | 7 +++----
 rpm/nvmetcli.spec.tmpl | 2 +-
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/README b/README
index 6ebe666..7df25f1 100644
--- a/README
+++ b/README
@@ -14,9 +14,6 @@ using setup.py.

 Common Package Dependencies and Problems
 -----------------------------------------
-Both python2 and python3 are supported via use of the 'python-six'
-package.
-
 nvmetcli uses the 'pyparsing' package -- running nvmetcli without this
 package may produce hard-to-decipher errors.

diff --git a/nvmet/nvme.py b/nvmet/nvme.py
index 59efdb5..4c63eb1 100644
--- a/nvmet/nvme.py
+++ b/nvmet/nvme.py
@@ -23,7 +23,6 @@ import stat
 import uuid
 import json
 from glob import iglob as glob
-from six import iteritems, moves

 DEFAULT_SAVE_FILE = '/etc/nvmet/config.json'

@@ -220,7 +219,7 @@ class CFSNode(object):

     def _setup_attrs(self, attr_dict, err_func):
         for group in self.attr_groups:
-            for name, value in iteritems(attr_dict.get(group, {})):
+            for name, value in attr_dict.get(group, {}).items():
                 try:
                     self.set_attr(group, name, value)
                 except CFSError as e:
@@ -556,7 +555,7 @@ class Namespace(CFSNode):
                 raise CFSError("Need NSID for lookup")

             nsids = [n.nsid for n in subsystem.namespaces]
-            for index in moves.xrange(1, self.MAX_NSID + 1):
+            for index in range(1, self.MAX_NSID + 1):
                 if index not in nsids:
                     nsid = index
                     break
@@ -816,7 +815,7 @@ class ANAGroup(CFSNode):
                 raise CFSError("Need grpid for lookup")

             grpids = [n.grpid for n in port.ana_groups]
-            for index in moves.xrange(2, self.MAX_GRPID + 1):
+            for index in range(2, self.MAX_GRPID + 1):
                 if index not in grpids:
                     grpid = index
                     break
diff --git a/rpm/nvmetcli.spec.tmpl b/rpm/nvmetcli.spec.tmpl
index f1b5533..ce454a2 100644
--- a/rpm/nvmetcli.spec.tmpl
+++ b/rpm/nvmetcli.spec.tmpl
@@ -9,7 +9,7 @@ Source:         nvmetcli-%{version}.tar.gz
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-rpmroot
 BuildArch:      noarch
 BuildRequires:  python-devel python-setuptools systemd-units
-Requires:    python-configshell python-kmod python-six
+Requires:    python-configshell python-kmod
 Requires(post): systemd
 Requires(preun): systemd
 Requires(postun): systemd
-- 
2.53.0




More information about the Linux-nvme mailing list