diff options
author | W. Kosior <koszko@koszko.org> | 2024-07-13 12:08:41 +0200 |
---|---|---|
committer | W. Kosior <koszko@koszko.org> | 2024-09-04 21:02:10 +0200 |
commit | fbcb6b2d876a524163401c51462935a03223dfaa (patch) | |
tree | 8dac3bc4386294a912d457af8a67afe503e702af /gnu | |
parent | aa171ffcd40aee830e06b045c44b2ed51f413f95 (diff) | |
download | guix-fbcb6b2d876a524163401c51462935a03223dfaa.tar.gz guix-fbcb6b2d876a524163401c51462935a03223dfaa.zip |
gnu: Add epicyon.
* gnu/packages/python-web.scm (define-module): Use `(gnu packages
imagemagick)' and `(gnu packages/photo)' modules.
(epicyon): New variable.
Change-Id: I736cb955038659ee7c88fc2f3e1da198e3c9f70f
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/packages/python-web.scm | 164 |
1 files changed, 164 insertions, 0 deletions
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm index e02c0d8729..24fea79bf7 100644 --- a/gnu/packages/python-web.scm +++ b/gnu/packages/python-web.scm @@ -65,6 +65,9 @@ ;;; Copyright © 2024 Sharlatan Hellseher <sharlatanus@gmail.com> ;;; Copyright © 2024 normally_js <normally_js@posteo.net> ;;; Copyright © 2024 Markku Korkeala <markku.korkeala@iki.fi> +;;; Copyright © 2024 Wojtek Kosior <koszko@koszko.org> +;;; Additions and modifications by Wojtek Kosior are additionally +;;; dual-licensed under the Creative Commons Zero v1.0. ;;; Copyright © 2024 Nguyễn Gia Phong <mcsinyx@disroot.org> ;;; Copyright © 2024 Zheng Junjie <873216071@qq.com> ;;; @@ -110,12 +113,14 @@ #:use-module (gnu packages gnupg) #:use-module (gnu packages graphviz) #:use-module (gnu packages groff) + #:use-module (gnu packages imagemagick) #:use-module (gnu packages libevent) #:use-module (gnu packages libffi) #:use-module (gnu packages linux) #:use-module (gnu packages node) #:use-module (gnu packages openstack) #:use-module (gnu packages pcre) + #:use-module (gnu packages photo) #:use-module (gnu packages pkg-config) #:use-module (gnu packages protobuf) #:use-module (gnu packages python) @@ -5141,6 +5146,165 @@ this it tries to be opinion-free and very extendable.") server.") (license license:expat))) +(define-public epicyon + ;; The software is still in development but stopped making official releases + ;; after 1.3.0. + (let ((revision "0") + (commit "1b984f9a30d1e83c068bab357b3a08b409634341")) + (package + (name "epicyon") + (version (git-version "1.3.0" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/bashrc2/epicyon") + (commit commit))) + (file-name (string-append name "-" version)) + (sha256 + (base32 + "0ki2290rsc432cba30pmiv63iakdnz15ayy05sj9xgj9brjmxdqi")))) + (build-system pyproject-build-system) + (arguments + (list #:phases + #~(modify-phases %standard-phases + + (add-after 'unpack 'fix-requirements + (lambda _ + (substitute* '("setup.cfg") + ;; Loosen version requirements. + (("^(\\s+(cryptography|idna|pillow))([^\\S].*)?\n$" + _ dep) + (string-append dep "\n")) + ;; Fix name: `socks' -> `python-socks'. + (("^(\\s+)socks([^\\S].*)?\n$" _ ind) + (string-append ind "python-socks\n"))))) + + (add-after 'unpack 'add-missing-package-data + (lambda _ + (substitute* '("setup.cfg") + (("^(\\s)+\\*\\.txt\n$" all ind) + (string-append + ;; Epicyon's setup.cfg is outdated and the + ;; `[options.package_data]' section doesn't list some + ;; necessary data files/directories. We add the + ;; required missing ones here while omitting the ones + ;; not used by the daemon (`README*` files, + ;; directories `architecture/', `deploy/', `gemini/' + ;; and `scripts/', etc.). + all + ind "default_about.md\n" + ind "default_tos.md\n" + ind "cwlists/**\n" + ind "data/**\n" + ind "defaultwelcome/**\n" + ind "manual/**\n" + ind "ontology/**\n" + ind "specification/**\n"))))) + + (add-after 'unpack 'patch-program-names + (lambda* (#:key inputs #:allow-other-keys) + (let ((exiftool (assoc-ref inputs "perl-image-exiftool")) + (imagemagick (assoc-ref inputs "imagemagick"))) + (substitute* '("media.py" "person.py") + (("'(/usr/bin/)?(exiftool|convert|mogrify)" _ _ tool) + (format #f "'~a/bin/~a" + (if (string= tool "exiftool") + exiftool + imagemagick) + tool)))))) + + (add-after 'unpack 'add-epicyon-entry-point + (lambda _ + (define (append-to-file filename text) + (let ((port (open-file filename "a"))) + (display text port) + (close-port port))) + + (append-to-file "setup.cfg" " + +[options.entry_points] +console_scripts = + epicyon = epicyon:_guix_main +") + + (substitute* "epicyon.py" + (("^if __name__ == .__main__.:\n$") + "def _guix_main():\n")) + + ;; Some of the tests check if there are no unused + ;; functions, we need _guix_main() to be used somewhere + ;; besides the entry point. + (append-to-file "epicyon.py" " +if __name__ == '__main__': _guix_main() +"))) + + (add-after 'unpack 'skip-networked-test-during-build + (lambda _ + (substitute* "tests.py" + (("^(\\s+)print\\(.test_site_is_active.\\)\n$" all ind) + (string-append + all + ind "if os.environ['HOME'] == '/homeless-shelter':\n" + ind ind "print('...skipped...')\n" + ind ind "return\n"))))) + + (add-after 'install 'remove-useless-scripts + ;; Those are used for hosting through tor or i2p under a + ;; systemd-based distro. + (lambda _ + (for-each (lambda (script) + (delete-file (format #f "~a/bin/~a" + #$output script))) + '("i2p" "onion")))) + + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (invoke (format #f "~a/bin/epicyon" #$output) + "--tests"))))))) + (inputs (list imagemagick + perl-image-exiftool + python-cryptography + python-dateutil + python-django-timezone-field + python-idna + python-numpy + python-pillow + python-pypng + python-pyqrcode + python-requests + python-socks)) + (home-page "https://github.com/bashrc2/epicyon") + (synopsis + "A modern ActivityPub compliant server implementing both S2S and C2S +protocols.") + (description + "Epicyon is a Fediverse server suitable for self-hosting a small number +of accounts on low power systems. + +Key features: + +@itemize +@item Open standards: HTML, CSS, ActivityPub S2S and C2S, RSS, CalDAV. +@item Supports common web browsers and shell browsers. +@item Will not drain your mobile or laptop battery. +@item Customisable themes. It doesn't have to look bland. +@item Emoji reactions. +@item Geospatial hashtags. +@item Does not require much RAM, either on server or client. +@item Suitable for installation on single board computers. +@item No timeline algorithms. +@item No javascript. +@item No database. Data stored as ordinary files. +@item No fashionable web frameworks. \"Boring by design\". +@item No blockchain garbage. +@item Written in Python, with few dependencies. +@item AGPL license, which big tech hates. +@end itemize +") + (license license:agpl3+)))) + (define-public python-flask-migrate (package (name "python-flask-migrate") |