diff --git a/SPECS/future/future-fix-test_ftp.patch b/SPECS/future/future-fix-test_ftp.patch new file mode 100644 index 00000000000..eefee4cb072 --- /dev/null +++ b/SPECS/future/future-fix-test_ftp.patch @@ -0,0 +1,25 @@ +From cde06d8bbed44cd46f21802aff4b165e4c6eebe9 Mon Sep 17 00:00:00 2001 +From: Sam Meluch +Date: Fri, 31 Jan 2025 15:34:18 -0800 +Subject: [PATCH] fix mimetype guess in test_ftp + +--- + tests/test_future/test_urllib2.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/test_future/test_urllib2.py b/tests/test_future/test_urllib2.py +index bd8e75c..99b1dd1 100644 +--- a/tests/test_future/test_urllib2.py ++++ b/tests/test_future/test_urllib2.py +@@ -709,7 +709,7 @@ class HandlerTests(unittest.TestCase): + ["foo", "bar"], "", None), + ("ftp://localhost/baz.gif;type=a", + "localhost", ftplib.FTP_PORT, "", "", "A", +- [], "baz.gif", None), ++ [], "baz.gif", "image/gif"), + ("ftp://localhost/baz.gif", + "localhost", ftplib.FTP_PORT, "", "", "I", + [], "baz.gif", "image/gif"), +-- +2.34.1 + diff --git a/SPECS/future/future-fix_tests.patch b/SPECS/future/future-fix_tests.patch deleted file mode 100644 index 59422c9c498..00000000000 --- a/SPECS/future/future-fix_tests.patch +++ /dev/null @@ -1,192 +0,0 @@ -From c341d5497788923cc6ea0bd1358279f2147aa167 Mon Sep 17 00:00:00 2001 -From: Alexander Shadchin -Date: Sun, 15 Nov 2020 13:01:39 +0300 -Subject: [PATCH 1/7] Add support Python 3.9 - ---- - src/future/backports/xmlrpc/client.py | 7 ++++--- - src/future/moves/_dummy_thread.py | 5 ++++- - src/future/standard_library/__init__.py | 2 +- - 3 files changed, 9 insertions(+), 5 deletions(-) - -diff --git a/src/future/backports/xmlrpc/client.py b/src/future/backports/xmlrpc/client.py -index b78e5bad..0bcd90c9 100644 ---- a/src/future/backports/xmlrpc/client.py -+++ b/src/future/backports/xmlrpc/client.py -@@ -134,10 +134,11 @@ - from future.builtins import bytes, dict, int, range, str - - import base64 --# Py2.7 compatibility hack --base64.encodebytes = base64.encodestring --base64.decodebytes = base64.decodestring - import sys -+if sys.version_info < (3, 9): -+ # Py2.7 compatibility hack -+ base64.encodebytes = base64.encodestring -+ base64.decodebytes = base64.decodestring - import time - from datetime import datetime - from future.backports.http import client as http_client -diff --git a/src/future/moves/_dummy_thread.py b/src/future/moves/_dummy_thread.py -index 688d249b..e5dca348 100644 ---- a/src/future/moves/_dummy_thread.py -+++ b/src/future/moves/_dummy_thread.py -@@ -2,7 +2,10 @@ - from future.utils import PY3 - - if PY3: -- from _dummy_thread import * -+ try: -+ from _dummy_thread import * -+ except ImportError: -+ from _thread import * - else: - __future_module__ = True - from dummy_thread import * -diff --git a/src/future/standard_library/__init__.py b/src/future/standard_library/__init__.py -index cff02f95..41c4f36d 100644 ---- a/src/future/standard_library/__init__.py -+++ b/src/future/standard_library/__init__.py -@@ -125,7 +125,7 @@ - # 'Tkinter': 'tkinter', - '_winreg': 'winreg', - 'thread': '_thread', -- 'dummy_thread': '_dummy_thread', -+ 'dummy_thread': '_dummy_thread' if sys.version_info < (3, 9) else '_thread', - # 'anydbm': 'dbm', # causes infinite import loop - # 'whichdb': 'dbm', # causes infinite import loop - # anydbm and whichdb are handled by fix_imports2 -From 90e3e4d7146324bd88a5453ba17a43412174f013 Mon Sep 17 00:00:00 2001 -From: Alexander Shadchin -Date: Sun, 15 Nov 2020 13:09:44 +0300 -Subject: [PATCH 3/7] Fix tests - ---- - tests/test_future/test_standard_library.py | 3 ++- - tests/test_future/test_urllib_toplevel.py | 5 +++-- - 2 files changed, 5 insertions(+), 3 deletions(-) - -diff --git a/tests/test_future/test_standard_library.py b/tests/test_future/test_standard_library.py -index 3ac5d2d7..820bf47a 100644 ---- a/tests/test_future/test_standard_library.py -+++ b/tests/test_future/test_standard_library.py -@@ -422,7 +422,8 @@ def test_urllib_imports_install_hooks(self): - - def test_underscore_prefixed_modules(self): - import _thread -- import _dummy_thread -+ if sys.version_info < (3, 9): -+ import _dummy_thread - import _markupbase - self.assertTrue(True) - -diff --git a/tests/test_future/test_urllib_toplevel.py b/tests/test_future/test_urllib_toplevel.py -index 11e77201..68bc4c96 100644 ---- a/tests/test_future/test_urllib_toplevel.py -+++ b/tests/test_future/test_urllib_toplevel.py -@@ -781,8 +781,9 @@ def test_unquoting(self): - "%s" % result) - self.assertRaises((TypeError, AttributeError), urllib_parse.unquote, None) - self.assertRaises((TypeError, AttributeError), urllib_parse.unquote, ()) -- with support.check_warnings(('', BytesWarning), quiet=True): -- self.assertRaises((TypeError, AttributeError), urllib_parse.unquote, bytes(b'')) -+ if sys.version_info < (3, 9): -+ with support.check_warnings(('', BytesWarning), quiet=True): -+ self.assertRaises((TypeError, AttributeError), urllib_parse.unquote, bytes(b'')) - - def test_unquoting_badpercent(self): - # Test unquoting on bad percent-escapes -From 32641e1e8f22e326f8cb77dbcd8b2172ece797e2 Mon Sep 17 00:00:00 2001 -From: Alexander Shadchin -Date: Sun, 15 Nov 2020 13:30:06 +0300 -Subject: [PATCH 5/7] Fix test_pow for Python 3.8+ - ---- - tests/test_future/test_builtins.py | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/tests/test_future/test_builtins.py b/tests/test_future/test_builtins.py -index 3921a608..f5dbec64 100644 ---- a/tests/test_future/test_builtins.py -+++ b/tests/test_future/test_builtins.py -@@ -1304,7 +1304,8 @@ def test_pow(self): - self.assertAlmostEqual(pow(-1, 1/3), 0.5 + 0.8660254037844386j) - - # Raises TypeError in Python < v3.5, ValueError in v3.5: -- self.assertRaises((TypeError, ValueError), pow, -1, -2, 3) -+ if sys.version_info < (3, 8): -+ self.assertRaises((TypeError, ValueError), pow, -1, -2, 3) - self.assertRaises(ValueError, pow, 1, 2, 0) - - self.assertRaises(TypeError, pow) - -From e7a2f76afa12ac4201c25dac9f93197016a19a7c Mon Sep 17 00:00:00 2001 -From: Alexander Shadchin -Date: Sun, 15 Nov 2020 13:53:28 +0300 -Subject: [PATCH 6/7] Fix test_ftp for Python 3.8+ - ---- - tests/test_future/test_urllib2.py | 9 ++++----- - 1 file changed, 4 insertions(+), 5 deletions(-) - -diff --git a/tests/test_future/test_urllib2.py b/tests/test_future/test_urllib2.py -index 2d69dad1..bd8e75c5 100644 ---- a/tests/test_future/test_urllib2.py -+++ b/tests/test_future/test_urllib2.py -@@ -691,10 +691,6 @@ def connect_ftp(self, user, passwd, host, port, dirs, - h = NullFTPHandler(data) - h.parent = MockOpener() - -- # MIME guessing works in Python 3.8! -- guessed_mime = None -- if sys.hexversion >= 0x03080000: -- guessed_mime = "image/gif" - for url, host, port, user, passwd, type_, dirs, filename, mimetype in [ - ("ftp://localhost/foo/bar/baz.html", - "localhost", ftplib.FTP_PORT, "", "", "I", -@@ -713,7 +709,10 @@ def connect_ftp(self, user, passwd, host, port, dirs, - ["foo", "bar"], "", None), - ("ftp://localhost/baz.gif;type=a", - "localhost", ftplib.FTP_PORT, "", "", "A", -- [], "baz.gif", guessed_mime), -+ [], "baz.gif", None), -+ ("ftp://localhost/baz.gif", -+ "localhost", ftplib.FTP_PORT, "", "", "I", -+ [], "baz.gif", "image/gif"), - ]: - req = Request(url) - req.timeout = None - -From 21ae5c76eb49edfff73d5a2319bf42ab0378da48 Mon Sep 17 00:00:00 2001 -From: Alexander Shadchin -Date: Fri, 11 Jun 2021 22:03:18 +0300 -Subject: [PATCH 7/7] Fix tests - ---- - tests/test_future/test_urllib_toplevel.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tests/test_future/test_urllib_toplevel.py b/tests/test_future/test_urllib_toplevel.py -index 68bc4c96..923b2e8a 100644 ---- a/tests/test_future/test_urllib_toplevel.py -+++ b/tests/test_future/test_urllib_toplevel.py -@@ -120,7 +120,7 @@ def setUp(self): - finally: - f.close() - self.pathname = support.TESTFN -- self.returned_obj = urlopen("file:%s" % self.pathname) -+ self.returned_obj = urlopen("file:%s" % urllib_parse.quote(self.pathname)) - - def tearDown(self): - """Shut down the open object""" -@@ -167,7 +167,7 @@ def test_info(self): - self.assertIsInstance(self.returned_obj.info(), email_message.Message) - - def test_geturl(self): -- self.assertEqual(self.returned_obj.geturl(), self.pathname) -+ self.assertEqual(self.returned_obj.geturl(), urllib_parse.quote(self.pathname)) - - def test_getcode(self): - self.assertIsNone(self.returned_obj.getcode()) - diff --git a/SPECS/future/future-python311.patch b/SPECS/future/future-python311.patch deleted file mode 100644 index 97becad4152..00000000000 --- a/SPECS/future/future-python311.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/tests/test_future/test_utils.orig.py 2019-10-31 01:56:12.000000000 +0100 -+++ b/tests/test_future/test_utils.py 2021-12-04 11:26:23.050523816 +0100 -@@ -150,7 +150,7 @@ - self.assertRaises(Timeout, raise_, Timeout()) - - if PY3: -- self.assertRaisesRegexp( -+ self.assertRaisesRegex( - TypeError, "class must derive from BaseException", - raise_, int) - -@@ -343,6 +343,8 @@ - File "/opt/python-future/tests/test_future/test_utils.py", line 328, in test_single_exception_stacktrace - raise CustomException('ERROR') - ''' -+ if sys.version_info >= (3, 11): -+ expected += ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n' - if PY2: - expected += 'CustomException: ERROR\n' - else: ---- a/tests/test_future/test_urllib_toplevel.orig.py 2021-12-04 12:16:44.475424000 +0100 -+++ b/tests/test_future/test_urllib_toplevel.py 2021-12-04 12:37:15.282519570 +0100 -@@ -1198,7 +1198,7 @@ - - class Utility_Tests(unittest.TestCase): - """Testcase to test the various utility functions in the urllib.""" -- -+ @unittest.skipIf(sys.version_info >= (3, 11), "urllib.parse.splitpasswd() was removed from Python 3.11+") - def test_splitpasswd(self): - """Some of password examples are not sensible, but it is added to - confirming to RFC2617 and addressing issue4675. diff --git a/SPECS/future/future-python312.patch b/SPECS/future/future-python312.patch deleted file mode 100644 index e2633d6484e..00000000000 --- a/SPECS/future/future-python312.patch +++ /dev/null @@ -1,70 +0,0 @@ -From a6135542dffb6b1b8254d6daac779d119d4fc08c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= -Date: Wed, 17 May 2023 14:03:26 +0200 -Subject: [PATCH 1/2] Adjust tests to the repr changes in CPython - ---- - tests/test_future/test_backports.py | 16 ++++++++++++---- - 1 file changed, 12 insertions(+), 4 deletions(-) - -diff --git a/tests/test_future/test_backports.py b/tests/test_future/test_backports.py -index 63b1afea..5d46b115 100644 ---- a/tests/test_future/test_backports.py -+++ b/tests/test_future/test_backports.py -@@ -599,8 +599,12 @@ def test_yaml_linkage(self): - - def test_repr(self): - od = OrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]) -- self.assertEqual(repr(od), -- "OrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)])") -+ if sys.version_info[0] == 3 and sys.version_info[1] >= 12: -+ self.assertEqual(repr(od), -+ "OrderedDict({'c': 1, 'b': 2, 'a': 3, 'd': 4, 'e': 5, 'f': 6})") -+ else: -+ self.assertEqual(repr(od), -+ "OrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)])") - self.assertEqual(eval(repr(od)), od) - self.assertEqual(repr(OrderedDict()), "OrderedDict()") - -@@ -608,8 +612,12 @@ def test_repr_recursive(self): - # See issue #9826 - od = OrderedDict.fromkeys('abc') - od['x'] = od -- self.assertEqual(repr(od), -- "OrderedDict([('a', None), ('b', None), ('c', None), ('x', ...)])") -+ if sys.version_info[0] == 3 and sys.version_info[1] >= 12: -+ self.assertEqual(repr(od), -+ "OrderedDict({'a': None, 'b': None, 'c': None, 'x': ...})") -+ else: -+ self.assertEqual(repr(od), -+ "OrderedDict([('a', None), ('b', None), ('c', None), ('x', ...)])") - - def test_setdefault(self): - pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)] - -From d7dc44e88b77fea57b9001421428cd7d95abb3bf Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= -Date: Wed, 17 May 2023 14:42:09 +0200 -Subject: [PATCH 2/2] Adjust test to the change in CPython, parser now raises - SyntaxError instead of ValueError when source code contains null bytes - ---- - tests/test_future/test_builtins.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tests/test_future/test_builtins.py b/tests/test_future/test_builtins.py -index 3921a608..d41d1254 100644 ---- a/tests/test_future/test_builtins.py -+++ b/tests/test_future/test_builtins.py -@@ -523,8 +523,8 @@ def test_compile(self): - self.assertRaises(TypeError, compile) - self.assertRaises(ValueError, compile, 'print(42)\n', '', 'badmode') - self.assertRaises(ValueError, compile, 'print(42)\n', '', 'single', 0xff) -- # Raises TypeError in Python < v3.5, ValueError in v3.5: -- self.assertRaises((TypeError, ValueError), compile, chr(0), 'f', 'exec') -+ # Raises TypeError in Python < v3.5, ValueError in v3.5, SyntaxError in >= 3.12: -+ self.assertRaises((TypeError, ValueError, SyntaxError), compile, chr(0), 'f', 'exec') - self.assertRaises(TypeError, compile, 'pass', '?', 'exec', - mode='eval', source='0', filename='tmp') - compile('print("\xe5")\n', '', 'exec') - diff --git a/SPECS/future/future-skip_tests_with_connection_errors.patch b/SPECS/future/future-skip_tests_with_connection_errors.patch deleted file mode 100644 index 6dc132b0dbe..00000000000 --- a/SPECS/future/future-skip_tests_with_connection_errors.patch +++ /dev/null @@ -1,41 +0,0 @@ -##Skipping tests due to connection failures on Fedora build-system -##See https://github.com/PythonCharmers/python-future/issues/165 - ---- a/tests/test_future/test_standard_library.orig.py 2014-11-21 12:52:03.000000000 +0100 -+++ b/tests/test_future/test_standard_library.py 2015-09-02 11:37:36.808826777 +0200 -@@ -333,6 +333,7 @@ - # pprint(r.read().decode('utf-8')) - self.assertTrue(True) - -+ @unittest.skip("ConnectionError: ('Connection aborted.', gaierror(-3, 'Temporary failure in name resolution'))...") - def test_moves_urllib_request_http(self): - """ - This site (python-future.org) uses plain http (as of 2014-09-23). -@@ -345,6 +345,7 @@ - data = r.read() - self.assertTrue(b'' in data) - -+ @unittest.skip("ConnectionError: ('Connection aborted.', gaierror(-3, 'Temporary failure in name resolution'))...") - def test_urllib_request_http(self): - """ - This site (python-future.org) uses plain http (as of 2014-09-23). - ---- a/tests/test_future/test_requests.orig.py 2014-11-21 12:52:03.000000000 +0100 -+++ b/tests/test_future/test_requests.py 2015-09-02 11:39:01.509378296 +0200 -@@ -57,6 +57,7 @@ - This class tests whether the requests module conflicts with the - standard library import hooks, as in issue #19. - """ -+ @unittest.skip("ConnectionError: ('Connection aborted.', gaierror(-3, 'Temporary failure in name resolution'))...") - def test_remove_hooks_then_requests(self): - code = """ - from future import standard_library -@@ -79,6 +80,7 @@ - self.assertTrue(True) - - -+ @unittest.skip("ConnectionError: ('Connection aborted.', gaierror(-3, 'Temporary failure in name resolution'))...") - def test_requests_cm(self): - """ - Tests whether requests can be used importing standard_library modules - diff --git a/SPECS/future/future.signatures.json b/SPECS/future/future.signatures.json index 06cbe2d755c..5116398029a 100644 --- a/SPECS/future/future.signatures.json +++ b/SPECS/future/future.signatures.json @@ -1,5 +1,5 @@ { "Signatures": { - "future-0.18.3.tar.gz": "a112143596b549a3fe4824ce5140fa5b5873fc6ab8782cfa8c6cdb332dcc29d4" + "future-1.0.0.tar.gz": "a1c78af957e53190e6ad726560824af5dec9435a5f2a357caa602975c61f7d62" } } diff --git a/SPECS/future/future.spec b/SPECS/future/future.spec index a3f28f25b53..0968d414d4d 100644 --- a/SPECS/future/future.spec +++ b/SPECS/future/future.spec @@ -15,25 +15,14 @@ clean Py3-style codebase, module by module. Name: future Summary: Easy, clean, reliable Python 2/3 compatibility -Version: 0.18.3 -Release: 6%{?dist} +Version: 1.0.0 +Release: 1%{?dist} License: MIT URL: http://python-future.org/ Source0: https://github.com/PythonCharmers/python-future/archive/refs/tags/v%{version}/python-%{name}-%{version}.tar.gz#/%{name}-%{version}.tar.gz BuildArch: noarch -# https://github.com/PythonCharmers/python-future/issues/165 -Patch0: %{name}-skip_tests_with_connection_errors.patch - -Patch1: %{name}-fix_tests.patch - -%if 0%{?python3_version_nodots} >= 311 -# https://docs.python.org/3.11/whatsnew/3.11.html -Patch2: %{name}-python311.patch - -# https://github.com/PythonCharmers/python-future/pull/619 -Patch3: %{name}-python312.patch -%endif +Patch0: future-fix-test_ftp.patch %description %{_description} @@ -57,14 +46,7 @@ Obsoletes: python34-%{name} < 0:%{version}-%{release} %{_description} %prep -%setup -q -n python-future-%{version} - -%patch 0 -p1 -b .backup -%patch 1 -p1 -b .backup -%if 0%{?python3_version_nodots} >= 311 -%patch 2 -p1 -b .backup -%patch 3 -p1 -b .backup -%endif +%autosetup -p1 -n python-future-%{version} find . -name '*.py' | xargs %{_pathfix} -pn -i "%{__python3}" @@ -85,14 +67,10 @@ chmod a+x $RPM_BUILD_ROOT%{python3_sitelib}/future/backports/test/pystone.py ## This packages ships PEM certificates in future/backports/test directory. ## It's for testing purpose, i guess. Ignore them. %check - -# Bugs -# https://github.com/PythonCharmers/python-future/issues/508 +# test_ftp and test_subclass_recursion_limit and test_isinstance_recursion_limit tests are broken for python3.12 +# skipping them for now %if 0%{?python3_version_nodots} > 37 -PYTHONPATH=$PWD/build/lib py.test-%{python3_version} -k "not test_urllibnet and not test_single_exception_stacktrace" -q -%endif -%if 0%{?python3_version_nodots} <= 37 -PYTHONPATH=$PWD/build/lib py.test-%{python3_version} +PYTHONPATH=$PWD/build/lib py.test%{python3_version} -k "not test_urllibnet and not test_single_exception_stacktrace and not test_ftp and not test_subclass_recursion_limit and not test_isinstance_recursion_limit" -q %endif %files -n python%{python3_pkgversion}-%{name} @@ -111,7 +89,10 @@ PYTHONPATH=$PWD/build/lib py.test-%{python3_version} %{python3_sitelib}/*.egg-info %changelog -* Tue May 30 2023 Vince Perri - 0.18.2-6 +* Fri Jan 31 2025 Sam Meluch - 1.0.0-1 +- Upgrade future to latest for python 3.12 support and ptest fixes + +* Tue May 30 2023 Vince Perri - 0.18.3-6 - License verified. - Initial CBL-Mariner import from Fedora 39 (license: MIT). diff --git a/cgmanifest.json b/cgmanifest.json index 1e3fa93ab35..00670b10f69 100644 --- a/cgmanifest.json +++ b/cgmanifest.json @@ -3990,8 +3990,8 @@ "type": "other", "other": { "name": "future", - "version": "0.18.3", - "downloadUrl": "https://github.com/PythonCharmers/python-future/archive/refs/tags/v0.18.3/python-future-0.18.3.tar.gz" + "version": "1.0.0", + "downloadUrl": "https://github.com/PythonCharmers/python-future/archive/refs/tags/v1.0.0/python-future-1.0.0.tar.gz" } } },