Subject: Re: [bug#46862] Giara - A free-software client for Reddit (v2)

From: Raghav Gururajan <[email-masked]>
Date: Wed, 10 Mar 2021 08:02:24 -0500

Hi Efraim!

> It definitely launched much faster than on my pinephone. A couple of comments inlined.
> 
> Also, I wasn't able to login to giara. I got redirected to icecat and
> was able to login and press authorize as expected, but nothing happened
> with the giara window and it stayed at 'waiting for authorization'. I'm
> not sure if it's because I'm not running a GTK desktop, but I didn't
> investigate too far.

It appears to be an API issue. Probably reddit changed something in 
their back-end, like youtube. I'll contact Giara's author.

I have applied your suggested changes and attached v2 with this email.

Regards,
RG.
From 44e3361a78bbcbe5c48b57fe584b23c1cd1dfda5 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <[email-masked]>
Date: Wed, 10 Mar 2021 06:43:09 -0500
Subject: [PATCH 1/5] gnu: Add python-betamax-serializers.

* gnu/packages/python-web.scm (python-betamax-serializers): New variable.
---
 gnu/packages/python-web.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index b0268e5a31..b3a1d3ac67 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -3228,6 +3228,26 @@ Betamax.")
 (define-public python2-betamax-matchers
   (package-with-python2 python-betamax-matchers))
 
+(define-public python-betamax-serializers
+  (package
+    (name "python-betamax-serializers")
+    (version "0.2.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "betamax-serializers" version))
+       (sha256
+        (base32 "0ja9isbjmzzhxdj69s0kdsvw8nkp073w6an6a4liy5vk3fdl2p1l"))))
+    (build-system python-build-system)
+    (propagated-inputs
+     `(("python-betamax" ,python-betamax)
+       ("python-pyyaml" ,python-pyyaml)))
+    (synopsis "Set of third-party serializers for Betamax")
+    (description "Betamax-Serializers are an experimental set of Serializers for
+Betamax that may possibly end up in the main package.")
+    (home-page "https://gitlab.com/betamax/serializers")
+    (license license:asl2.0)))
+
 (define-public python-s3transfer
   (package
     (name "python-s3transfer")
-- 
2.30.1

From a1507241c457b9ee3d1474b71849112637a3c6a2 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <[email-masked]>
Date: Wed, 10 Mar 2021 03:09:38 -0500
Subject: [PATCH] gnu: qtsolutions: Enable examples.

* gnu/packages/qt.scm (qtsolutions) [arguments]: Modify phases
'patch-source and 'install.
---
 gnu/packages/qt.scm | 62 ++++++++++++++++++++++++++++++++-------------
 1 file changed, 44 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index d921aa87fe..8409fc1803 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -2497,18 +2497,18 @@ securely.  It will not store any data unencrypted unless explicitly requested.")
              (with-directory-excursion "qtsingleapplication/src"
                (for-each delete-file
                          (find-files "." "qtlockedfile.*\\.(h|cpp)"))
-                 (substitute* "qtsingleapplication.pri"
-                   ;; Add include path of LockedFile.
-                   (("INCLUDEPATH \\+=")
-                    "INCLUDEPATH += ../../qtlockedfile/src")
-                   ;; Link library of LockedFile.
-                   (("LIBS \\+=")
-                    "LIBS += -lQtSolutions_LockedFile"))
-                 (substitute* '("qtlocalpeer.h" "qtlocalpeer.cpp")
-                   (("#include \"qtlockedfile.*\\.cpp\"") "")
-                   ;; Unwrap namespace added in the vendoring process.
-                   (("QtLP_Private::QtLockedFile")
-                    "QtLockedFile")))
+               (substitute* "qtsingleapplication.pri"
+                 ;; Add include path of LockedFile.
+                 (("INCLUDEPATH \\+=")
+                  "INCLUDEPATH += ../../qtlockedfile/src")
+                 ;; Link library of LockedFile.
+                 (("LIBS \\+=")
+                  "LIBS += -lQtSolutions_LockedFile"))
+               (substitute* '("qtlocalpeer.h" "qtlocalpeer.cpp")
+                 (("#include \"qtlockedfile.*\\.cpp\"") "")
+                 ;; Unwrap namespace added in the vendoring process.
+                 (("QtLP_Private::QtLockedFile")
+                  "QtLockedFile")))
              #t))))
       (build-system gnu-build-system)
       (arguments
@@ -2524,16 +2524,32 @@ securely.  It will not store any data unencrypted unless explicitly requested.")
          (modify-phases %standard-phases
            (add-after 'unpack 'patch-source
              (lambda* (#:key outputs #:allow-other-keys)
+               ;; Rename example to examples, in qtlockedfile,
+               ;; so that it gets picked up during install phase.
+               (with-directory-excursion "qtlockedfile"
+                 (rename-file "example" "examples")
+                 (rename-file "examples/example.pro" "examples/examples.pro")
+                 (substitute* "qtlockedfile.pro"
+                   (("SUBDIRS\\+=example") "SUBDIRS+=examples")))
                (substitute* (find-files "." "common.pri")
+                 ;; Patch run-path for binaries.
+                 (("QMAKE_RPATHDIR \\+= \\$\\$?.*_LIBDIR")
+                  (string-append "QMAKE_RPATHDIR += "
+                                 (assoc-ref outputs "out") "/lib"))
                  ;; Remove unnecessary prefixes/suffixes in library names.
                  (("qt5") "qt")
                  (("-head") ""))
-               ;; Disable building of examples.
-               (substitute* (find-files "." "\\.pro$")
+               ;; Disable building of examples for QtSingleApplication.
+               (substitute* "qtsingleapplication/qtsingleapplication.pro"
                  (("SUBDIRS\\+=examples") ""))
-               ;; Fix deprecated functions.
-               (substitute* "qtsoap/src/qtsoap.cpp"
-                 (("toAscii") "toUtf8"))
+               (with-directory-excursion "qtsoap/src"
+                 ;; Patch Qt imports for QtSoap.
+                 (substitute* "qtsoap.pri"
+                   (("QT \\+= xml network")
+                    "QT += core gui widgets xml network"))
+                 ;; Fix deprecated functions.
+                 (substitute* "qtsoap.cpp"
+                   (("toAscii") "toUtf8")))
                #t))
            (replace 'configure
              (lambda _
@@ -2560,7 +2576,17 @@ securely.  It will not store any data unencrypted unless explicitly requested.")
                               (assoc-ref copy:%standard-phases 'install)
                               #:install-plan
                               '(("src" "include" #:include-regexp ("\\.h$"))
-                                ("lib" "lib"))
+                                ("lib" "lib")
+                                ("examples" "bin"
+                                 #:include ("examples" "canvas_typed"
+                                            "canvas_variant" "decoration"
+                                            "demo" "extension"
+                                            "object_controller" "simple"
+                                            "controller" "interactive"
+                                            "httpservice" "console"
+                                            "loader" "trivial"
+                                            "easter" "google"
+                                            "population")))
                               args)))
                          '("qtlockedfile" "qtpropertybrowser" "qtservice"
                            "qtsingleapplication" "qtsoap")))))))
-- 
2.30.1

From da0e44fc2f610b20063471f2c40b4bd330d11507 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <[email-masked]>
Date: Wed, 10 Mar 2021 06:49:48 -0500
Subject: [PATCH 2/5] gnu: Add python-testfixtures.

* gnu/packages/python-check.scm (python-testfixtures): New variable.
---
 gnu/packages/python-check.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm
index 15efdd3297..039fbaf554 100644
--- a/gnu/packages/python-check.scm
+++ b/gnu/packages/python-check.scm
@@ -29,7 +29,9 @@
 (define-module (gnu packages python-check)
   #:use-module (gnu packages)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages django)
   #:use-module (gnu packages openstack)
+  #:use-module (gnu packages python-build)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages web)
@@ -41,6 +43,31 @@
   #:use-module (guix download)
   #:use-module (guix build-system python))
 
+(define-public python-testfixtures
+  (package
+    (name "python-testfixtures")
+    (version "6.17.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "testfixtures" version))
+       (sha256
+        (base32 "1nlv2hz20czjp4a811ichl5kwg99rh84l0mw9wq4rk3idzfs1hsy"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:tests? #f))          ; PyTest-Django fails to build in master
+    (native-inputs
+     `(("python-pytest" ,python-pytest)
+       ("python-pytest-cov" ,python-pytest-cov)
+       ;;("python-pytest-django" ,python-pytest-django)
+       ("python-twine" ,python-twine)
+       ("python-wheel" ,python-wheel)))
+    (synopsis "Tests components for Python")
+    (description "Testfixtures is a collection of helpers and mock objects that
+are useful when writing automated tests in Python.")
+    (home-page "https://testfixtures.readthedocs.io/en/latest/")
+    (license license:expat)))
+
 (define-public python-coveralls
   (package
     (name "python-coveralls")
-- 
2.30.1

From dc26c30cc35abfed45ad68beb7e93399947c7517 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <[email-masked]>
Date: Mon, 1 Mar 2021 15:37:23 -0500
Subject: [PATCH 3/5] gnu: Add python-prawcore.

* gnu/packages/python-web.scm (python-prawcore): New variable.
---
 gnu/packages/python-web.scm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index b3a1d3ac67..fa479ff7dd 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -91,6 +91,31 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (srfi srfi-1))
 
+(define-public python-prawcore
+  (package
+    (name "python-prawcore")
+    (version "2.0.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "prawcore" version))
+       (sha256
+        (base32 "1l9nrn4s03xl8fvkyybdk86bm9cyyk43alkxf9g014a9ynvdk65l"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("python-betamax" ,python-betamax)
+       ("python-betamax-matchers" ,python-betamax-matchers)
+       ("python-betamax-serializers" ,python-betamax-serializers)
+       ("python-mock" ,python-mock)
+       ("python-pytest" ,python-pytest)
+       ("python-testfixtures" ,python-testfixtures)))
+    (propagated-inputs
+     `(("python-requests" ,python-requests)))
+    (synopsis "Core component of PRAW")
+    (description "PRAWcore is a low-level communication layer used by PRAW.")
+    (home-page "https://praw.readthedocs.io/en/latest/")
+    (license license:bsd-2)))
+
 (define-public python-aiohttp
   (package
     (name "python-aiohttp")
-- 
2.30.1

From 60bc56b8473d3648e35d1a222fbd80cb5d0e6fb1 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <[email-masked]>
Date: Mon, 1 Mar 2021 16:01:21 -0500
Subject: [PATCH 4/5] gnu: Add python-praw.

* gnu/packages/python-web.scm (python-raw): New variable.
---
 gnu/packages/python-web.scm | 43 +++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index fa479ff7dd..e4152e6463 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -116,6 +116,49 @@
     (home-page "https://praw.readthedocs.io/en/latest/")
     (license license:bsd-2)))
 
+(define-public python-praw
+  (package
+    (name "python-praw")
+    (version "7.2.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "praw" version))
+       (sha256
+        (base32 "0ll1a0n8xs8gykizdsfrw63jp6bc39ab0pk3yzwcak96fyxh0ij3"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'disable-failing-tests
+           (lambda _
+             (with-directory-excursion "tests"
+               ;; Require networking.
+               (for-each delete-file-recursively
+                         '("integration/models" "unit/models"))
+               ;; https://github.com/praw-dev/praw/issues/1699
+               ;; #issuecomment-795336704
+               (delete-file "unit/test_config.py"))
+             #t))
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (when tests?
+               (invoke "pytest"))
+             #t)))))
+    (native-inputs
+     `(("python-betamax" ,python-betamax)
+       ("python-betamax-matchers" ,python-betamax-matchers)
+       ("python-pytest" ,python-pytest)))
+    (propagated-inputs
+     `(("python-prawcore" ,python-prawcore)
+       ("python-websocket-client" ,python-websocket-client)))
+    (synopsis "Python Reddit API Wrapper")
+    (description "PRAW is a Python package that allows for simple access to
+Reddit’s API.  It aims to be easy to use and internally follows all of Reddit’s
+API rules.")
+    (home-page "https://praw.readthedocs.io/en/latest/")
+    (license license:bsd-2)))
+
 (define-public python-aiohttp
   (package
     (name "python-aiohttp")
-- 
2.30.1

From 249a4ece2948a3ba2f9edb1f7db0f0f07d1831e7 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <[email-masked]>
Date: Wed, 10 Mar 2021 07:54:40 -0500
Subject: [PATCH 5/5] gnu: Add giara.

* gnu/packages/syndication.scm (giara): New variable.
---
 gnu/packages/syndication.scm | 59 ++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/gnu/packages/syndication.scm b/gnu/packages/syndication.scm
index 79dbb77018..8e0b871e3d 100644
--- a/gnu/packages/syndication.scm
+++ b/gnu/packages/syndication.scm
@@ -23,6 +23,7 @@
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix packages)
+  #:use-module (guix utils)
   #:use-module (guix build-system cargo)
   #:use-module (guix build-system glib-or-gtk)
   #:use-module (guix build-system gnu)
@@ -36,6 +37,7 @@
   #:use-module (gnu packages crates-io)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
@@ -59,6 +61,63 @@
   #:use-module (gnu packages xml)
   #:use-module (srfi srfi-1))
 
+(define-public giara
+  (package
+    (name "giara")
+    (version "0.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.gnome.org/World/giara")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "004qmkfrgd37axv0b6hfh6v7nx4pvy987k5yv4bmlmkj9sbqm6f9"))))
+    (build-system meson-build-system)
+    (arguments
+     `(#:glib-or-gtk? #t
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'wrap-programs
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin/"))
+                    (lib (string-append out "/lib/python"
+                                        ,(version-major+minor
+                                          (package-version python))
+                                        "/site-packages")))
+               (wrap-program (string-append bin "giara")
+                 `("PYTHONPATH" ":" prefix (,(getenv "PYTHONPATH") ,lib))
+                 `("GI_TYPELIB_PATH" ":" prefix (,(getenv "GI_TYPELIB_PATH")))))
+             #t)))))
+    (native-inputs
+     `(("gettext" ,gettext-minimal)
+       ("glib:bin" ,glib "bin")
+       ("gobject-introspection" ,gobject-introspection)
+       ("gtk+:bin" ,gtk+ "bin")
+       ("pkg-config" ,pkg-config)
+       ("xmllint" ,libxml2)))
+    (inputs
+     `(("glib" ,glib)
+       ("gtk+" ,gtk+)
+       ("gtksourceview" ,gtksourceview)
+       ("libhandy" ,libhandy)
+       ("python" ,python)
+       ("python-beautifulsoup" ,python-beautifulsoup4)
+       ("python-dateutil" ,python-dateutil)
+       ("python-mistune" ,python-mistune)
+       ("python-pillow" ,python-pillow)
+       ("python-praw" ,python-praw)
+       ("python-pycairo" ,python-pycairo)
+       ("python-pygobject" ,python-pygobject)
+       ("python-requests" ,python-requests)
+       ("webkitgtk" ,webkitgtk)))
+    (synopsis "Client for Reddit")
+    (description "Giara is a reddit app, built with Python, GTK and Handy.")
+    (home-page "https://giara.gabmus.org/")
+    (license license:gpl3+)))
+
 (define-public newsboat
   (package
     (name "newsboat")
-- 
2.30.1