From 7fa37959733142e9429f9188d0b7e304aaade7e4d6308b54cdcb56c81dee5a5f Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Wed, 2 Oct 2019 14:11:43 +0000 Subject: [PATCH] Accepting request 734621 from home:mcepl:branches:devel:languages:python - Add python38-compat.patch to fix compatibility with Python 3.8 gh#PythonCharmers/python-future#447 - Add python38-pow.patch not to expect exception on new available parameters for Python 3.8. gh#PythonCharmers/python-future#474 OBS-URL: https://build.opensuse.org/request/show/734621 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-future?expand=0&rev=22 --- python-future.changes | 8 +++++++ python-future.spec | 18 +++++++++------ python38-compat.patch | 53 +++++++++++++++++++++++++++++++++++++++++++ python38-pow.patch | 26 +++++++++++++++++++++ 4 files changed, 98 insertions(+), 7 deletions(-) create mode 100644 python38-compat.patch create mode 100644 python38-pow.patch diff --git a/python-future.changes b/python-future.changes index 605c3ac..1bc310b 100644 --- a/python-future.changes +++ b/python-future.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Oct 2 14:56:02 CEST 2019 - Matej Cepl + +- Add python38-compat.patch to fix compatibility with Python 3.8 + gh#PythonCharmers/python-future#447 +- Add python38-pow.patch not to expect exception on new available + parameters for Python 3.8. gh#PythonCharmers/python-future#474 + ------------------------------------------------------------------- Tue May 7 01:41:21 UTC 2019 - John Vandenberg diff --git a/python-future.spec b/python-future.spec index 065bf99..513ea67 100644 --- a/python-future.spec +++ b/python-future.spec @@ -1,7 +1,7 @@ # # spec file for package python-future # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -22,20 +22,23 @@ Version: 0.17.1 Release: 0 Summary: Single-source support for Python 3 and 2 # See https://github.com/PythonCharmers/python-future/issues/242 for PSF licensing -License: MIT and Python-2.0 -Group: Development/Languages/Python -Url: https://python-future.org +License: MIT AND Python-2.0 +URL: https://python-future.org Source0: https://files.pythonhosted.org/packages/source/f/future/future-%{version}.tar.gz Source100: python-future-rpmlintrc -BuildRequires: %{python_module setuptools} +# PATCH-FIX-UPSTREAM python38-compat.patch gh#PythonCharmers/python-future#447 mcepl@suse.com +# Python 3.8 removed urllib.request.splitattr +Patch0: python38-compat.patch +# PATCH-FIX-UPSTREAM python38-pow.patch gh#PythonCharmers/python-future#474 mcepl@suse.com +Patch1: python38-pow.patch BuildRequires: %{python_module pytest} -BuildRequires: python3-dbm +BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros +BuildRequires: python3-dbm Requires(post): update-alternatives Requires(preun): update-alternatives BuildArch: noarch - %python_subpackages %description @@ -45,6 +48,7 @@ support both Python 2 and Python 3. %prep %setup -q -n future-%{version} +%autopatch -p1 sed -i -e '/^#!\//, 1d' src/future/backports/test/pystone.py %build diff --git a/python38-compat.patch b/python38-compat.patch new file mode 100644 index 0000000..1c22c85 --- /dev/null +++ b/python38-compat.patch @@ -0,0 +1,53 @@ +From 4b1ddb49e8e7d4c812c50ac38d2c11db64ac9c1e Mon Sep 17 00:00:00 2001 +From: Chih-Hsuan Yen +Date: Fri, 28 Sep 2018 14:39:32 +0800 +Subject: [PATCH] Fix urllib.request imports for Python 3.8 compatibility + +Fixes https://github.com/PythonCharmers/python-future/issues/447 +--- + src/future/moves/urllib/request.py | 23 ++++++++++++----------- + 1 file changed, 12 insertions(+), 11 deletions(-) + +diff --git a/src/future/moves/urllib/request.py b/src/future/moves/urllib/request.py +index 60e440a..972aa4a 100644 +--- a/src/future/moves/urllib/request.py ++++ b/src/future/moves/urllib/request.py +@@ -11,19 +11,8 @@ + proxy_bypass, + quote, + request_host, +- splitattr, +- splithost, +- splitpasswd, +- splitport, +- splitquery, +- splittag, +- splittype, +- splituser, +- splitvalue, + thishost, +- to_bytes, + unquote, +- unwrap, + url2pathname, + urlcleanup, + urljoin, +@@ -32,6 +21,18 @@ + urlretrieve, + urlsplit, + urlunparse) ++ ++ from urllib.parse import (splitattr, ++ splithost, ++ splitpasswd, ++ splitport, ++ splitquery, ++ splittag, ++ splittype, ++ splituser, ++ splitvalue, ++ to_bytes, ++ unwrap) + else: + __future_module__ = True + with suspend_hooks(): diff --git a/python38-pow.patch b/python38-pow.patch new file mode 100644 index 0000000..af968f3 --- /dev/null +++ b/python38-pow.patch @@ -0,0 +1,26 @@ +--- + tests/test_past/test_builtins.py | 2 -- + 1 file changed, 2 deletions(-) + +--- a/tests/test_past/test_builtins.py ++++ b/tests/test_past/test_builtins.py +@@ -1117,9 +1117,7 @@ class BuiltinTest(unittest.TestCase): + else: + self.assertAlmostEqual(pow(x, y, z), 24.0) + +- self.assertRaises(TypeError, pow, -1, -2, 3) + self.assertRaises(ValueError, pow, 1, 2, 0) +- self.assertRaises(TypeError, pow, -1, -2, 3) + self.assertRaises(ValueError, pow, 1, 2, 0) + # Will return complex in 3.0: + self.assertRaises(ValueError, pow, -342.43, 0.234) +--- a/tests/test_future/test_builtins.py ++++ b/tests/test_future/test_builtins.py +@@ -1286,7 +1286,6 @@ class BuiltinTest(unittest.TestCase): + 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) + self.assertRaises(ValueError, pow, 1, 2, 0) + + self.assertRaises(TypeError, pow)