Subject: [PATCH 2/2] gnu: gfeeds: Update to 2.2.0.

From: Liliana Marie Prikler <[email-masked]>
Date: Sat, 22 Apr 2023 07:05:00 +0200

* gnu/packages/patches/gfeeds-python-39-compat.patch: New file.
* gnu/local.mk: Register it here.
* gnu/packages/syndication.scm (gfeeds): Update to 2.2.0.
[source]: Add gfeeds-python-39-compat.patch.
[arguments]: Adjust ‘skip-icon-cache’ phase accordingly.
---
 gnu/local.mk                                  |  1 +
 .../patches/gfeeds-python-39-compat.patch     | 82 +++++++++++++++++++
 gnu/packages/syndication.scm                  | 12 +--
 3 files changed, 90 insertions(+), 5 deletions(-)
 create mode 100644 gnu/packages/patches/gfeeds-python-39-compat.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index b631fa6d5a..68361252c3 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1209,6 +1209,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gemmi-fix-sajson-types.patch		\
   %D%/packages/patches/genimage-mke2fs-test.patch		\
   %D%/packages/patches/geoclue-config.patch			\
+  %D%/packages/patches/gfeeds-python-39-compat.patch			\
   %D%/packages/patches/ghc-8.0-fall-back-to-madv_dontneed.patch	\
   %D%/packages/patches/ghc-9.2-glibc-2.33-link-order.patch \
   %D%/packages/patches/ghc-testsuite-dlopen-pie.patch		\
diff --git a/gnu/packages/patches/gfeeds-python-39-compat.patch b/gnu/packages/patches/gfeeds-python-39-compat.patch
new file mode 100644
index 0000000000..edf64f9f72
--- /dev/null
+++ b/gnu/packages/patches/gfeeds-python-39-compat.patch
@@ -0,0 +1,82 @@
+Index: gfeeds-2.2.0/gfeeds/conf_mapper.py
+===================================================================
+--- gfeeds-2.2.0.orig/gfeeds/conf_mapper.py
++++ gfeeds-2.2.0/gfeeds/conf_mapper.py
+@@ -1,4 +1,4 @@
+-from typing import Dict, List, Literal, cast
++from typing import Dict, List, Literal, Union, cast
+ from gfeeds.gsettings_wrapper import GSETTINGS_TYPES, GsettingsWrapper
+ 
+ 
+@@ -9,7 +9,8 @@ class ConfMapper:
+     @property
+     def feeds(self) -> Dict[
+             str,
+-            Dict[Literal['tags', 'last-modified'], List[str] | str]
++            Dict[Literal['tags', 'last-modified'],
++                 Union[List[str], str]]
+     ]:
+         return cast(dict, self.gsw.get('feeds'))
+ 
+Index: gfeeds-2.2.0/gfeeds/gsettings_wrapper.py
+===================================================================
+--- gfeeds-2.2.0.orig/gfeeds/gsettings_wrapper.py
++++ gfeeds-2.2.0/gfeeds/gsettings_wrapper.py
+@@ -80,19 +80,18 @@ class GsettingsWrapper:
+ 
+     def set(self, key: str, value: GSETTINGS_TYPES):
+         key = self.convert_and_check_key(key)
+-        match value:
+-            case str(value):
+-                self.gs.set_string(key, value)
+-            case dict(value) | list(value):
+-                self.set(key, json.dumps(value, cls=CustomJSONEncoder))
+-            case bool(value):
+-                self.gs.set_boolean(key, value)
+-            case int(value):
+-                self.gs.set_int(key, value)
+-            case float(value):
+-                self.gs.set_double(key, value)
+-            case _:
+-                return self.__type_err()
++        if isinstance(value, str):
++            self.gs.set_string(key, value)
++        elif isinstance(value, dict) or isinstance(value, list):
++            self.set(key, json.dumps(value, cls=CustomJSONEncoder))
++        elif isinstance(value, bool):
++            self.gs.set_boolean(key, value)
++        elif isinstance(value, int):
++            self.gs.set_int(key, value)
++        elif isinstance(value, float):
++            self.gs.set_double(key, value)
++        else:
++            return self.__type_err()
+ 
+     def __type_err(self):
+         raise TypeError(
+Index: gfeeds-2.2.0/gfeeds/signal_helper.py
+===================================================================
+--- gfeeds-2.2.0.orig/gfeeds/signal_helper.py
++++ gfeeds-2.2.0/gfeeds/signal_helper.py
+@@ -1,7 +1,7 @@
+-from typing import Literal, Tuple, Type
++from typing import Literal, Tuple, Union, Type
+ from gi.repository import GObject
+ 
+-SignalReturnType = (
++SignalReturnType = Union[
+     Literal[
+         GObject.TYPE_INT,
+         GObject.TYPE_BOOLEAN,
+@@ -11,9 +11,8 @@ SignalReturnType = (
+         GObject.TYPE_STRING,
+         GObject.TYPE_NONE,
+         GObject.TYPE_PYOBJECT,
+-    ]
+-    | None
+-)
++    ], None
++]
+ 
+ 
+ def signal_tuple(
diff --git a/gnu/packages/syndication.scm b/gnu/packages/syndication.scm
index d0aa014ade..3f0eecde93 100644
--- a/gnu/packages/syndication.scm
+++ b/gnu/packages/syndication.scm
@@ -536,7 +536,7 @@ (define-public syndication-domination
 (define-public gfeeds
   (package
     (name "gfeeds")
-    (version "1.0.3")
+    (version "2.2.0")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -545,7 +545,8 @@ (define-public gfeeds
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1lkvhff7pl1y4brqsix6sar5yl8flyhfp3w96fx0klhk3586bvhg"))))
+                "0p2hyjif9yhpc6r3ig7fdxpb2q8s9g42mz38svsc38gq7hb13b2w"))
+              (patches (search-patches "gfeeds-python-39-compat.patch"))))
     (build-system meson-build-system)
     (arguments
      (list
@@ -556,9 +557,10 @@ (define-public gfeeds
               (substitute* "gfeeds/confManager.py"
                 (("mpv") (search-input-file inputs "/bin/mpv")))))
           (add-after 'unpack 'skip-icon-cache
-            (lambda _
-              (substitute* "meson_post_install.py"
-                (("gtk-update-icon-cache") "true"))))
+           (lambda _
+             (substitute* "meson.build"
+               (("gtk_update_icon_cache: true")
+                "gtk_update_icon_cache: false"))))
           (add-after 'install 'wrap-gfeeds
             (lambda* (#:key outputs #:allow-other-keys)
               (wrap-program (string-append
-- 
2.39.2