[PATCH] chore: remove use of the Python six package.

Matěj Cepl mcepl at cepl.eu
Wed Jun 18 08:08:11 PDT 2025


Python 2 has been truly and completely dead for over five years,
I don’t know about any Linux distribution which wouldn’t have
Python 3 as its default Python. Please, let it die.
---
 README                 | 3 +--
 nvmet/nvme.py          | 7 +++----
 rpm/nvmetcli.spec.tmpl | 2 +-
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/README b/README
index 6ebe666..6a7beb1 100644
--- a/README
+++ b/README
@@ -14,8 +14,7 @@ using setup.py.
 
 Common Package Dependencies and Problems
 -----------------------------------------
-Both python2 and python3 are supported via use of the 'python-six'
-package.
+Python3 is supported.
 
 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..a2e2b40 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 xrange(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 xrange(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.49.0




More information about the Linux-nvme mailing list