Subject: [bug#48091] [PATCH v5 10/10] gnu: Add tgcli.

From: Raghav Gururajan <[email-masked]>
Date: Fri, 30 Apr 2021 10:38:58 -0400

* gnu/packages/telegram.scm (tgcli): New variable.
---
 gnu/packages/telegram.scm | 52 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/gnu/packages/telegram.scm b/gnu/packages/telegram.scm
index c4414287a7..6b1617ab80 100644
--- a/gnu/packages/telegram.scm
+++ b/gnu/packages/telegram.scm
@@ -50,6 +50,9 @@
   #:use-module (gnu packages protobuf)
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-check)
+  #:use-module (gnu packages python-web)
+  #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages textutils)
@@ -68,6 +71,7 @@
   #:use-module (guix build-system glib-or-gtk)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
+  #:use-module (guix build-system python)
   #:use-module (guix build-system qt))
 
 (define-public webrtc-for-telegram-desktop
@@ -813,3 +817,51 @@ formerly a part of telegram-cli, but now being maintained separately.")
       (description "TG is the command-line interface for Telegram Messenger.")
       (home-page "https://github.com/vysheng/tg")
       (license license:gpl2+))))
+
+(define-public tgcli
+  (package
+    (name "tgcli")
+    (version "0.3.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/erayerdin/tgcli")
+         (commit (string-append "v" version))))
+       (file-name
+        (git-file-name name version))
+       (sha256
+        (base32 "082zim7rh4r8qyscqimjh2sz7998vv9j1i2y2wwz2rgrlhkhly5r"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         ;; Test requirements referes to specific versions of packages,
+         ;; which are too old. So we patch them to refer to any later versions.
+         (add-after 'unpack 'patch-test-requirements
+           (lambda _
+             (substitute* "dev.requirements.txt"
+               (("==") ">="))))
+         (replace 'check
+           (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+             (when tests?
+               (add-installed-pythonpath inputs outputs)
+               (invoke "pytest" "tests")))))))
+    (native-inputs
+     `(("coveralls" ,python-coveralls)
+       ("pytest" ,python-pytest)
+       ("pytest-click" ,python-pytest-click)
+       ("pytest-cov" ,python-pytest-cov)
+       ("mkdocs" ,python-mkdocs)
+       ("mkdocs-material" ,python-mkdocs-material)
+       ("requests-mock" ,python-requests-mock)))
+    (propagated-inputs
+     `(("click" ,python-click)
+       ("colorful" ,python-colorful)
+       ("requests" ,python-requests)
+       ("yaspin" ,python-yaspin)))
+    (home-page "https://tgcli.readthedocs.io")
+    (synopsis "Telegram Terminal Application")
+    (description "TgCli is a telegram client to automate repetitive tasks.")
+    (license license:asl2.0)))
-- 
2.31.1