From d3cc8a3fb63727cc647e8da0ef7711b44302b0fe43381c85b912518fdb8cfec0 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Mon, 10 Jun 2024 21:14:26 +0000 Subject: [PATCH] Accepting request 1179223 from home:mcalabkova:branches:devel:languages:python - Add remove-six.patch to get rid of six OBS-URL: https://build.opensuse.org/request/show/1179223 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Routes?expand=0&rev=35 --- python-Routes.changes | 5 + python-Routes.spec | 9 +- remove-six.patch | 371 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 380 insertions(+), 5 deletions(-) create mode 100644 remove-six.patch diff --git a/python-Routes.changes b/python-Routes.changes index 9b7f1f2..ddd8816 100644 --- a/python-Routes.changes +++ b/python-Routes.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Jun 7 12:54:57 UTC 2024 - Markéta Machová + +- Add remove-six.patch to get rid of six + ------------------------------------------------------------------- Thu Aug 18 15:15:10 UTC 2022 - Ben Greiner diff --git a/python-Routes.spec b/python-Routes.spec index 8d97720..6dcf857 100644 --- a/python-Routes.spec +++ b/python-Routes.spec @@ -1,7 +1,7 @@ # # spec file for package python-Routes # -# Copyright (c) 2022 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-%{**}} Name: python-Routes Version: 2.5.1 Release: 0 @@ -24,17 +23,17 @@ Summary: Routing Recognition and Generation Tools License: BSD-3-Clause URL: https://routes.readthedocs.io/ Source: https://files.pythonhosted.org/packages/source/R/Routes/Routes-%{version}.tar.gz +# PATCH-FIX-UPSTREAM https://github.com/bbangert/routes/pull/113 remove python2 support +Patch: remove-six.patch # for testing BuildRequires: %{python_module WebOb} BuildRequires: %{python_module WebTest} BuildRequires: %{python_module pytest} BuildRequires: %{python_module repoze.lru} BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module six} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-repoze.lru >= 0.3 -Requires: python-six Provides: python-routes = %{version}-%{release} Obsoletes: python-routes < %{version}-%{release} BuildArch: noarch @@ -44,7 +43,7 @@ BuildArch: noarch A Routing package for Python that matches URL's to dicts and vice versa. %prep -%setup -q -n Routes-%{version} +%autosetup -p1 -n Routes-%{version} %build %python_build diff --git a/remove-six.patch b/remove-six.patch new file mode 100644 index 0000000..62a77d8 --- /dev/null +++ b/remove-six.patch @@ -0,0 +1,371 @@ +From 44d96530bb52642a52e2a14921ebda6af0f7afc5 Mon Sep 17 00:00:00 2001 +From: Alexandre Detiste +Date: Fri, 20 Oct 2023 15:39:04 +0200 +Subject: [PATCH] remove python2 support + +--- + routes/mapper.py | 27 +++++------- + routes/route.py | 12 +++-- + routes/util.py | 44 +++++++++---------- + setup.py | 13 ++---- + tests/test_functional/test_generation.py | 3 +- + tests/test_functional/test_nonminimization.py | 2 +- + tests/test_functional/test_recognition.py | 3 +- + 7 files changed, 45 insertions(+), 59 deletions(-) + +diff --git a/routes/mapper.py b/routes/mapper.py +index 72981cb..9de7e60 100644 +--- a/routes/mapper.py ++++ b/routes/mapper.py +@@ -5,7 +5,6 @@ + import threading + + from repoze.lru import LRUCache +-import six + + from routes import request_config + from routes.util import ( +@@ -168,7 +167,7 @@ def connect(self, routename, path=None, **kwargs): + newkargs = {} + _routename = routename + _path = path +- for key, value in six.iteritems(self.kwargs): ++ for key, value in self.kwargs.items(): + if key == 'path_prefix': + if path is not None: + # if there's a name_prefix, add it to the route name +@@ -595,7 +594,7 @@ def _create_gens(self): + if 'controller' in route.hardcoded: + clist = [route.defaults['controller']] + if 'action' in route.hardcoded: +- alist = [six.text_type(route.defaults['action'])] ++ alist = [str(route.defaults['action'])] + for controller in clist: + for action in alist: + actiondict = gendict.setdefault(controller, {}) +@@ -625,7 +624,7 @@ def _create_regs(self, clist=None): + else: + clist = self.controller_scan + +- for key, val in six.iteritems(self.maxkeys): ++ for key, val in self.maxkeys.items(): + for route in val: + route.makeregexp(clist) + +@@ -801,15 +800,11 @@ def generate(self, *args, **kargs): + # If the URL didn't depend on the SCRIPT_NAME, we'll cache it + # keyed by just by kargs; otherwise we need to cache it with + # both SCRIPT_NAME and kargs: +- cache_key = six.text_type(args).encode('utf8') + \ +- six.text_type(kargs).encode('utf8') ++ cache_key = str(args).encode('utf8') + str(kargs).encode('utf8') + + if self.urlcache is not None: +- if six.PY3: +- cache_key_script_name = b':'.join((script_name.encode('utf-8'), +- cache_key)) +- else: +- cache_key_script_name = '%s:%s' % (script_name, cache_key) ++ cache_key_script_name = b':'.join((script_name.encode('utf-8'), ++ cache_key)) + + # Check the url cache to see if it exists, use it if it does + val = self.urlcache.get(cache_key_script_name, self) +@@ -829,7 +824,7 @@ def generate(self, *args, **kargs): + + keys = frozenset(kargs.keys()) + cacheset = False +- cachekey = six.text_type(keys) ++ cachekey = str(keys) + cachelist = sortcache.get(cachekey) + if args: + keylist = args +@@ -1110,7 +1105,7 @@ def resource(self, member_name, collection_name, **kwargs): + def swap(dct, newdct): + """Swap the keys and values in the dict, and uppercase the values + from the dict during the swap.""" +- for key, val in six.iteritems(dct): ++ for key, val in dct.items(): + newdct.setdefault(val.upper(), []).append(key) + return newdct + collection_methods = swap(collection, {}) +@@ -1153,7 +1148,7 @@ def requirements_for(meth): + return opts + + # Add the routes for handling collection methods +- for method, lst in six.iteritems(collection_methods): ++ for method, lst in collection_methods.items(): + primary = (method != 'GET' and lst.pop(0)) or None + route_options = requirements_for(method) + for action in lst: +@@ -1177,7 +1172,7 @@ def requirements_for(meth): + action='index', conditions={'method': ['GET']}, **options) + + # Add the routes that deal with new resource methods +- for method, lst in six.iteritems(new_methods): ++ for method, lst in new_methods.items(): + route_options = requirements_for(method) + for action in lst: + name = "new_" + member_name +@@ -1196,7 +1191,7 @@ def requirements_for(meth): + requirements_regexp = '[^\\/]+(?=0.3" + ], + extras_require=extras_require, +diff --git a/tests/test_functional/test_generation.py b/tests/test_functional/test_generation.py +index b461b5f..cb6732d 100644 +--- a/tests/test_functional/test_generation.py ++++ b/tests/test_functional/test_generation.py +@@ -1,6 +1,5 @@ + """test_generation""" +-import sys, time, unittest +-from six.moves import urllib ++import sys, time, unittest, urllib + + from nose.tools import eq_, assert_raises + from routes import * +diff --git a/tests/test_functional/test_nonminimization.py b/tests/test_functional/test_nonminimization.py +index 1b152c4..7f2d0e1 100644 +--- a/tests/test_functional/test_nonminimization.py ++++ b/tests/test_functional/test_nonminimization.py +@@ -1,5 +1,5 @@ + """Test non-minimization recognition""" +-from six.moves import urllib ++import urllib + + from nose.tools import eq_ + +diff --git a/tests/test_functional/test_recognition.py b/tests/test_functional/test_recognition.py +index 03fe6a7..6295979 100644 +--- a/tests/test_functional/test_recognition.py ++++ b/tests/test_functional/test_recognition.py +@@ -3,7 +3,8 @@ + import sys + import time + import unittest +-from six.moves import urllib ++import urllib ++ + from nose.tools import eq_, assert_raises + from routes import * + from routes.util import RoutesException