| 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2019, 2020, 2021 Efraim Flashner <efraim@flashner.co.il> |
| 3 | ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr> |
| 4 | ;;; |
| 5 | ;;; This file is part of GNU Guix. |
| 6 | ;;; |
| 7 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
| 8 | ;;; under the terms of the GNU General Public License as published by |
| 9 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
| 10 | ;;; your option) any later version. |
| 11 | ;;; |
| 12 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
| 13 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | ;;; GNU General Public License for more details. |
| 16 | ;;; |
| 17 | ;;; You should have received a copy of the GNU General Public License |
| 18 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 19 | |
| 20 | (define-module (gnu packages mastodon) |
| 21 | #:use-module (guix packages) |
| 22 | #:use-module (guix download) |
| 23 | #:use-module (guix git-download) |
| 24 | #:use-module (guix build-system meson) |
| 25 | #:use-module (guix build-system python) |
| 26 | #:use-module ((guix licenses) #:prefix license:) |
| 27 | #:use-module (gnu packages check) |
| 28 | #:use-module (gnu packages freedesktop) |
| 29 | #:use-module (gnu packages gettext) |
| 30 | #:use-module (gnu packages glib) |
| 31 | #:use-module (gnu packages gnome) |
| 32 | #:use-module (gnu packages gtk) |
| 33 | #:use-module (gnu packages pkg-config) |
| 34 | #:use-module (gnu packages python-check) |
| 35 | #:use-module (gnu packages python-crypto) |
| 36 | #:use-module (gnu packages python-web) |
| 37 | #:use-module (gnu packages python-xyz) |
| 38 | #:use-module (gnu packages time)) |
| 39 | |
| 40 | (define-public toot |
| 41 | (package |
| 42 | (name "toot") |
| 43 | (version "0.27.0") |
| 44 | (source |
| 45 | (origin |
| 46 | (method url-fetch) |
| 47 | (uri (pypi-uri "toot" version)) |
| 48 | (sha256 |
| 49 | (base32 "1mfbqmgna7046d134pc5qx1vyfd60vwcn0xr9lxzlmc5rjdbmz8x")))) |
| 50 | (build-system python-build-system) |
| 51 | (arguments |
| 52 | '(#:phases |
| 53 | (modify-phases %standard-phases |
| 54 | (replace 'check |
| 55 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 56 | (add-installed-pythonpath inputs outputs) |
| 57 | (invoke "py.test")))))) |
| 58 | (native-inputs |
| 59 | `(("python-pytest" ,python-pytest))) |
| 60 | (inputs |
| 61 | `(("python-beautifulsoup4" ,python-beautifulsoup4) |
| 62 | ("python-requests" ,python-requests) |
| 63 | ("python-urwid" ,python-urwid) |
| 64 | ("python-wcwidth" ,python-wcwidth))) |
| 65 | (home-page "https://github.com/ihabunek/toot/") |
| 66 | (synopsis "Mastodon CLI client") |
| 67 | (description "Interact with Mastodon social network from the command line. |
| 68 | Features include: |
| 69 | @itemize |
| 70 | @item Posting, replying, deleting statuses |
| 71 | @item Support for media uploads, spoiler text, sensitive content |
| 72 | @item Search by account or hash tag |
| 73 | @item Following, muting and blocking accounts |
| 74 | @item Simple switching between authenticated in Mastodon accounts |
| 75 | @end itemize") |
| 76 | (license license:gpl3))) |
| 77 | |
| 78 | (define-public tootle |
| 79 | (package |
| 80 | (name "tootle") |
| 81 | (version "1.0") |
| 82 | (source |
| 83 | (origin |
| 84 | (method git-fetch) |
| 85 | (uri (git-reference |
| 86 | (url "https://github.com/bleakgrey/tootle") |
| 87 | (commit version))) |
| 88 | (file-name (git-file-name name version)) |
| 89 | (sha256 |
| 90 | (base32 |
| 91 | "1nm57239mhdq462an6bnhdlijpijxmjs9mqbyirwxwa048d3n4rm")))) |
| 92 | (build-system meson-build-system) |
| 93 | (arguments |
| 94 | `(#:glib-or-gtk? #t |
| 95 | #:phases |
| 96 | (modify-phases %standard-phases |
| 97 | (add-after 'unpack 'skip-gtk-update-icon-cache |
| 98 | ;; Don't create 'icon-theme.cache'. |
| 99 | (lambda _ |
| 100 | (substitute* "meson/post_install.py" |
| 101 | (("gtk-update-icon-cache") "true")) |
| 102 | #t)) |
| 103 | (add-after 'unpack 'patch-source |
| 104 | (lambda _ |
| 105 | (substitute* "src/Dialogs/NewAccount.vala" |
| 106 | (("xdg-mime") (which "xdg-mime"))) |
| 107 | ;; Patch for building on glib < 2.64 |
| 108 | (substitute* "src/Build.vala" |
| 109 | (("(os_name = ).*" _ first) (string-append first "\"GNU\";\n")) |
| 110 | (("(os_ver = ).*" _ first) (string-append first "\"Guix\";\n")) |
| 111 | (("GLib.Environment.get_os_info.*") "\"unknown\";\n")) |
| 112 | #t)) |
| 113 | (add-after 'install 'symlink-package |
| 114 | (lambda* (#:key outputs #:allow-other-keys) |
| 115 | (symlink "com.github.bleakgrey.tootle" |
| 116 | (string-append (assoc-ref outputs "out") "/bin/tootle")) |
| 117 | #t))))) |
| 118 | (native-inputs |
| 119 | `(("gettext" ,gettext-minimal) |
| 120 | ("glib:bin" ,glib "bin") ; for glib-compile-resources |
| 121 | ("gsettings-desktop-schemas" ,gsettings-desktop-schemas) |
| 122 | ("pkg-config" ,pkg-config))) |
| 123 | (inputs |
| 124 | `(("glib-networking" ,glib-networking) |
| 125 | ("gtk+" ,gtk+) |
| 126 | ("json-glib" ,json-glib) |
| 127 | ("libgee" ,libgee) |
| 128 | ("libhandy" ,libhandy) |
| 129 | ("libsoup" ,libsoup) |
| 130 | ("vala" ,vala-0.50) |
| 131 | ("xdg-utils" ,xdg-utils))) |
| 132 | (home-page "https://github.com/bleakgrey/tootle") |
| 133 | (synopsis "GTK3 client for Mastodon") |
| 134 | (description "Tootle is a GTK client for Mastodon. It provides a clean, |
| 135 | native interface that allows you to integrate Mastodon's social experience |
| 136 | seamlessly with your desktop environment.") |
| 137 | (license license:gpl3+))) |
| 138 | |
| 139 | (define-public python-mastodon-py |
| 140 | (package |
| 141 | (name "python-mastodon-py") |
| 142 | (version "1.5.1") |
| 143 | (source |
| 144 | (origin |
| 145 | (method url-fetch) |
| 146 | (uri (pypi-uri "Mastodon.py" version)) |
| 147 | (sha256 |
| 148 | (base32 |
| 149 | "1vikvkzcij2gd730cssigxi38vlmzqmwdy58r3y2cwsxifnxpz9a")))) |
| 150 | (build-system python-build-system) |
| 151 | (propagated-inputs |
| 152 | `(("python-blurhash" ,python-blurhash) |
| 153 | ("python-dateutil" ,python-dateutil) |
| 154 | ("python-decorator" ,python-decorator) |
| 155 | ("python-magic" ,python-magic) |
| 156 | ("python-pytz" ,python-pytz) |
| 157 | ("python-requests" ,python-requests) |
| 158 | ("python-six" ,python-six))) |
| 159 | (native-inputs |
| 160 | `(("python-blurhash" ,python-blurhash) |
| 161 | ("python-cryptography" ,python-cryptography) |
| 162 | ("python-http-ece" ,python-http-ece) |
| 163 | ("python-pytest" ,python-pytest) |
| 164 | ("python-pytest-cov" ,python-pytest-cov) |
| 165 | ("python-pytest-mock" ,python-pytest-mock) |
| 166 | ("python-pytest-runner" ,python-pytest-runner) |
| 167 | ("python-pytest-vcr" ,python-pytest-vcr) |
| 168 | ("python-requests-mock" ,python-requests-mock) |
| 169 | ("python-vcrpy" ,python-vcrpy))) |
| 170 | (home-page "https://github.com/halcy/Mastodon.py") |
| 171 | (synopsis "Python wrapper for the Mastodon API") |
| 172 | (description |
| 173 | "This package provides a python wrapper for the Mastodon API.") |
| 174 | (license license:expat))) |