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
This commit is contained in:
Matej Cepl 2019-10-02 14:11:43 +00:00 committed by Git OBS Bridge
parent 373dc955e0
commit 7fa3795973
4 changed files with 98 additions and 7 deletions

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Oct 2 14:56:02 CEST 2019 - Matej Cepl <mcepl@suse.com>
- 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 <jayvdb@gmail.com>

View File

@ -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

53
python38-compat.patch Normal file
View File

@ -0,0 +1,53 @@
From 4b1ddb49e8e7d4c812c50ac38d2c11db64ac9c1e Mon Sep 17 00:00:00 2001
From: Chih-Hsuan Yen <yan12125@gmail.com>
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():

26
python38-pow.patch Normal file
View File

@ -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)