Accepting request 886211 from home:cgiboudeaux:branches:devel:languages:python

- Add patch from Debian to fix build with python 3.9:
  * python3.9.patch

OBS-URL: https://build.opensuse.org/request/show/886211
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-random2?expand=0&rev=7
This commit is contained in:
Dirk Mueller 2021-04-17 08:36:22 +00:00 committed by Git OBS Bridge
parent 07f7950624
commit 7cde60125e
3 changed files with 40 additions and 1 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Sat Apr 17 06:37:03 UTC 2021 - Christophe Giboudeaux <christophe@krop.fr>
- Add patch from Debian to fix build with python 3.9:
* python3.9.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Oct 14 14:40:23 UTC 2019 - Matej Cepl <mcepl@suse.com> Mon Oct 14 14:40:23 UTC 2019 - Matej Cepl <mcepl@suse.com>

View File

@ -25,6 +25,8 @@ Summary: A Session and Caching library with WSGI Middleware
License: Python-2.0 License: Python-2.0
URL: https://pypi.python.org/pypi/random2 URL: https://pypi.python.org/pypi/random2
Source: https://files.pythonhosted.org/packages/source/r/random2/random2-%{version}.zip Source: https://files.pythonhosted.org/packages/source/r/random2/random2-%{version}.zip
# PATCH-FIX-UPSTREAM -- python3.9.patch Origin: Debian
Patch0: python3.9.patch
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
@ -45,7 +47,7 @@ makes porting code to Python 3 a lot harder, if all those tests have to be
adjusted. This package fixes that. adjusted. This package fixes that.
%prep %prep
%setup -q -n random2-%{version} %autosetup -p1 -n random2-%{version}
%build %build
%python_build %python_build

31
python3.9.patch Normal file
View File

@ -0,0 +1,31 @@
Description: fix tests with python 3.9
Python docs for the function being tested now state:
"Changed in version 3.9: This method now accepts zero for k."
https://docs.python.org/3/library/random.html#random.getrandbits
Author: Juhani Numminen <juhaninumminen0@gmail.com>
Bug-Debian: https://bugs.debian.org/973085
Last-Update: 2020-11-24
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/tests.py
+++ b/src/tests.py
@@ -291,7 +291,8 @@
# Verify argument checking
self.assertRaises(TypeError, self.gen.getrandbits)
self.assertRaises(TypeError, self.gen.getrandbits, 1, 2)
- self.assertRaises(ValueError, self.gen.getrandbits, 0)
+ if sys.version_info < (3, 9):
+ self.assertRaises(ValueError, self.gen.getrandbits, 0)
self.assertRaises(ValueError, self.gen.getrandbits, -1)
self.assertRaises(TypeError, self.gen.getrandbits, 10.1)
@@ -448,7 +449,8 @@
self.assertRaises(TypeError, self.gen.getrandbits)
self.assertRaises(TypeError, self.gen.getrandbits, 'a')
self.assertRaises(TypeError, self.gen.getrandbits, 1, 2)
- self.assertRaises(ValueError, self.gen.getrandbits, 0)
+ if sys.version_info < (3, 9):
+ self.assertRaises(ValueError, self.gen.getrandbits, 0)
self.assertRaises(ValueError, self.gen.getrandbits, -1)
def test_randbelow_logic(self, _log=log, int=int):