unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Arun Isaac <arunisaac@systemreboot.net>
To: 51520@debbugs.gnu.org
Cc: Arun Isaac <arunisaac@systemreboot.net>
Subject: [bug#51520] [PATCH 2/3] gnu: Add weechat-matrix.
Date: Sun, 31 Oct 2021 01:55:13 +0530	[thread overview]
Message-ID: <20211030202514.18639-2-arunisaac@systemreboot.net> (raw)
In-Reply-To: <20211030202514.18639-1-arunisaac@systemreboot.net>

* gnu/packages/messaging.scm (weechat-matrix): New variable.
---
 gnu/packages/messaging.scm | 69 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 68 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/messaging.scm b/gnu/packages/messaging.scm
index d07c1c6566..e684c60c0c 100644
--- a/gnu/packages/messaging.scm
+++ b/gnu/packages/messaging.scm
@@ -9,7 +9,7 @@
 ;;; Copyright © 2016 Andy Patterson <ajpatter@uwaterloo.ca>
 ;;; Copyright © 2016, 2017, 2018, 2019 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2017 Mekeor Melire <mekeor.melire@gmail.com>
-;;; Copyright © 2017, 2018, 2020 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2017, 2018, 2020, 2021 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org>
 ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
@@ -2992,4 +2992,71 @@ (define-public matterbridge
     (home-page "https://github.com/42wim/matterbridge")
     (license license:asl2.0)))
 
+(define-public weechat-matrix
+  (package
+    (name "weechat-matrix")
+    (version "0.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/poljar/weechat-matrix")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1iv55n4k05139f7jzkhczgw4qp6qwilrvfsy3c6v2m1kxffj12d3"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'build)
+         (replace 'install
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((weechat-python (string-append (assoc-ref outputs "out")
+                                                   "/share/weechat/python")))
+               ;; Avoid circular import by renaming the matrix module to
+               ;; weechat_matrix.
+               (substitute* (cons "main.py"
+                                  (append (find-files "matrix")
+                                          (find-files "tests")))
+                 (("from matrix") "from weechat_matrix")
+                 (("import matrix") "import weechat_matrix"))
+               ;; Install python modules.
+               (invoke "make" "install-lib"
+                       (string-append "INSTALLDIR="
+                                      (site-packages inputs outputs)
+                                      "/weechat_matrix"))
+               ;; Extend PYTHONPATH to find installed python modules.
+               (add-installed-pythonpath inputs outputs)
+               ;; Augment sys.path so that dependencies are found.
+               (substitute* "main.py"
+                 (("import os\n" all)
+                  (apply string-append
+                         all
+                         "import sys\n"
+                         (map (lambda (path)
+                                (string-append "sys.path.append('" path "')\n"))
+                              (string-split (getenv "PYTHONPATH") #\:)))))
+               ;; Install script.
+               (mkdir-p weechat-python)
+               (copy-file "main.py"
+                          (string-append weechat-python "/matrix.py")))))
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (when tests?
+               (invoke "pytest")))))))
+    (inputs
+     `(("python-matrix-nio" ,python-matrix-nio)
+       ("python-pygments" ,python-pygments)
+       ("python-pyopenssl" ,python-pyopenssl)
+       ("python-webcolors" ,python-webcolors)))
+    (native-inputs
+     `(("python-pytest" ,python-pytest)))
+    (home-page "https://github.com/poljar/weechat-matrix")
+    (synopsis "Weechat Matrix protocol script")
+    (description "@code{weechat-matrix} is a Python plugin for Weechat that lets
+Weechat communicate over the Matrix protocol.")
+    (license license:isc)))
+
 ;;; messaging.scm ends here
-- 
2.33.0





  reply	other threads:[~2021-10-30 20:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-30 20:21 [bug#51520] [PATCH 0/3] Add weechat-matrix and weechat-wee-slack Arun Isaac
2021-10-30 20:25 ` [bug#51520] [PATCH 1/3] gnu: Add python-webcolors Arun Isaac
2021-10-30 20:25   ` Arun Isaac [this message]
2021-10-30 20:25   ` [bug#51520] [PATCH 3/3] gnu: Add weechat-wee-slack Arun Isaac
2021-10-30 23:17 ` [bug#51520] Just what I needed! jgart via Guix-patches via
2021-11-07 21:00 ` bug#51520: [PATCH 0/3] Add weechat-matrix and weechat-wee-slack Efraim Flashner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211030202514.18639-2-arunisaac@systemreboot.net \
    --to=arunisaac@systemreboot.net \
    --cc=51520@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).