From 9cd5e904bc8a8d489edaa5e6591671647a35588d58bc16bd15a04060b976f6ce Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Thu, 28 Jul 2022 06:05:00 +0000 Subject: [PATCH] - Add patch pymongo-4-support.patch: * Support pymongo >= 4 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pysaml2?expand=0&rev=63 --- pymongo-4-support.patch | 37 +++++++++++++++++++++++++++++++++++++ python-pysaml2.changes | 6 ++++++ python-pysaml2.spec | 5 ++++- 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 pymongo-4-support.patch diff --git a/pymongo-4-support.patch b/pymongo-4-support.patch new file mode 100644 index 0000000..00d5001 --- /dev/null +++ b/pymongo-4-support.patch @@ -0,0 +1,37 @@ +From 32a3c24ae1292ad04065aaaee6324ab9441fad8e Mon Sep 17 00:00:00 2001 +From: Johan Lundberg +Date: Wed, 8 Dec 2021 15:10:27 +0100 +Subject: [PATCH] MongoReplicaSetClient removed in pymongo>=4 + +from pymongo docs: +Since PyMongo 3.0, MongoReplicaSetClient has been identical to +pymongo.mongo_client.MongoClient. Applications can simply replace +MongoReplicaSetClient with pymongo.mongo_client.MongoClient and get the +same behavior. +--- + src/saml2/mongo_store.py | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/src/saml2/mongo_store.py b/src/saml2/mongo_store.py +index 7df1b5655..d7f834d1b 100644 +--- a/src/saml2/mongo_store.py ++++ b/src/saml2/mongo_store.py +@@ -2,8 +2,7 @@ + from hashlib import sha1 + import logging + +-from pymongo import MongoClient +-from pymongo.mongo_replica_set_client import MongoReplicaSetClient ++from pymongo.mongo_client import MongoClient + import pymongo.uri_parser + import pymongo.errors + from saml2.saml import NAMEID_FORMAT_PERSISTENT +@@ -288,8 +287,6 @@ def _mdb_get_database(uri, **kwargs): + _conn = MongoClient() + pass + else: +- if "replicaset" in _parsed_uri["options"]: +- connection_factory = MongoReplicaSetClient + db_name = _parsed_uri.get("database", "pysaml2") + _conn = connection_factory(uri, **kwargs) + diff --git a/python-pysaml2.changes b/python-pysaml2.changes index ae864dc..8316ac6 100644 --- a/python-pysaml2.changes +++ b/python-pysaml2.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Jul 28 06:04:01 UTC 2022 - Steve Kowalik + +- Add patch pymongo-4-support.patch: + * Support pymongo >= 4 + ------------------------------------------------------------------- Thu Apr 7 08:37:47 UTC 2022 - pgajdos@suse.com diff --git a/python-pysaml2.spec b/python-pysaml2.spec index 992d81f..63adb98 100644 --- a/python-pysaml2.spec +++ b/python-pysaml2.spec @@ -26,6 +26,9 @@ Summary: Python implementation of SAML Version 2 to be used in a WSGI env License: Apache-2.0 URL: https://github.com/IdentityPython/pysaml2 Source: https://github.com/IdentityPython/pysaml2/archive/v%{version}.tar.gz +# PATCH-FIX-UPSTREAM closed PR, but provides context: +# gh#IdentityPython/pysaml2#843 +Patch0: pymongo-4-support.patch BuildRequires: %{python_module Paste} BuildRequires: %{python_module cryptography >= 1.4} BuildRequires: %{python_module dbm} @@ -74,7 +77,7 @@ It contains all necessary pieces for building a SAML2 service provider or an identity provider. %prep -%setup -q -n %{modname}-%{version} +%autosetup -p1 -n %{modname}-%{version} # delete shebang of files not in executable path find src/ -name '*.py' -print0 | xargs -0 sed -i '1s/#!.*$//'