From 407e53ae2c4306fdc89a604c48594c78223e3c12 Mon Sep 17 00:00:00 2001 From: Tomas Hrnciar Date: Tue, 13 Apr 2021 12:11:31 +0200 Subject: [PATCH] Python 3.10 workaround --- py310.patch | 37 +++++++++++++++++++++++++++++++++++++ python-six.spec | 7 ++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/py310.patch b/py310.patch index ae8987e..b7a2d09 100644 --- a/py310.patch +++ b/py310.patch @@ -25,3 +25,40 @@ index 83f69783..d162d09c 100644 _importer = _SixMetaPathImporter(__name__) +From 6483c19cb7f6029924bd1ad970dbcf04d3f4189d Mon Sep 17 00:00:00 2001 +From: Brett Cannon +Date: Fri, 26 Mar 2021 16:34:05 -0700 +Subject: [PATCH] Implement find_spec() for _SixMetaPathImporter + +--- + six.py | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/six.py b/six.py +index d162d09c..5e7f0ce4 100644 +--- a/six.py ++++ b/six.py +@@ -71,6 +71,11 @@ def __len__(self): + MAXSIZE = int((1 << 63) - 1) + del X + ++if PY34: ++ from importlib.util import spec_from_loader ++else: ++ spec_from_loader = None ++ + + def _add_doc(func, doc): + """Add documentation to a function.""" +@@ -186,6 +191,11 @@ def find_module(self, fullname, path=None): + return self + return None + ++ def find_spec(self, fullname, path, target=None): ++ if fullname in self.known_modules: ++ return spec_from_loader(fullname, self) ++ return None ++ + def __get_module(self, fullname): + try: + return self.known_modules[fullname] diff --git a/python-six.spec b/python-six.spec index e508234..6df00ea 100644 --- a/python-six.spec +++ b/python-six.spec @@ -12,7 +12,12 @@ License: MIT URL: https://pypi.python.org/pypi/six Source0: %{pypi_source six} -# Backported from upstream PR: https://github.com/benjaminp/six/pull/343 +# This patch is combination of two commits (PR's 343 & 352) needed +# to make python-six work with Python 3.10. +# Both of them were already merged into main branch so this can be +# removed once new version is released in upstream. +# https://github.com/benjaminp/six/pull/343 +# https://github.com/benjaminp/six/pull/352 Patch0: py310.patch BuildArch: noarch