15
0

Accepting request 1168523 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/1168523
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-configshell-fb?expand=0&rev=18
This commit is contained in:
2024-04-17 12:46:19 +00:00
committed by Git OBS Bridge
3 changed files with 172 additions and 6 deletions

160
no-six.patch Normal file
View File

@@ -0,0 +1,160 @@
Index: python-configshell-fb-1.1.30/configshell/console.py
===================================================================
--- python-configshell-fb-1.1.30.orig/configshell/console.py
+++ python-configshell-fb-1.1.30/configshell/console.py
@@ -17,7 +17,6 @@ under the License.
from fcntl import ioctl
import re
-import six
import struct
import sys
from termios import TIOCGWINSZ, TCSADRAIN, tcsetattr, tcgetattr
Index: python-configshell-fb-1.1.30/configshell/node.py
===================================================================
--- python-configshell-fb-1.1.30.orig/configshell/node.py
+++ python-configshell-fb-1.1.30/configshell/node.py
@@ -17,7 +17,6 @@ under the License.
import inspect
import re
-import six
class ExecutionError(Exception):
pass
@@ -503,7 +502,7 @@ class ConfigNode(object):
elif group not in self.list_config_groups():
raise ExecutionError("Unknown configuration group: %s" % group)
- for param, value in six.iteritems(parameter):
+ for param, value in parameter.items():
if param not in self.list_group_params(group):
raise ExecutionError("Unknown parameter %s in group '%s'."
% (param, group))
@@ -1256,7 +1255,7 @@ class ConfigNode(object):
bookmarks += "No bookmarks yet.\n"
else:
for (bookmark, path) \
- in six.iteritems(self.shell.prefs['bookmarks']):
+ in self.shell.prefs['bookmarks'].items():
if len(bookmark) == 1:
bookmark += '\0'
underline = ''.ljust(len(bookmark), '-')
@@ -1703,7 +1702,7 @@ class ConfigNode(object):
return []
else:
params = []
- for p_name, p_def in six.iteritems(self._configuration_groups[group]):
+ for p_name, p_def in self._configuration_groups[group].items():
(p_type, p_description, p_writable) = p_def
if writable is not None and p_writable != writable:
continue
Index: python-configshell-fb-1.1.30/configshell/prefs.py
===================================================================
--- python-configshell-fb-1.1.30.orig/configshell/prefs.py
+++ python-configshell-fb-1.1.30/configshell/prefs.py
@@ -16,8 +16,8 @@ under the License.
'''
import os
-import six
import fcntl
+import pickle
class Prefs(object):
'''
@@ -116,7 +116,7 @@ class Prefs(object):
@return: Iterates on the items in preferences.
@rtype: yields items that are (key, value) pairs
'''
- return six.iteritems(self._prefs)
+ return self._prefs.items()
def save(self, filename=None):
'''
@@ -132,7 +132,7 @@ class Prefs(object):
fsock = open(filename, 'wb')
fcntl.lockf(fsock, fcntl.LOCK_UN)
try:
- six.moves.cPickle.dump(self._prefs, fsock, 2)
+ pickle.dump(self._prefs, fsock, 2)
finally:
fsock.close()
@@ -148,6 +148,6 @@ class Prefs(object):
fsock = open(filename, 'rb')
fcntl.lockf(fsock, fcntl.LOCK_SH)
try:
- self._prefs = six.moves.cPickle.load(fsock)
+ self._prefs = pickle.load(fsock)
finally:
fsock.close()
Index: python-configshell-fb-1.1.30/configshell/shell.py
===================================================================
--- python-configshell-fb-1.1.30.orig/configshell/shell.py
+++ python-configshell-fb-1.1.30/configshell/shell.py
@@ -16,7 +16,6 @@ under the License.
'''
import os
-import six
import sys
from pyparsing import (alphanums, Empty, Group, locatedExpr,
OneOrMore, Optional, ParseResults, Regex,
@@ -173,7 +172,7 @@ class ConfigShell(object):
self.log.warning("Could not load preferences file %s."
% self._prefs_file)
- for pref, value in six.iteritems(self.default_prefs):
+ for pref, value in self.default_prefs.items():
if pref not in self.prefs:
self.prefs[pref] = value
@@ -239,7 +238,7 @@ class ConfigShell(object):
else:
nr_cols = 1
- for i in six.moves.range(0, len(matches), nr_cols):
+ for i in range(0, len(matches), nr_cols):
self.con.raw_write(''.join(matches[i:i+nr_cols]))
self.con.raw_write('\n')
@@ -402,7 +401,7 @@ class ConfigShell(object):
for index in range(len(pparams)):
if index < len(cmd_params):
current_parameters[cmd_params[index]] = pparams[index]
- for key, value in six.iteritems(kparams):
+ for key, value in kparams.items():
current_parameters[key] = value
self._completion_help_topic = command
completion_method = target.get_completion_method(command)
@@ -550,7 +549,7 @@ class ConfigShell(object):
current_parameters = {}
for index in range(len(pparams)):
current_parameters[cmd_params[index]] = pparams[index]
- for key, value in six.iteritems(kparams):
+ for key, value in kparams.items():
current_parameters[key] = value
completion_method = target.get_completion_method(command)
if completion_method:
@@ -722,7 +721,7 @@ class ConfigShell(object):
try:
readline.parse_and_bind("tab: complete")
readline.set_completer(self._complete)
- cmdline = six.moves.input(self._get_prompt()).strip()
+ cmdline = input(self._get_prompt()).strip()
except EOFError:
self.con.raw_write('exit\n')
cmdline = "exit"
Index: python-configshell-fb-1.1.30/setup.py
===================================================================
--- python-configshell-fb-1.1.30.orig/setup.py
+++ python-configshell-fb-1.1.30/setup.py
@@ -43,7 +43,6 @@ setup(
packages = ['configshell', 'configshell_fb'],
install_requires = [
'pyparsing >=2.0.2',
- 'six',
'urwid',
],
classifiers = [

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Apr 16 12:25:42 UTC 2024 - Markéta Machová <mmachova@suse.com>
- Add no-six.patch to get rid of unneeded six dependency
-------------------------------------------------------------------
Sun Jul 2 15:23:07 UTC 2023 - Lee Duncan <lduncan@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-configshell-fb
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,7 +16,6 @@
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%{?sle15_python_module_pythons}
Name: python-configshell-fb
Version: 1.1.30
@@ -26,15 +25,15 @@ License: Apache-2.0
Group: Development/Libraries/Python
URL: https://github.com/open-iscsi/configshell-fb
Source: %{name}-%{version}.tar.xz
#PATCH-FIX-UPSTREAM https://github.com/open-iscsi/configshell-fb/pull/74 six is unneeded
Patch: no-six.patch
BuildRequires: %{python_module pyparsing}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module six}
BuildRequires: %{pythons}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: %{_bindir}/env
Requires: python-pyparsing
Requires: python-six
Requires: python-urwid
Provides: python-configshell = %{version}-%{release}
Obsoletes: python-configshell < %{version}
@@ -66,7 +65,7 @@ rtslib, and configshell, or stick with all non-fb versions, since they are
no longer strictly compatible.
%prep
%setup -q -n %{name}-%{version}
%autosetup -p1 -n %{name}-%{version}
%build
%python_build
@@ -76,7 +75,9 @@ no longer strictly compatible.
%fdupes %{buildroot}
%files %{python_files}
%{python_sitelib}/*
%{python_sitelib}/configshell
%{python_sitelib}/configshell_fb
%{python_sitelib}/configshell_fb-%{version}*info
%doc README.md
%changelog