From b910d47f9f27072053f8f6d7caf2bb4f342ec7d706dd6ff1dc2d376178c89407 Mon Sep 17 00:00:00 2001 From: Nico Krapp Date: Wed, 7 May 2025 08:03:46 +0000 Subject: [PATCH] - Convert to pip-based build OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-PyBrowserID?expand=0&rev=13 --- .gitattributes | 23 +++ .gitignore | 1 + ...f-the-deprecated-assertEquals-functi.patch | 132 ++++++++++++++++++ PyBrowserID-0.14.0.tar.gz | 3 + python-PyBrowserID-unittest-mock.patch | 34 +++++ python-PyBrowserID.changes | 46 ++++++ python-PyBrowserID.spec | 68 +++++++++ 7 files changed, 307 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 0001-Remove-the-use-of-the-deprecated-assertEquals-functi.patch create mode 100644 PyBrowserID-0.14.0.tar.gz create mode 100644 python-PyBrowserID-unittest-mock.patch create mode 100644 python-PyBrowserID.changes create mode 100644 python-PyBrowserID.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/0001-Remove-the-use-of-the-deprecated-assertEquals-functi.patch b/0001-Remove-the-use-of-the-deprecated-assertEquals-functi.patch new file mode 100644 index 0000000..4a82416 --- /dev/null +++ b/0001-Remove-the-use-of-the-deprecated-assertEquals-functi.patch @@ -0,0 +1,132 @@ +From 0f3eeadac8ae0cf698bbcec2ce11198e7a7ab13a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jaime=20Marqui=CC=81nez=20Ferra=CC=81ndiz?= + +Date: Mon, 18 Mar 2024 08:12:11 +0100 +Subject: [PATCH] Remove the use of the deprecated assertEquals function + +It is no longer available on python 3.12. +--- + browserid/tests/test_m2_monkeypatch.py | 6 +++--- + browserid/tests/test_supportdoc.py | 2 +- + browserid/tests/test_utils.py | 10 +++++----- + browserid/tests/test_verifiers.py | 12 ++++++------ + 4 files changed, 15 insertions(+), 15 deletions(-) + +diff --git a/browserid/tests/test_m2_monkeypatch.py b/browserid/tests/test_m2_monkeypatch.py +index 0deb783..209fb53 100644 +--- a/browserid/tests/test_m2_monkeypatch.py ++++ b/browserid/tests/test_m2_monkeypatch.py +@@ -62,9 +62,9 @@ class TestM2MonkeyPatch(unittest.TestCase): + d_orig.pub, d_orig.priv) + # Check that the attributes are copied across effectively. + for nm in ("p", "q", "g", "pub"): +- self.assertEquals(getattr(d_orig, nm), getattr(d_pub, nm)) +- self.assertEquals(getattr(d_orig, nm), getattr(d_priv, nm)) +- self.assertEquals(d_orig.priv, d_priv.priv) ++ self.assertEqual(getattr(d_orig, nm), getattr(d_pub, nm)) ++ self.assertEqual(getattr(d_orig, nm), getattr(d_priv, nm)) ++ self.assertEqual(d_orig.priv, d_priv.priv) + # Check that they can all validate signatures from original key. + r, s = d_orig.sign("helloworld") + self.assertTrue(d_orig.verify("helloworld", r, s)) +diff --git a/browserid/tests/test_supportdoc.py b/browserid/tests/test_supportdoc.py +index 73a619a..138097f 100644 +--- a/browserid/tests/test_supportdoc.py ++++ b/browserid/tests/test_supportdoc.py +@@ -92,7 +92,7 @@ class TestFetchPublicKey(unittest.TestCase): + + def test_successful_fetch(self): + key = self._fetch('test.com', response_text=BROWSERID_PK) +- self.assertEquals(key, BROWSERID_PK_PY['public-key']) ++ self.assertEqual(key, BROWSERID_PK_PY['public-key']) + + + class TestTrustedIssuers(unittest.TestCase): +diff --git a/browserid/tests/test_utils.py b/browserid/tests/test_utils.py +index 0723237..cb57178 100644 +--- a/browserid/tests/test_utils.py ++++ b/browserid/tests/test_utils.py +@@ -11,14 +11,14 @@ from browserid.tests.support import unittest + class TestUtils(unittest.TestCase): + + def test_encode_decode_bytes(self): +- self.assertEquals(b"HELLO", decode_bytes(encode_bytes(b"HELLO"))) +- self.assertEquals(b"HELLO", decode_bytes(encode_bytes(u("HELLO")))) ++ self.assertEqual(b"HELLO", decode_bytes(encode_bytes(b"HELLO"))) ++ self.assertEqual(b"HELLO", decode_bytes(encode_bytes(u("HELLO")))) + self.assertRaises(ValueError, decode_bytes, u("\N{SNOWMAN}")) + self.assertRaises(ValueError, decode_bytes, "A===") + + def test_encode_decode_json_bytes(self): + obj = {"hello": "world"} +- self.assertEquals(obj, decode_json_bytes(encode_json_bytes(obj))) ++ self.assertEqual(obj, decode_json_bytes(encode_json_bytes(obj))) + self.assertRaises(ValueError, + decode_json_bytes, encode_bytes("NOJSON4U")) + self.assertRaises(ValueError, +@@ -48,8 +48,8 @@ class TestUtils(unittest.TestCase): + 6cDRGRjlUclBjNjBTRXcifQ + """.replace(" ", "").replace("\n", "").strip() + data = get_assertion_info(assertion) +- self.assertEquals(data["principal"]["email"], "ryan@rfk.id.au") +- self.assertEquals(data["audience"], "http://myfavoritebeer.org") ++ self.assertEqual(data["principal"]["email"], "ryan@rfk.id.au") ++ self.assertEqual(data["audience"], "http://myfavoritebeer.org") + self.assertRaises(ValueError, get_assertion_info, "JUNK") + self.assertRaises(ValueError, get_assertion_info, "X") + self.assertRaises(ValueError, get_assertion_info, "\x00\x01\x02") +diff --git a/browserid/tests/test_verifiers.py b/browserid/tests/test_verifiers.py +index e9c3ec9..d95ff8f 100644 +--- a/browserid/tests/test_verifiers.py ++++ b/browserid/tests/test_verifiers.py +@@ -124,7 +124,7 @@ class TestLocalVerifier(unittest.TestCase, VerifierTestCases): + warnings.simplefilter("always") + self.verifier = LocalVerifier(["*"]) + # There should be no warning about using this verifier. +- self.assertEquals(len(w), 0) ++ self.assertEqual(len(w), 0) + + @callwith(patched_supportdoc_fetching()) + def test_error_handling_in_verify_certificate_chain(self): +@@ -285,7 +285,7 @@ class TestRemoteVerifier(unittest.TestCase, VerifierTestCases): + response_text = ('{"email": "t@m.com", "status": "okay", ' + '"audience": "http://myfavoritebeer.org"}') + data = self._verify(response_text=response_text) +- self.assertEquals(data["email"], "t@m.com") ++ self.assertEqual(data["email"], "t@m.com") + + def test_handling_of_invalid_json_from_server(self): + with self.assertRaises(ConnectionError): +@@ -393,11 +393,11 @@ class TestDummyVerifier(unittest.TestCase, VerifierTestCases): + self.assertTrue(verifier.verify(assertion1)) + assertion2 = make_assertion("test@2.com", "", "2.com") + self.assertTrue(verifier.verify(assertion2)) +- self.assertEquals(len(supportdocs.cache), 2) ++ self.assertEqual(len(supportdocs.cache), 2) + # Hitting a third host should evict the first public key. + assertion3 = make_assertion("test@3.com", "", "3.com") + self.assertTrue(verifier.verify(assertion3)) +- self.assertEquals(len(supportdocs.cache), 2) ++ self.assertEqual(len(supportdocs.cache), 2) + # Make it error out if re-fetching any keys + + exc = RuntimeError("key fetch disabled") +@@ -412,13 +412,13 @@ class TestDummyVerifier(unittest.TestCase, VerifierTestCases): + # Prime the cache by verifying an assertion. + assertion1 = make_assertion("test@1.com", "", "1.com") + self.assertTrue(verifier.verify(assertion1)) +- self.assertEquals(len(supportdocs.cache), 1) ++ self.assertEqual(len(supportdocs.cache), 1) + # Let that cached key expire + time.sleep(0.1) + # Now grab a different key; caching it should purge the expired key. + assertion2 = make_assertion("test@2.com", "", "2.com") + self.assertTrue(verifier.verify(assertion2)) +- self.assertEquals(len(supportdocs.cache), 1) ++ self.assertEqual(len(supportdocs.cache), 1) + # Check that only the second entry is in cache. + + exc = RuntimeError("key fetch disabled") +-- +2.44.0 + diff --git a/PyBrowserID-0.14.0.tar.gz b/PyBrowserID-0.14.0.tar.gz new file mode 100644 index 0000000..4b1599f --- /dev/null +++ b/PyBrowserID-0.14.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c227669e87cc25796ae76f6a0ef65025528c8ad82d352679fa9a3e5663a71e3 +size 36566 diff --git a/python-PyBrowserID-unittest-mock.patch b/python-PyBrowserID-unittest-mock.patch new file mode 100644 index 0000000..cdb3b79 --- /dev/null +++ b/python-PyBrowserID-unittest-mock.patch @@ -0,0 +1,34 @@ +Index: PyBrowserID-0.14.0/browserid/tests/test_supportdoc.py +=================================================================== +--- PyBrowserID-0.14.0.orig/browserid/tests/test_supportdoc.py 2014-12-12 06:15:36.000000000 +0100 ++++ PyBrowserID-0.14.0/browserid/tests/test_supportdoc.py 2021-05-27 11:15:09.807769893 +0200 +@@ -1,7 +1,11 @@ + import json + import socket + +-from mock import Mock, patch ++try: ++ from unittest.mock import Mock, patch ++except ImportError: ++ from mock import Mock, patch ++ + from requests.exceptions import RequestException + + from browserid.supportdoc import fetch_support_document, SupportDocumentManager +Index: PyBrowserID-0.14.0/browserid/tests/test_verifiers.py +=================================================================== +--- PyBrowserID-0.14.0.orig/browserid/tests/test_verifiers.py 2018-01-11 22:01:14.000000000 +0100 ++++ PyBrowserID-0.14.0/browserid/tests/test_verifiers.py 2021-05-27 11:15:59.064034201 +0200 +@@ -5,7 +5,11 @@ + import time + import warnings + +-from mock import Mock, patch ++try: ++ from unittest.mock import Mock, patch ++except ImportError: ++ from mock import Mock, patch ++ + + import browserid + from browserid.tests.support import (patched_supportdoc_fetching, diff --git a/python-PyBrowserID.changes b/python-PyBrowserID.changes new file mode 100644 index 0000000..07167b5 --- /dev/null +++ b/python-PyBrowserID.changes @@ -0,0 +1,46 @@ +------------------------------------------------------------------- +Tue May 6 12:25:18 UTC 2025 - Markéta Machová + +- Convert to pip-based build + +------------------------------------------------------------------- +Mon Mar 18 07:18:27 UTC 2024 - Jaime Marquínez Ferrándiz + +- Add 0001-Remove-the-use-of-the-deprecated-assertEquals-functi.patch + +------------------------------------------------------------------- +Thu May 27 08:31:12 UTC 2021 - pgajdos@suse.com + +- %check: use %pyunittest rpm macro +- Add python-PyBrowserID-unittest-mock.patch removes dependency + on mock package (gh#mozilla/PyBrowserID#42). + +------------------------------------------------------------------- +Thu Nov 7 15:14:07 UTC 2019 - Matej Cepl + +- Run through spec-cleaner + +------------------------------------------------------------------- +Tue Dec 4 12:51:58 UTC 2018 - Matej Cepl + +- Remove superfluous devel dependency for noarch package + +------------------------------------------------------------------- +Fri Jan 12 06:31:48 UTC 2018 - antoine.belvire@opensuse.org + +- Update to version 0.14.0: + * Silence warnings about assertion format changes, since there's + now no risk of this. + +------------------------------------------------------------------- +Wed Dec 20 06:23:43 UTC 2017 - antoine.belvire@opensuse.org + +- Update to version 0.13.0: + * Use LocalVerifier by default, now that the hosted verifier + has shut down. + +------------------------------------------------------------------- +Sat Dec 2 11:08:00 UTC 2017 - antoine.belvire@opensuse.org + +- Initial package: python-PyBrowserID 0.12.0 + diff --git a/python-PyBrowserID.spec b/python-PyBrowserID.spec new file mode 100644 index 0000000..ad91db4 --- /dev/null +++ b/python-PyBrowserID.spec @@ -0,0 +1,68 @@ +# +# spec file for package python-PyBrowserID +# +# Copyright (c) 2025 SUSE LLC +# Copyright (c) 2017-2018 The openSUSE Project. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: python-PyBrowserID +Version: 0.14.0 +Release: 0 +Summary: Python library for the BrowserID Protocol +License: MPL-2.0 +URL: https://github.com/mozilla/PyBrowserID +Source: https://files.pythonhosted.org/packages/source/P/PyBrowserID/PyBrowserID-%{version}.tar.gz +# https://github.com/mozilla/PyBrowserID/issues/42 +Patch0: python-PyBrowserID-unittest-mock.patch +# PATCH-FIX-UPSTREAM (not submitted because the project is archive and doesn't accept pull requests) +Patch1: 0001-Remove-the-use-of-the-deprecated-assertEquals-functi.patch +BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-requests +BuildArch: noarch +# SECTION test requirements +%if %{suse_version} < 1550 +BuildRequires: %{python_module mock} +%endif +BuildRequires: %{python_module requests} +# /SECTION +%python_subpackages + +%description +This is a python client library for the BrowserID protocol that underlies +Mozilla Persona. + +%prep +%autosetup -p1 -n PyBrowserID-%{version} + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%pyunittest discover -v + +%files %{python_files} +%doc CHANGES.txt README.rst +%{python_sitelib}/browserid +%{python_sitelib}/[Pp]y[Bb]rowser[Ii][Dd]-%{version}*-info + +%changelog