#6 Fix for Python 3.9 compatibility
Merged 3 years ago by churchyard. Opened 3 years ago by churchyard.
rpms/ churchyard/python-fedora py39  into  master

@@ -7,10 +7,10 @@ 

   flask_fas_openid.py | 2 +-

   1 file changed, 1 insertion(+), 1 deletion(-)

  

- diff --git a/python-fedora-0.10.0/flask_fas_openid.py b/python-fedora-0.10.0/flask_fas_openid.py

+ diff --git a/flask_fas_openid.py b/flask_fas_openid.py

  index 074b5de..3e3f6f7 100644

- --- a/python-fedora-0.10.0/flask_fas_openid.py

- +++ b/python-fedora-0.10.0/flask_fas_openid.py

+ --- a/flask_fas_openid.py

+ +++ b/flask_fas_openid.py

  @@ -112,7 +112,7 @@ class FAS(object):

               # of old versions used sane version numbers.

               assume_recent = True

@@ -0,0 +1,52 @@ 

+ From ba67c3487990edc66f1f48d689e32a0992bd2f15 Mon Sep 17 00:00:00 2001

+ From: =?UTF-8?q?Aur=C3=A9lien=20Bompard?= <aurelien@bompard.org>

+ Date: Tue, 31 Jul 2018 14:40:28 +0200

+ Subject: [PATCH] The encoding arg of json.loads() is ignored and deprecated

+ 

+ ---

+  fedora/client/openidbaseclient.py | 2 +-

+  1 file changed, 1 insertion(+), 1 deletion(-)

+ 

+ diff --git a/fedora/client/openidbaseclient.py b/fedora/client/openidbaseclient.py

+ index 22346dc..08374be 100644

+ --- a/fedora/client/openidbaseclient.py

+ +++ b/fedora/client/openidbaseclient.py

+ @@ -330,7 +330,7 @@ class OpenIdBaseClient(OpenIdProxyClient):

+          try:

+              with self.cache_lock:

+                  with open(b_SESSION_FILE, 'rb') as f:

+ -                    data = json.loads(f.read(), encoding='utf-8')

+ +                    data = json.loads(f.read().decode('utf-8'))

+              for key, value in data[self.session_key]:

+                  self._session.cookies[key] = value

+          except KeyError:

+ -- 

+ 2.26.2

+ 

+ From e14c2b163a3601e1c362b0c22daae0ce35bcf4b6 Mon Sep 17 00:00:00 2001

+ From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>

+ Date: Sat, 9 May 2020 12:53:44 +0200

+ Subject: [PATCH] The encoding arg of json.loads() is ignored and deprecated

+  (fixup)

+ 

+ Fixup of ba67c3487990edc66f1f48d689e32a0992bd2f15

+ ---

+  fedora/client/openidbaseclient.py | 2 +-

+  1 file changed, 1 insertion(+), 1 deletion(-)

+ 

+ diff --git a/fedora/client/openidbaseclient.py b/fedora/client/openidbaseclient.py

+ index 08374be..263b437 100644

+ --- a/fedora/client/openidbaseclient.py

+ +++ b/fedora/client/openidbaseclient.py

+ @@ -351,7 +351,7 @@ class OpenIdBaseClient(OpenIdProxyClient):

+              try:

+                  check_file_permissions(b_SESSION_FILE, True)

+                  with open(b_SESSION_FILE, 'rb') as f:

+ -                    data = json.loads(f.read(), encoding='utf-8')

+ +                    data = json.loads(f.read().decode('utf-8'))

+              except UnsafeFileError as e:

+                  log.debug('Clearing sessions: {}'.format(str(e)))

+                  os.unlink(b_SESSION_FILE)

+ -- 

+ 2.26.2

+ 

file modified
+7 -1
@@ -25,6 +25,9 @@ 

  

  Patch01:        0001-Make-flask_fas_openid-compatible-with-flask-1.0.patch

  

+ # https://github.com/fedora-infra/python-fedora/pull/226

+ Patch02:        0002-The-encoding-arg-of-json.loads-is-ignored-and-deprecated.patch

+ 

  %if 0%{?with_python2}

  BuildRequires:  python-lockfile

  BuildRequires:  python-munch
@@ -189,7 +192,10 @@ 

  %endif

  

  %prep

- %autosetup -c -p1 -n %{name}-%{version}

+ %setup -c -n %{name}-%{version}

+ pushd %{name}-%{version}

+ %autopatch -p1

+ popd

  mv %{name}-%{version} python2

  

  # no more python2-fedora-turbogears2 (#1634646)