summaryrefslogtreecommitdiff
path: root/gnu/packages/messaging.scm
diff options
context:
space:
mode:
authorArun Isaac <arunisaac@systemreboot.net>2021-10-31 01:55:13 +0530
committerEfraim Flashner <efraim@flashner.co.il>2021-11-07 22:50:32 +0200
commit7ebed0cdc8043852bed7f5ca639f16bac30cc124 (patch)
tree4ef0cf272e247b53451a3b83ec3097a846892892 /gnu/packages/messaging.scm
parent73679a6837416644aa51c6d39e7970fa57d5aef1 (diff)
downloadguix-patches-7ebed0cdc8043852bed7f5ca639f16bac30cc124.tar
guix-patches-7ebed0cdc8043852bed7f5ca639f16bac30cc124.tar.gz
gnu: Add weechat-matrix.
* gnu/packages/messaging.scm (weechat-matrix): New variable. Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
Diffstat (limited to 'gnu/packages/messaging.scm')
-rw-r--r--gnu/packages/messaging.scm69
1 files changed, 68 insertions, 1 deletions
diff --git a/gnu/packages/messaging.scm b/gnu/packages/messaging.scm
index f591078920..ee9bbc71fd 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>
@@ -2986,4 +2986,71 @@ API. Mattermost is not required.")
(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