code:
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013 Joshua Grant <tadni@riseup.net>
;;; Copyright © 2014, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2017 Sou Bunnbu <iyzsong@gmail.com>
;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2017, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 L  p R n  d n <guix@lprndn.info>
;;; Copyright © 2020 Fredrik Salomonsson <plattfot@gmail.com>
;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
;;; Copyright © 2021 Zheng Junjie <873216071@qq.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages display-managers)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system cmake)
  #:use-module (guix build-system qt)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system trivial)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (gnu packages)
  #:use-module (gnu packages admin)
  #:use-module (gnu packages fontutils)
  #:use-module (gnu packages freedesktop)
  #:use-module (gnu packages gl)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages gnome)
  #:use-module (gnu packages gnupg)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages image)
  #:use-module (gnu packages kde-frameworks)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages python)
  #:use-module (gnu packages qt)
  #:use-module (gnu packages xdisorg)
  #:use-module (gnu packages xfce)
  #:use-module (gnu packages xorg))

(define-public sddm
  (package
    (name "sddm")
    (version "0.19.0")
    (source (origin
              (method url-fetch)
              (uri (string-append
                    "https://github.com/sddm/sddm"
                    "/releases/download/v" version "/"
                    "sddm-" version ".tar.xz"))
              (sha256
               (base32
                "0hcdysw8ibr66vk8i7v56l0v5ijvhlq67v4460mc2xf2910g2m72"))))
    (build-system qt-build-system)
    (native-inputs
     `(("extra-cmake-modules" ,extra-cmake-modules)
       ("pkg-config" ,pkg-config)
       ("qttools" ,qttools)))
    (inputs
     `(("elogind" ,elogind)
       ("glib" ,glib)
       ("libxcb" ,libxcb)
       ("libxkbcommon" ,libxkbcommon)
       ("linux-pam" ,linux-pam)
       ("qtbase" ,qtbase-5)
       ("qtdeclarative" ,qtdeclarative)

       ;; Some user-defined themes use QtQuick components internally.  Adding
       ;; QtQuick & co. here; they end up in QML2_IMPORT_PATH thanks to
       ;; 'wrap-qt-program'.
       ("qtgraphicaleffects" ,qtgraphicaleffects)
       ("qtquickcontrols" ,qtquickcontrols)
       ("qtquickcontrols2" ,qtquickcontrols2)
       ("qtsvg" ,qtsvg)

       ("shadow" ,shadow)
       ("wayland" ,wayland)))
    (arguments
     `(#:configure-flags
       (list
        ;; This option currently does nothing, but will presumably be enabled
        ;; if/when <https://github.com/sddm/sddm/pull/616> is merged.
        "-DENABLE_WAYLAND=ON"
        "-DENABLE_PAM=ON"
        ;; Both flags are required for elogind support.
        "-DNO_SYSTEMD=ON" "-DUSE_ELOGIND=ON"
        "-DCONFIG_FILE=/etc/sddm.conf"
        ;; Set path to /etc/login.defs.
        ;; An alternative would be to use -DUID_MIN and -DUID_MAX.
        (string-append "-DLOGIN_DEFS_PATH="
                       (assoc-ref %build-inputs "shadow")
                       "/etc/login.defs")
        (string-append "-DQT_IMPORTS_DIR="
                       (assoc-ref %outputs "out") "/lib/qt5/qml")
        (string-append "-DCMAKE_INSTALL_SYSCONFDIR="
                       (assoc-ref %outputs "out") "/etc"))
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'embed-loginctl-reference
           (lambda _
             (substitute* "CMakeLists.txt"
               (("/usr/bin/loginctl") (which "loginctl")))
               #t)))))
    (synopsis "QML based X11 and Wayland display manager")
    (description "SDDM is a display manager for X11 and Wayland aiming to be
fast, simple and beautiful.  SDDM is themeable and puts no restrictions on the
user interface design.  It uses QtQuick which gives the designer the ability to
create smooth, animated user interfaces.")
    (home-page "https://github.com/sddm/sddm")
    ;; QML files are MIT licensed and images are CC BY 3.0.
    (license (list license:gpl2+ license:expat license:cc-by3.0))))

(define-public guix-simplyblack-sddm-theme
  (package
    (name "guix-simplyblack-sddm-theme")
    (version "0.1")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/plattfot/guix-simplyblack-sddm")
                    (commit version)))
              (file-name (git-file-name name version))
              (sha256
               (base32 "1fwny6b0xpjs8ad2b16pyxd27gf0sr0nillmhc2h5k0q7dva21vi"))))
    (build-system trivial-build-system)
    (arguments
     `(#:modules ((guix build utils))
       #:builder
       (begin
         (use-modules (guix build utils))
         (let* ((out (assoc-ref %outputs "out"))
                (sddm-themes (string-append out "/share/sddm/themes")))
           (mkdir-p sddm-themes)
           (copy-recursively (assoc-ref %build-inputs "source")
                             (string-append sddm-themes "/guix-simplyblack-sddm"))))))
    (home-page "https://github.com/plattfot/guix-simplyblack-sddm")
    (synopsis "Guix based theme for SDDM")
    (description
     "This package provides a simple theme for SDDM, black background with
Guix's logo.  Based on Arch linux's archlinux-simplyblack theme.")
    ;; Theme under cc-by-sa3.0, guix logo under license:cc-by-sa4.0
    (license (list license:cc-by-sa3.0 license:cc-by-sa4.0))))

(define-public chili-sddm-theme
  (package
    (name "chili-sddm-theme")
    (version "0.1.5")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/MarianArlt/sddm-chili")
                    (commit version)))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "036fxsa7m8ymmp3p40z671z163y6fcsa9a641lrxdrw225ssq5f3"))))
    (build-system trivial-build-system)
    (arguments
     `(#:modules ((guix build utils))
       #:builder
       (begin
         (use-modules (guix build utils))
         (let* ((out (assoc-ref %outputs "out"))
                (sddm-themes (string-append out "/share/sddm/themes")))
           (mkdir-p sddm-themes)
           (copy-recursively (assoc-ref %build-inputs "source")
                             (string-append sddm-themes "/chili"))))))
    (home-page "https://github.com/MarianArlt/sddm-chili")
    (synopsis "Chili theme for SDDM")
    (description "Chili reduces all the clutter and leaves you with a clean,
easy to use, login interface with a modern yet classy touch.")
    (license license:gpl3+)))

(define-public lightdm
  (package
    (name "lightdm")
    (version "1.30.0")
    (source (origin
              (method url-fetch)
              (uri (string-append
                    "https://github.com/CanonicalLtd/lightdm/releases/download/"
                    version "/lightdm-" version ".tar.xz"))
              (sha256
               (base32
                "158zb2d0v1309a8v19hh32y4yj3v6yg4yg6m0l7v59d3a2b7f651"))))
    (build-system gnu-build-system)
    (arguments
     '(#:parallel-tests? #f ; fails when run in parallel
       #:configure-flags
       (list "--localstatedir=/var")
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'fix-paths
           (lambda _
             (substitute* "src/shared-data-manager.c"
               (("/bin/rm") (which "rm")))
             (substitute* '("data/users.conf"
                            "common/user-list.c")
               (("/bin/false") (which "false"))
               (("/usr/sbin/nologin") (which "nologin")))
             (substitute* "src/seat.c"
               (("/bin/sh") (which "sh")))
             #t))
         (add-before 'check 'pre-check
           ;; Run test-suite under a dbus session.
           (lambda* (#:key inputs #:allow-other-keys)
             (wrap-program "tests/src/test-python-greeter"
               `("PYTHONPATH"      ":" prefix (,(getenv "PYTHONPATH")))
               `("GI_TYPELIB_PATH" ":" prefix (,(getenv "GI_TYPELIB_PATH"))))

             ;; Avoid printing locale warnings, which trip up the text
             ;; matching tests.
             (unsetenv "LC_ALL")
             #t)))))
    (inputs
     `(("audit" ,audit)
       ("linux-pam" ,linux-pam)
       ("shadow" ,shadow)                         ;for sbin/nologin
       ("libgcrypt" ,libgcrypt)
       ("libxcb" ,libxcb)))
    (native-inputs
     `(("gobject-introspection" ,gobject-introspection)
       ("pkg-config" ,pkg-config)
       ("itstool" ,itstool)
       ("intltool" ,intltool)
       ("vala" ,vala)                   ;for Vala bindings
       ;; For tests
       ("dbus" ,dbus)
       ("python" ,python-2)
       ("python-pygobject" ,python2-pygobject)))
    ;; Required by liblightdm-gobject-1.pc.
    (propagated-inputs
     `(("glib" ,glib)
       ("libx11" ,libx11)
       ("libxklavier" ,libxklavier)))
    (home-page "https://www.freedesktop.org/wiki/Software/LightDM/")
    (synopsis "Lightweight display manager")
    (description "The Light Display Manager (LightDM) is a cross-desktop
display manager which supports different greeters.")
    (license license:gpl3+)))

(define-public lightdm-gtk-greeter
  (package
    (name "lightdm-gtk-greeter")
    (version "2.0.7")
    (source (origin
              (method url-fetch)
              (uri (string-append
                    "https://launchpad.net/lightdm-gtk-greeter/"
                    (version-major+minor version) "/" version
                    "/+download/lightdm-gtk-greeter-" version ".tar.gz"))
              (sha256
               (base32
                "1g7wc3d3vqfa7mrdhx1w9ywydgjbffla6rbrxq9k3sc62br97qms"))))
    (build-system gnu-build-system)
    (arguments
     `(#:configure-flags
       (list (string-append "--enable-at-spi-command="
                            (assoc-ref %build-inputs "at-spi2-core")
                            "/libexec/at-spi-bus-launcher"))
       #:phases
       (modify-phases %standard-phases
         (add-after 'install 'fix-.desktop-file
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
               (substitute* (string-append
                             out "/share/xgreeters/lightdm-gtk-greeter.desktop")
                 (("Exec=lightdm-gtk-greeter")
                  (string-append "Exec=" out "/sbin/lightdm-gtk-greeter")))
               #t)))
         (add-after 'fix-.desktop-file 'wrap-program
           ;; Mimic glib-or-gtk build system
           ;; which doesn't wrap files in /sbin
           (lambda* (#:key outputs inputs #:allow-other-keys)
             (let ((gtk (assoc-ref inputs "gtk+")))
               (wrap-program (string-append (assoc-ref outputs "out")
                                            "/sbin/lightdm-gtk-greeter")
                 `("XDG_DATA_DIRS" ":" prefix
                   ,(cons "/run/current-system/profile/share"
                          (map (lambda (pkg)
                                 (string-append (assoc-ref inputs pkg) "/share"))
                               '("gtk+" "shared-mime-info" "glib"))))
                 `("GTK_PATH" ":" prefix (,gtk))
                 `("GIO_EXTRA_MODULES" ":" prefix (,gtk))))
             #t)))))
    (native-inputs
     `(("exo" ,exo)
       ("intltool" ,intltool)
       ("pkg-config" ,pkg-config)))
    (inputs
     `(("lightdm" ,lightdm)
       ("shared-mime-info" ,shared-mime-info)
       ("at-spi2-core" ,at-spi2-core)
       ("gtk+" ,gtk+)))
    (synopsis "GTK+ greeter for LightDM")
    (home-page "https://launchpad.net/lightdm-gtk-greeter")
    (description "This package provides a LightDM greeter implementation using
GTK+, lets you select a desktop session and log in to it.")
    (license license:gpl3+)))

(define-public slim
  (package
    (name "slim")
    (version "1.3.6")
    (source (origin
	     (method url-fetch)
             ;; Used to be available from download.berlios.de.
	     (uri (string-append
                   "mirror://sourceforge/slim.berlios/slim-"
                   version ".tar.gz"))
	     (sha256
	      (base32 "1pqhk22jb4aja4hkrm7rjgbgzjyh7i4zswdgf5nw862l2znzxpi1"))
             (patches (search-patches "slim-config.patch"
                                      "slim-reset.patch"
                                      "slim-login.patch"
                                      "slim-session.patch"
                                      "slim-sigusr1.patch"
                                      "slim-display.patch"))))
    (build-system cmake-build-system)
    (inputs `(("linux-pam" ,linux-pam)
	      ("libpng" ,libpng)
	      ("libjpeg" ,libjpeg-turbo)
	      ("freeglut" ,freeglut)
	      ("libxrandr" ,libxrandr)
	      ("libxrender" ,libxrender)
	      ("freetype" ,freetype)
	      ("fontconfig" ,fontconfig)
              ("libx11" ,libx11)
	      ("libxft" ,libxft)
	      ("libxmu" ,libxmu)
	      ("xauth" ,xauth)))
    (native-inputs
     `(("pkg-config" ,pkg-config)))
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (add-before 'configure 'set-new-etc-location
           (lambda _
             (substitute* "CMakeLists.txt"
               (("/etc")
                (string-append (assoc-ref %outputs "out") "/etc"))
               (("install.*systemd.*")
               ;; The build system's logic here is: if "Linux", then
                ;; "systemd".  Strip that.
                ""))
             #t)))
       #:configure-flags '("-DUSE_PAM=yes"
                           "-DUSE_CONSOLEKIT=no")
       #:tests? #f))

    ;; This used to be at <http://slim.berlios.de/>.
    (home-page "https://sourceforge.net/projects/slim.berlios/")
    (synopsis "Desktop-independent graphical login manager for X11")
    (description
     "SLiM is a Desktop-independent graphical login manager for X11, derived
from Login.app.  It aims to be light and simple, although completely
configurable through themes and an option file; is suitable for machines on
which remote login functionalities are not needed.

Features included: PNG and XFT support for alpha transparency and antialiased
fonts, External themes support, Configurable runtime options: X server --
login / shutdown / reboot commands, Single (GDM-like) or double (XDM-like)
input control, Can load predefined user at startup, Configurable welcome /
shutdown messages, Random theme selection.")
    (license license:gpl2)))


code:
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019 Brant Gardner <brantcgardner@brantware.com>
;;; Copyright © 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages distributed)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system gnu)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (gnu packages)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages base)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages curl)
  #:use-module (gnu packages wxwidgets)
  #:use-module (gnu packages gnome)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages sqlite)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-xyz))

(define-public boinc-client
  (package
    (name "boinc-client")
    (version "7.16.17")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/boinc/boinc")
                    (commit (string-append "client_release/"
                                           (version-major+minor version)
                                           "/" version))))
              (file-name (git-file-name "boinc" version))
              (sha256
               (base32
                "1p8y3mnf5yfhavhqxwf9v68prg1601h8q1pllm5z89zh661di3mj"))))
    (build-system gnu-build-system)
    (arguments '(#:configure-flags '("--disable-server")))
    (inputs `(("openssl" ,openssl)
              ("curl" ,curl)
              ("wxwidgets" ,wxwidgets)
              ("gtk+" ,gtk+)
              ("gdk-pixbuf" ,gdk-pixbuf)
              ("libnotify" ,libnotify)
              ("sqlite" ,sqlite)
              ("python" ,python)
              ("python-pyserial" ,python-pyserial)))
    (native-inputs
     `(("autoconf" ,autoconf)
       ("automake" ,automake)
       ("libtool" ,libtool)
       ("pkg-config" ,pkg-config)))
    (synopsis "Help cutting-edge science research using your computer")
    (description "BOINC is a platform for high-throughput computing on a large
scale (thousands or millions of computers).  It can be used for volunteer
computing (using consumer devices) or grid computing (using organizational
resources).  It supports virtualized, parallel, and GPU-based applications.")
    (home-page "https://boinc.berkeley.edu/")
    ;; BOINC is distributed as LGPL3+, with some individual modules under GPL3+.
    (license (list license:lgpl3+ license:gpl3+))))

(define-public boinc-server
  ;; XXX The server and client packages duplicate many files such as /lib.
  ;; TODO: consolidate them?
  (package (inherit boinc-client)
    (name "boinc-server")
    (arguments '(#:configure-flags '("--disable-client" "--disable-manager")
                 #:parallel-build? #f))
    (inputs `(("openssl" ,openssl)
              ("curl" ,curl)
              ("mariadb:dev" ,mariadb "dev")
              ("zlib" ,zlib)))
    (propagated-inputs `(("python" ,python-wrapper)
                         ("perl" ,perl)))))

repo_name: maximed/guix

license: mit


code:
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; Copyright © 2016, 2019, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2017 Nikita <nikita@n0.is>
;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2018 Vijayalakshmi Vedantham <vijimay12@gmail.com>
;;; Copyright © 2019 Sam <smbaines8@gmail.com>
;;; Copyright © 2020, 2021 Marius Bakke <marius@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages django)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system python)
  #:use-module (gnu packages)
  #:use-module (gnu packages base)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages check)
  #:use-module (gnu packages geo)
  #:use-module (gnu packages openldap)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-compression)
  #:use-module (gnu packages python-crypto)
  #:use-module (gnu packages python-web)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages sphinx)
  #:use-module (gnu packages time)
  #:use-module (gnu packages xml))

(define-public python-django
  (package
    (name "python-django")
    (version "3.2.4")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "Django" version))
              (sha256
               (base32
                "15pjwyvrx4n8gi8n51b14wp54bg4jqapr25p52597zn6ikdxijb6"))))
    (build-system python-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (add-before 'check 'pre-check
           (lambda* (#:key inputs #:allow-other-keys)
             ;; The test-suite tests timezone-dependent functions, thus tzdata
             ;; needs to be available.
             (setenv "TZDIR"
                     (string-append (assoc-ref inputs "tzdata")
                                    "/share/zoneinfo"))

             ;; Disable test for incorrect timezone: it only raises the
             ;; expected error when /usr/share/zoneinfo exists, even though
             ;; the machinery gracefully falls back to TZDIR.  According to
             ;; django/conf/__init__.py, lack of /usr/share/zoneinfo is
             ;; harmless, so just ignore this test.
             (substitute* "tests/settings_tests/tests.py"
               ((".*def test_incorrect_timezone.*" all)
                (string-append "    @unittest.skipIf(True, 'Disabled by Guix')\n"
                               all)))

             ;; Preserve the PYTHONPATH created by Guix when running the tests.
             (substitute* "tests/admin_scripts/tests.py"
               (("python_path = \\[")
                (string-append "python_path = ['"
                               (string-join
                                (string-split (getenv "PYTHONPATH") #\:)
                                "','")
                               "', ")))

             #t))
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (if tests?
                 (with-directory-excursion "tests"
                   (setenv "PYTHONPATH"
                           (string-append "..:" (getenv "PYTHONPATH")))
                   (invoke "python" "runtests.py"
                           ;; By default tests run in parallel, which may cause
                           ;; various race conditions.  Run sequentially for
                           ;; consistent results.
                           "--parallel=1"))
                 (format #t "test suite not run~%"))))
         ;; XXX: The 'wrap' phase adds native inputs as runtime dependencies,
         ;; see <https://bugs.gnu.org/25235>.  The django-admin script typically
         ;; runs in an environment that has Django and its dependencies on
         ;; PYTHONPATH, so just disable the wrapper to reduce the size from
         ;; ~710 MiB to ~203 MiB.
         (delete 'wrap))))
    ;; TODO: Install extras/django_bash_completion.
    (native-inputs
     `(("tzdata" ,tzdata-for-tests)
       ;; Remaining packages are test requirements taken from
       ;; tests/requirements/py3.txt
       ("python-docutils" ,python-docutils)
       ;; optional for tests: ("python-geoip2" ,python-geoip2)
       ;; optional for tests: ("python-memcached" ,python-memcached)
       ("python-numpy" ,python-numpy)
       ("python-pillow" ,python-pillow)
       ("python-pyyaml" ,python-pyyaml)
       ;; optional for tests: ("python-selenium" ,python-selenium)
       ("python-tblib" ,python-tblib)))
    (propagated-inputs
     `(("python-asgiref" ,python-asgiref)
       ("python-pytz" ,python-pytz)
       ("python-sqlparse" ,python-sqlparse)

       ;; Optional dependencies.
       ("python-argon2-cffi" ,python-argon2-cffi)
       ("python-bcrypt" ,python-bcrypt)

       ;; This input is not strictly required, but in practice many Django
       ;; libraries need it for test suites and similar.
       ("python-jinja2" ,python-jinja2)))
    (home-page "https://www.djangoproject.com/")
    (synopsis "High-level Python Web framework")
    (description
     "Django is a high-level Python Web framework that encourages rapid
development and clean, pragmatic design.  It provides many tools for building
any Web site.  Django focuses on automating as much as possible and adhering
to the @dfn{don't repeat yourself} (DRY) principle.")
    (license license:bsd-3)
    (properties `((cpe-name . "django")))))

(define-public python-django-2.2
  (package
    (inherit python-django)
    (version "2.2.24")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "Django" version))
              (sha256
               (base32
                "1dvx3x85lggm91x7mpvaf9nmpxyz7r97pbpnmr2k1qfy0c7gyf9k"))))
    (native-inputs
     `(;; XXX: In 2.2 and 3.0, selenium is required for the test suite.
       ("python-selenium" ,python-selenium)
       ,@(package-native-inputs python-django)))))

(define-public python-django-extensions
  (package
    (name "python-django-extensions")
    (version "3.0.6")
    (source
     (origin
       (method git-fetch)
       ;; Fetch from the git repository, so that the tests can be run.
       (uri (git-reference
             (url "https://github.com/django-extensions/django-extensions")
             (commit version)))
       (file-name (string-append name "-" version))
       (sha256
        (base32
         "0sra6hazqvspxd1pnx5cj7gia1rkaz3hn06ib4wd0frc167f5afy"))))
    (build-system python-build-system)
    (arguments
     '(#:tests? #f)) ;XXX: requires a Postgres or MySQL database
    (propagated-inputs
     `(("python-six" ,python-six)
       ("python-vobject" ,python-vobject)
       ("python-werkzeug" ,python-werkzeug)
       ("python-dateutil" ,python-dateutil)))
    (native-inputs
     `(("python-django" ,python-django)
       ("python-mock" ,python-mock)
       ("python-factory-boy" ,python-factory-boy)
       ("python-tox" ,python-tox)
       ("python-pytest" ,python-pytest)
       ("python-pytest-cov" ,python-pytest-cov)
       ("python-pytest-django" ,python-pytest-django)
       ("python-shortuuid" , python-shortuuid)))
    (home-page
     "https://github.com/django-extensions/django-extensions")
    (synopsis "Custom management extensions for Django")
    (description
     "Django-extensions extends Django providing, for example, management
commands, additional database fields and admin extensions.")
    (license license:expat)))

(define-public python-django-simple-math-captcha
  (package
    (name "python-django-simple-math-captcha")
    (version "1.0.9")
    (home-page "https://github.com/alsoicode/django-simple-math-captcha")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url home-page)
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0fhy9k8haqa1296v0qpg1b5w7y3pyw9qi9z9laj5ijry1gk35qaw"))))
    (build-system python-build-system)
    (arguments
     '(#:phases (modify-phases %standard-phases
                  (add-after 'unpack 'patch-six-imports
                    (lambda _
                      ;; Django no longer bundles six, adjust the imports
                      ;; accordingly.  The six dependency can likely be
                      ;; removed in the next version.
                      (substitute* (find-files "." "\\.py$")
                        (("from django\\.utils import six")
                         "import six"))
                      #t))
                  (replace 'check
                    (lambda _
                      (invoke "python" "runtests.py"))))))
    (native-inputs
     `(("python-django" ,python-django)
       ("python-mock" ,python-mock)))
    (propagated-inputs
     `(("python-six" ,python-six)))
    (synopsis "Easy-to-use math field/widget captcha for Django forms")
    (description
     "A multi-value-field that presents a human answerable question,
with no settings.py configuration necessary, but instead can be configured
with arguments to the field constructor.")
    (license license:asl2.0)))

(define-public python-django-classy-tags
  (package
    (name "python-django-classy-tags")
    (version "2.0.0")
    (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "django-classy-tags" version))
        (sha256
         (base32
          "1javam3zqi3y3j0r490mm61v48yh75jaha99gb7lsxkaz6yri7fm"))))
    (build-system python-build-system)
    ;; FIXME: How to make the test templates available to Django?
    (arguments '(#:tests? #f))
    (home-page "https://github.com/divio/django-classy-tags")
    (synopsis "Class based template tags for Django")
    (description
     "@code{django-classy-tags} is an approach at making writing template tags
in Django easier, shorter and more fun.  It provides an extensible argument
parser which reduces most of the boiler plate code you usually have to write
when coding custom template tags.")
    (license license:bsd-3)))

(define-public python-django-taggit
  (package
    (name "python-django-taggit")
    (version "1.3.0")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "django-taggit" version))
       (sha256
        (base32
         "0bbkabbs77z229ps0800gxfhf75yagp4x4j5jzfysbac3zvkp0sa"))))
    (build-system python-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (invoke "python3" "-m" "django" "test" "--settings=tests.settings"))))))
    (propagated-inputs
     `(("python-isort" ,python-isort)))
    (native-inputs
     `(("python-django" ,python-django)
       ("python-pytest" ,python-pytest)
       ("python-mock" ,python-mock)))
    (home-page
     "https://github.com/jazzband/django-taggit")
    (synopsis
     "Reusable Django application for simple tagging")
    (description
     "Django-taggit is a reusable Django application for simple tagging.")
    (license license:bsd-3)))

(define-public python-easy-thumbnails
  (package
    (name "python-easy-thumbnails")
    (version "2.7")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "easy-thumbnails" version))
       (sha256
        (base32
         "14gzp5cv24z0qhxb7f7k7v9jgzpaj4n8yhjq83ynpx8183fs1rz4"))))
    (build-system python-build-system)
    (native-inputs
     `(("python-django" ,python-django)))
    (propagated-inputs
     `(("python-pillow" ,python-pillow)))
    (home-page "https://github.com/SmileyChris/easy-thumbnails")
    (synopsis "Easy thumbnails for Django")
    (description
     "Easy thumbnails is a Django plugin to dynamically create thumbnails
based on source images.  Multiple thumbnails can be created from a single
source image, using different options to control parameters like the image
size and quality.")
    (license license:bsd-3)))

(define-public python-pytest-django
  (package
    (name "python-pytest-django")
    (version "3.10.0")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "pytest-django" version))
              (sha256
               (base32
                "19nvqsb7b9kz3ikpb50m8ppf7mfhzrapdxsqd5hhd1pdfz8dprjd"))))
    (build-system python-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda* (#:key tests? inputs outputs #:allow-other-keys)
             (if tests?
                 (begin
                   (add-installed-pythonpath inputs outputs)
                   (setenv "PYTHONPATH"
                           (string-append ".:" ;for pytest_django_test
                                          (getenv "PYTHONPATH")))
                   (setenv "PYTEST_DJANGO_TEST_RUNNER" "pytest")
                   (setenv "DJANGO_SETTINGS_MODULE"
                           "pytest_django_test.settings_sqlite_file")
                   (invoke "pytest" "-vv" "-k"
                           ;; FIXME: these tests fail to locate Django templates ...
                           (string-append "not test_django_not_loaded_without_settings"
                                          " and not test_settings"
                                          ;; ... and this does not discover
                                          ;; 'pytest_django_test'.
                                          " and not test_urls_cache_is_cleared")))
                 (format #t "test suite not run~%"))
             #t)))))
    (native-inputs
     `(("python-django" ,python-django)
       ("python-setuptools-scm" ,python-setuptools-scm)

       ;; For tests.
       ("python-pytest-xdist" ,python-pytest-xdist)))
    (propagated-inputs
     `(("python-pytest" ,python-pytest-6)))
    (home-page "https://pytest-django.readthedocs.org/")
    (synopsis "Django plugin for py.test")
    (description "Pytest-django is a plugin for py.test that provides a set of
useful tools for testing Django applications and projects.")
    (license license:bsd-3)))

(define-public python-django-haystack
  (package
    (name "python-django-haystack")
    (version "2.8.1")
    (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "django-haystack" version))
        (sha256
         (base32
          "1302fqsrx8w474xk5cmnmg3hjqfprlxnjg9qlg86arsr4v4vqm4b"))))
    (build-system python-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'loosen-verion-restrictions
           (lambda _
             (substitute* "setup.py"
               (("geopy.*") "geopy',\n"))
             #t))
         (add-before 'check 'set-gdal-lib-path
           (lambda* (#:key inputs #:allow-other-keys)
             (setenv "GDAL_LIBRARY_PATH"
                     (string-append (assoc-ref inputs "gdal")
                                    "/lib"))
             #t)))
       #:tests? #f)) ; OSError: libgdal.so.27: cannot open shared object file
    (native-inputs
     `(("gdal" ,gdal)
       ("python-coverage" ,python-coverage)
       ("python-django" ,python-django)
       ("python-dateutil" ,python-dateutil)
       ("python-geopy" ,python-geopy)
       ("python-mock" ,python-mock)
       ("python-nose" ,python-nose)
       ("python-requests" ,python-requests)
       ("python-setuptools-scm" ,python-setuptools-scm)
       ("python-pysolr" ,python-pysolr)
       ("python-whoosh" ,python-whoosh)))
    (home-page "http://haystacksearch.org/")
    (synopsis "Pluggable search for Django")
    (description "Haystack provides modular search for Django.  It features a
unified, familiar API that allows you to plug in different search backends
(such as Solr, Elasticsearch, Whoosh, Xapian, etc.) without having to modify
your code.")
    (license license:bsd-3)))

(define-public python-django-filter
  (package
    (name "python-django-filter")
    (version "2.3.0")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "django-filter" version))
              (sha256
               (base32
                "1bz5qzdk9pk4a2lp2yacrdnqmkv24vxnz4k3lykrnpc3b7bkvrhi"))))
    (build-system python-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (invoke "python" "runtests.py"))))))
    (native-inputs
     `(("python-django" ,python-django)
       ("python-djangorestframework" ,python-djangorestframework)
       ("python-django-crispy-forms" ,python-django-crispy-forms)
       ("python-mock" ,python-mock)))
    (home-page "https://django-filter.readthedocs.io/en/latest/")
    (synopsis "Reusable Django application to filter querysets dynamically")
    (description
     "Django-filter is a generic, reusable application to alleviate writing
some of the more mundane bits of view code.  Specifically, it allows users to
filter down a queryset based on a model’s fields, displaying the form to let
them do this.")
    (license license:bsd-3)))

(define-public python-django-allauth
  (package
    (name "python-django-allauth")
    (version "0.42.0")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "django-allauth" version))
       (sha256
        (base32
         "0c0x8izvrnjhrr48w6pwsfk9ddbi6yfxg7v3hh5dm1vz1d0hjwpi"))))
    (build-system python-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (setenv "DJANGO_SETTINGS_MODULE" "test_settings")
             (invoke "django-admin" "test" "allauth.tests"
                     "--pythonpath=."))))))
    (propagated-inputs
     `(("python-openid" ,python-openid)
       ("python-requests" ,python-requests)
       ("python-requests-oauthlib" ,python-requests-oauthlib)))
    (native-inputs
     `(("python-django" ,python-django)
       ("python-mock" ,python-mock)))
    (home-page "https://github.com/pennersr/django-allauth")
    (synopsis "Set of Django applications addressing authentication")
    (description
     "Integrated set of Django applications addressing authentication,
registration, account management as well as 3rd party (social)
account authentication.")
    (license license:expat)))

(define-public python-django-debug-toolbar
  (package
    (name "python-django-debug-toolbar")
    (version "3.2.1")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/jazzband/django-debug-toolbar")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1m1j2sx7q0blma0miswj3c8hrfi5q4y5cq2b816v8gagy89xgc57"))))
    (build-system python-build-system)
    (propagated-inputs
     `(("python-sqlparse" ,python-sqlparse)))
    (native-inputs
     `(("python-django" ,python-django)
       ("python-django-jinja" ,python-django-jinja)
       ("python-html5lib" ,python-html5lib)))
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (invoke "make" "test"))))))
    (home-page
     "https://github.com/jazzband/django-debug-toolbar")
    (synopsis "Toolbar to help with developing Django applications")
    (description
     "A configurable set of panels that display information about the current
request and response as a toolbar on the rendered page.")
    (license license:bsd-3)))

(define-public python-django-debug-toolbar-alchemy
  (package
    (name "python-django-debug-toolbar-alchemy")
    (version "0.1.5")
    (home-page "https://github.com/miki725/django-debug-toolbar-alchemy")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "django-debug-toolbar-alchemy" version))
              (sha256
               (base32
                "1kmpzghnsc247bc1dl22s4y62k9ijgy1pjms227018h5a4frsa5b"))))
    (build-system python-build-system)
    (arguments '(#:tests? #f))          ;XXX: 'make check' does "echo TODO"
    (propagated-inputs
     `(("python-django-debug-toolbar" ,python-django-debug-toolbar)
       ("python-jsonplus" ,python-jsonplus)
       ("python-six" ,python-six)
       ("python-sqlalchemy" ,python-sqlalchemy)))
    (synopsis "Django Debug Toolbar panel for SQLAlchemy")
    (description
     "This package completely mimics the default Django Debug Toolbar SQL
panel (internally it is actually subclassed), but instead of displaying
queries done via the Django ORM, SQLAlchemy generated queries are displayed.")
    (license license:expat)))

(define-public python-django-gravatar2
  (package
    (name "python-django-gravatar2")
    (version "1.4.4")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "django-gravatar2" version))
       (sha256
        (base32
         "1vn921fb6jjx7rf5dzhy66rkb71nwmh9ydd0xs9ys72icw4jh4y8"))))
    (build-system python-build-system)
    (arguments
     '(;; TODO: The django project for the tests is missing from the release.
       #:tests? #f))
    (inputs
     `(("python-django" ,python-django)))
    (home-page "https://github.com/twaddington/django-gravatar")
    (synopsis "Gravatar support for Django, improved version")
    (description
     "Essential Gravatar support for Django.  Features helper methods,
templatetags and a full test suite.")
    (license license:expat)))

(define-public python-django-assets
  (package
    (name "python-django-assets")
    (version "2.0")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "django-assets" version))
              (sha256
               (base32
                "0fc6i77faxxv1gjlp06lv3kw64b5bhdiypaygfxh5djddgk83fwa"))))
    (build-system python-build-system)
    (native-inputs
     `(("python-django" ,python-django)
       ("python-nose" ,python-nose)))
    (propagated-inputs
     `(("python-webassets" ,python-webassets)))
    (home-page "https://github.com/miracle2k/django-assets")
    (synopsis "Asset management for Django")
    (description
      "Asset management for Django, to compress and merge CSS and Javascript
files.  Integrates the webassets library with Django, adding support for
merging, minifying and compiling CSS and Javascript files.")
    (license license:bsd-2)))

(define-public python-django-jinja
  (package
    (name "python-django-jinja")
    (version "2.6.0")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/niwinz/django-jinja")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "06ldbkfkm6sc0p9sqpjph06gxrqpj78ih3dc2yik2fcba2y5mak1"))))
    (build-system python-build-system)
    (propagated-inputs
     `(("python-jinja2" ,python-jinja2)
       ("python-pytz" ,python-pytz)
       ("python-django-pipeline" ,python-django-pipeline)))
    (arguments
     '(;; TODO Tests currently fail due to issues with the configuration for
       ;; django-pipeline
       #:tests? #f
       #:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (or
              (not tests?)
              (with-directory-excursion "testing"
                (invoke "python" "runtests.py"))))))))
    (home-page
     "https://niwinz.github.io/django-jinja/latest/")
    (synopsis "Simple jinja2 templating backend for Django")
    (description
     "This package provides a templating backend for Django, using Jinja2.  It
provides certain advantages over the builtin Jinja2 backend in Django, for
example, explicit calls to callables from templates and better performance.")
    (license license:bsd-3)))

;; JSONField is now built-in to Django, obsoleting this package.
(define-public python-django-jsonfield
  (deprecated-package "python-django-jsonfield" python-django))

(define-public python-dj-database-url
  (package
    (name "python-dj-database-url")
    (version "0.5.0")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "dj-database-url" version))
              (sha256
               (base32
                "0qs16g5y3lflxibsl8gwkwap21crhmmv98l60rdq6x1wawgypsja"))))
    (build-system python-build-system)
    (home-page "https://github.com/kennethreitz/dj-database-url")
    (synopsis "Use Database URLs in your Django Application")
    (description
      "This simple Django utility allows you to utilize the 12factor inspired
DATABASE_URL environment variable to configure your Django application.

The dj_database_url.config method returns a Django database connection
dictionary, populated with all the data specified in your URL.  There is also a
conn_max_age argument to easily enable Django’s connection pool.")
    (license license:bsd-2)))

(define-public python-django-picklefield
  (package
    (name "python-django-picklefield")
    (version "3.0.1")
    (home-page "https://github.com/gintas/django-picklefield")
    ;; Use a git checkout because the PyPI release lacks tests.
    (source
      (origin
        (method git-fetch)
        (uri (git-reference
              (url home-page)
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
         (base32
          "0ni7bc86k0ra4pc8zv451pzlpkhs1nyil1sq9jdb4m2mib87b5fk"))))
    (build-system python-build-system)
    (arguments
     '(#:phases (modify-phases %standard-phases
                  (replace 'check
                    (lambda _
                      (invoke "python" "-m" "django" "test" "-v2"
                              "--settings=tests.settings"))))))
    (native-inputs
     ;; XXX: Picklefield has not been updated in 10+ years and fails tests
     ;; with Django 3.2.
     `(("python-django@2.2" ,python-django-2.2)))
    (synopsis "Pickled object field for Django")
    (description "Pickled object field for Django")
    (license license:expat)))

(define-public python-django-bulk-update
  (package
    (name "python-django-bulk-update")
    (version "2.2.0")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "django-bulk-update" version))
              (sha256
               (base32
                "0dxkmrm3skyw82i0qa8vklxw1ma1y308kh9w2hcnvhpacn5cxdss"))))
    (build-system python-build-system)
    (arguments
     ;; XXX: Tests require a Postgres database.
     `(#:tests? #f))
    (home-page "https://github.com/aykut/django-bulk-update")
    (synopsis "Simple bulk update over Django ORM or with helper function")
    (description
      "Simple bulk update over Django ORM or with helper function.  This
project aims to bulk update given objects using one query over Django ORM.")
    (license license:expat)))

(define-public python-django-contact-form
  (package
    (name "python-django-contact-form")
    (version "1.8.1")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "django-contact-form" version))
              (sha256
               (base32
                "1zv7bcjfrg32gcsq3bclkld79l6mcy2wcvlj81h7q2ppv1wm8vqs"))))
    (build-system python-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (setenv "PYTHONPATH"
                     (string-append "./build/lib:"
                                    (getenv "PYTHONPATH")))
             (invoke "coverage" "run" "--source" "contact_form"
                     "runtests.py"))))))
    (native-inputs
     `(("python-coverage" ,python-coverage)
       ("python-django" ,python-django)))
    (home-page "https://github.com/ubernostrum/django-contact-form")
    (synopsis "Contact form for Django")
    (description
      "This application provides simple, extensible contact-form functionality
for Django sites.")
    (license license:bsd-3)))

(define-public python-django-contrib-comments
  (package
    (name "python-django-contrib-comments")
    (version "1.9.2")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "django-contrib-comments" version))
              (sha256
               (base32
                "0ccdiv784a5vnpfal36km4dyg12340rwhpr0riyy0k89wfnjn8yi"))))
    (build-system python-build-system)
    (native-inputs
     `(("python-django" ,python-django)))
    (propagated-inputs
     `(("python-six" ,python-six)))
    (home-page "https://github.com/django/django-contrib-comments")
    (synopsis "Comments framework")
    (description
      "Django used to include a comments framework; since Django 1.6 it's been
separated to a separate project.  This is that project.  This framework can be
used to attach comments to any model, so you can use it for comments on blog
entries, photos, book chapters, or anything else.")
    (license license:bsd-3)))

(define-public python-django-pipeline
  (package
    (name "python-django-pipeline")
    (version "2.0.5")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "django-pipeline" version))
       (sha256
        (base32
         "19vrbd5s12qw4qlg5n8ldv7zz2rs5y2sdid1i7lvgp92m71dayvc"))))
    (build-system python-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'patch-source
           (lambda _
             (substitute* "tests/tests/test_compiler.py"
               (("\\/usr\\/bin\\/env")
                (which "env")))))
         (replace 'check
           (lambda*(#:key tests? #:allow-other-keys)
             (or
              (not tests?)
              (begin
                (setenv "PYTHONPATH"
                        (string-append (getcwd) ":"
                                       (getenv "PYTHONPATH")))
                (setenv "DJANGO_SETTINGS_MODULE" "tests.settings")
                (invoke "django-admin" "test" "tests"))))))))
    (native-inputs
     `(("python-django" ,python-django)))
    (propagated-inputs
     `(("python-css-html-js-minify" ,python-css-html-js-minify)
       ("python-slimit" ,python-slimit)
       ("python-jsmin" ,python-jsmin)))
    (home-page
     "https://github.com/jazzband/django-pipeline")
    (synopsis "Asset packaging library for Django")
    (description
     "Pipeline is an asset packaging library for Django, providing both CSS
and JavaScript concatenation and compression, built-in JavaScript template
support, and optional data-URI image and font embedding.")
    (license license:expat)))

(define-public python-django-redis
  (package
    (name "python-django-redis")
    (version "4.12.1")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "django-redis" version))
              (sha256
               (base32
                "0qvsm8yjchl0d3i7g20wba6px9lb5gv8kp3fcnr6hr0y0b3qjr9h"))))
    (build-system python-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (invoke "redis-server" "--daemonize" "yes")
             (with-directory-excursion "tests"
               (invoke "python" "runtests.py")))))))
    (native-inputs
     `(("python-django" ,python-django)
       ("python-fakeredis" ,python-fakeredis)
       ("python-hiredis" ,python-hiredis)
       ("python-mock" ,python-mock)
       ("python-msgpack" ,python-msgpack)
       ("redis" ,redis)))
    (propagated-inputs
     `(("python-redis" ,python-redis)))
    (home-page "https://github.com/niwibe/django-redis")
    (synopsis "Full featured redis cache backend for Django")
    (description
      "Full featured redis cache backend for Django.")
    (license license:bsd-3)))

(define-public python-django-rq
  (package
    (name "python-django-rq")
    (version "2.3.2")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "django-rq" version))
              (sha256
               (base32
                "0lksnjn3q3f7y72bj2yr8870w28a5b6x0vjnd9nhpq2ah6xfz6pf"))))
    (build-system python-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (invoke "redis-server" "--daemonize" "yes")
             (invoke "django-admin.py" "test" "django_rq"
                     "--settings=django_rq.tests.settings"
                     "--pythonpath=."))))))
    (native-inputs
     `(("python-django" ,python-django)
       ("python-django-redis" ,python-django-redis)
       ("python-mock" ,python-mock)
       ("python-rq-scheduler" ,python-rq-scheduler)
       ("redis" ,redis)))
    (propagated-inputs
     `(("python-rq" ,python-rq)))
    (home-page "https://github.com/ui/django-rq")
    (synopsis "Django integration with RQ")
    (description
      "Django integration with RQ, a Redis based Python queuing library.
Django-RQ is a simple app that allows you to configure your queues in django's
settings.py and easily use them in your project.")
    (license license:expat)))

(define-public python-django-q
  (package
    (name "python-django-q")
    (version "1.3.4")
    (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "django-q" version))
        (sha256
         (base32 "03z1pf6wlf47i7afr79a8fiiidfk1vq19yaqnv0m4qdny7f58gaj"))))
    (build-system python-build-system)
    ;; FIXME: Tests require disque, Redis, MongoDB, Docker.
    (arguments '(#:tests? #f))
    (native-inputs
     `(("python-django" ,python-django)))
    (propagated-inputs
     `(("python-arrow" ,python-arrow)
       ("python-blessed" ,python-blessed)
       ("python-django-picklefield" ,python-django-picklefield)))
    (home-page "https://django-q.readthedocs.io/")
    (synopsis "Multiprocessing distributed task queue for Django")
    (description
     "Django Q is a native Django task queue, scheduler and worker application
using Python multiprocessing.")
    (license license:expat)))

(define-public python-django-sortedm2m
  (package
    (name "python-django-sortedm2m")
    (version "3.0.2")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "django-sortedm2m" version))
              (sha256
               (base32
                "0z0yymmrr2l5cznqbzwziw624df0qsiflvbpqwrpan52nww3dk4a"))))
    (build-system python-build-system)
    (arguments
     `(#:phases (modify-phases %standard-phases
                  (replace 'check
                    (lambda _
                      (setenv "PYTHONPATH" (string-append "./test_project:"
                                                          "./build/lib:.:"
                                                          (getenv "PYTHONPATH")))
                      (invoke "django-admin.py" "test" "--settings=settings"))))))
    (native-inputs
     `(("python-django" ,python-django)))
    (home-page "https://github.com/jazzband/django-sortedm2m")
    (synopsis "Drop-in replacement for django's own ManyToManyField")
    (description
      "Sortedm2m is a drop-in replacement for django's own ManyToManyField.
The provided SortedManyToManyField behaves like the original one but remembers
the order of added relations.")
    (license license:bsd-3)))

(define-public python-django-appconf
  (package
    (name "python-django-appconf")
    (version "1.0.4")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "django-appconf" version))
              (sha256
               (base32
                "101k8nkc7xlffpjdi2qbrp9pc4v8hzvmkzi12qp7vms39asxwn5y"))))
    (build-system python-build-system)
    (arguments
     '(#:phases (modify-phases %standard-phases
                  (replace 'check
                    (lambda _
                      (setenv "PYTHONPATH" (string-append ".:"
                                                          (getenv "PYTHONPATH")))
                      (setenv "DJANGO_SETTINGS_MODULE" "tests.test_settings")
                      (invoke "django-admin.py" "test" "-v2"))))))
    (native-inputs
     `(("python-django" ,python-django)))
    (home-page "https://github.com/django-compressor/django-appconf")
    (synopsis "Handle configuration defaults of packaged Django apps")
    (description
      "This app precedes Django's own AppConfig classes that act as \"objects
[to] store metadata for an application\" inside Django's app loading mechanism.
In other words, they solve a related but different use case than
django-appconf and can't easily be used as a replacement.  The similarity in
name is purely coincidental.")
    (license license:bsd-3)))

(define-public python-django-statici18n
  (package
    (name "python-django-statici18n")
    (version "2.1.0")
    (home-page "https://github.com/zyegfryed/django-statici18n")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url home-page)
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0x0xvfqd40is2ks43d65awgqkx3wk10lvdim15scvbjhkh301b6v"))))
    (build-system python-build-system)
    (arguments
     '(#:phases (modify-phases %standard-phases
                  (replace 'check
                    (lambda _
                      (setenv "PYTHONPATH"
                              (string-append "./tests/test_project:./build/lib:"
                                             (getenv "PYTHONPATH")))
                      (setenv "DJANGO_SETTINGS_MODULE" "project.settings")
                      (invoke "pytest" "-vv"))))))
    (native-inputs
     `(("python-django" ,python-django)
       ("python-pytest" ,python-pytest)
       ("python-pytest-django" ,python-pytest-django)))
    (propagated-inputs
     `(("django-appconf" ,python-django-appconf)))
    (synopsis "Generate JavaScript catalog to static files")
    (description
      "A Django app that provides helper for generating JavaScript catalog to
static files.")
    (license license:bsd-3)))

(define-public python-django-tagging
  (package
    (name "python-django-tagging")
    (version "0.5.0")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "django-tagging" version))
       (sha256
        (base32
         "13afxx30chssclxzd9gqnvwm9qyrdpnlbs6iswdfa18phfj8zmi8"))))
    (build-system python-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (setenv "DJANGO_SETTINGS_MODULE" "tagging.tests.settings")
             (invoke "django-admin" "test" "--pythonpath=."))))))
    (inputs
     `(("python-django" ,python-django)))
    (home-page "https://github.com/Fantomas42/django-tagging")
    (synopsis "Generic tagging application for Django")
    (description "This package provides a generic tagging application for
Django projects, which allows association of a number of tags with any
@code{Model} instance and makes retrieval of tags simple.")
    (license license:bsd-3)))

(define-public python-djangorestframework
  (package
    (name "python-djangorestframework")
    (version "3.12.4")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/encode/django-rest-framework")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "16n17dw35wqv47m8k8fixn0yywrvd6v4r573yr4nx6lbbiyi2cqn"))))
    (build-system python-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             ;; Add a fix from the master branch for compatibility with Django
             ;; 3.2: https://github.com/encode/django-rest-framework/pull/7911
             ;; Remove for versions > 3.12.4.
             (substitute* "tests/test_fields.py"
               (("class MockTimezone:")
                "class MockTimezone(pytz.BaseTzInfo):"))
             (if tests?
                 (invoke "python" "runtests.py" "--nolint")
                 (format #t "test suite not run~%")))))))
    (native-inputs
     `(("python-django" ,python-django)
       ("python-pytest" ,python-pytest)
       ("python-pytest-django" ,python-pytest-django)))
    (home-page "https://www.django-rest-framework.org")
    (synopsis "Toolkit for building Web APIs with Django")
    (description
     "The Django REST framework is for building Web APIs with Django.  It
provides features like a Web-browsable API and authentication policies.")
    (license license:bsd-2)))

(define-public python-django-sekizai
  (package
    (name "python-django-sekizai")
    (version "2.0.0")
    (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "django-sekizai" version))
        (sha256
         (base32
          "0vrkli625b5s1wldri3dyrfvqbxg7zxy2pg0rpjixw3b1ndz0ag8"))))
    (build-system python-build-system)
    (arguments '(#:tests? #f)) ; Tests not included with release.
    (native-inputs
     `(("python-django" ,python-django)))
    (propagated-inputs
     `(("python-django-classy-tags" ,python-django-classy-tags)
       ("python-six" ,python-six)))
    (home-page "https://github.com/divio/django-sekizai")
    (synopsis "Template blocks for Django projects")
    (description "Sekizai means blocks in Japanese, and that is what this app
provides.  A fresh look at blocks.  With @code{django-sekizai} you can define
placeholders where your blocks get rendered and at different places in your
templates append to those blocks.  This is especially useful for css and
javascript.  Your subtemplates can now define css and javscript files to be
included, and the css will be nicely put at the top and the javascript to the
bottom, just like you should.  Also sekizai will ignore any duplicate content in
a single block.")
    (license license:bsd-3)))

(define-public python-django-crispy-forms
  (package
    (name "python-django-crispy-forms")
    (version "1.9.2")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "django-crispy-forms" version))
       (sha256
        (base32
         "0fxlf233f49hjax786p4r650rd0ilvhnpyvw8hv1d1aqnkxy1wgj"))))
    (build-system python-build-system)
    (arguments
     '(;; No included tests
       #:tests? #f))
    (native-inputs
     `(("python-django" ,python-django)))
    (home-page
     "http://github.com/maraujop/django-crispy-forms")
    (synopsis "Tool to control Django forms without custom templates")
    (description
     "@code{django-crispy-forms} lets you easily build, customize and reuse
forms using your favorite CSS framework, without writing template code.")
    (license license:expat)))

(define-public python-django-compressor
  (package
    (name "python-django-compressor")
    (version "2.4.1")
    (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "django_compressor" version))
        (sha256
         (base32 "1q0m0hfg7sqmj5km924g4dgy3nx51aszzsprlp6gsin10mv0fn1k"))))
    (build-system python-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (if tests?
               (begin
                 (setenv "DJANGO_SETTINGS_MODULE" "compressor.test_settings")
                 (invoke "django-admin" "test"
                         "--pythonpath=."))
               #t))))
       ;; Tests fail with beautifulsoup 4.9+
       ;; https://github.com/django-compressor/django-compressor/issues/998
       #:tests? #f))
    (propagated-inputs
     `(("python-django-appconf" ,python-django-appconf)
       ("python-rcssmin" ,python-rcssmin)
       ("python-rjsmin" ,python-rjsmin)))
    (native-inputs
     `(("python-beautifulsoup4" ,python-beautifulsoup4)
       ("python-brotli" ,python-brotli)
       ("python-csscompressor" ,python-csscompressor)
       ("python-django-sekizai" ,python-django-sekizai)
       ("python-mock" ,python-mock)))
    (home-page "https://django-compressor.readthedocs.io/en/latest/")
    (synopsis
     "Compress linked and inline JavaScript or CSS into single cached files")
    (description
     "Django Compressor combines and compresses linked and inline Javascript or
CSS in a Django templates into cacheable static files by using the compress
template tag.")
    (license license:expat)))

(define-public python-django-override-storage
  (package
    (name "python-django-override-storage")
    (version "0.3.0")
    (home-page "https://github.com/danifus/django-override-storage")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url home-page)
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "081kzfk7mmybhihvc92d3hsdg0r2k20ydq88fs1fgd348sq1ax51"))))
    (build-system python-build-system)
    (arguments
     '(#:phases (modify-phases %standard-phases
                  (replace 'check
                    (lambda _
                      (invoke "python" "runtests.py"))))))
    (native-inputs
     `(("python-django" ,python-django)
       ("python-mock" ,python-mock)))
    (synopsis "Django test helpers to manage file storage side effects")
    (description
     "This project provides tools to help reduce the side effects of using
FileFields during tests.")
    (license license:expat)))

(define-public python-django-auth-ldap
  (package
    (name "python-django-auth-ldap")
    (version "2.4.0")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "django-auth-ldap" version))
              (sha256
               (base32
                "0xk6cxiqz5j3q79bd54x64f26alrlc8p7k9wkp2c768w2k1vzz30"))))
    (build-system python-build-system)
    (arguments
     '(#:phases (modify-phases %standard-phases
                  (replace 'check
                    (lambda* (#:key inputs #:allow-other-keys)
                      (let ((openldap (assoc-ref inputs "openldap")))
                        ;; The tests need 'slapd' which is installed to the
                        ;; libexec directory of OpenLDAP.
                        (setenv "SLAPD" (string-append openldap "/libexec/slapd"))
                        (setenv "SCHEMA"
                                (string-append openldap "/etc/openldap/schema"))
                        (invoke "python" "-m" "django" "test"
                                "--settings" "tests.settings")))))))
    (native-inputs
     `(("openldap" ,openldap)
       ("python-django" ,python-django)
       ("python-mock" ,python-mock)))
    (propagated-inputs
     `(("python-ldap" ,python-ldap)))
    (home-page "https://github.com/django-auth-ldap/django-auth-ldap")
    (synopsis "Django LDAP authentication backend")
    (description
     "This package provides an LDAP authentication backend for Django.")
    (license license:bsd-2)))

(define-public python-django-logging-json
  (package
    (name "python-django-logging-json")
    (version "1.15")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "django-logging-json" version))
              (sha256
               (base32
                "06041a8icazzp73kg93c7k1ska12wvkq7fpcad0l0sm1qnxx5yx7"))))
    (build-system python-build-system)
    (arguments '(#:tests? #f))          ;no tests
    (native-inputs
     `(("python-django" ,python-django)))
    (propagated-inputs
     `(("python-certifi" ,python-certifi)
       ("python-elasticsearch" ,python-elasticsearch)
       ("python-six" ,python-six)))
    (home-page "https://github.com/cipriantarta/django-logging")
    (synopsis "Log requests/responses in various formats")
    (description
     "This package provides a Django library that logs request, response,
and exception details in a JSON document.  It can also send logs directly
to ElasticSearch.")
    (license license:bsd-2)))

(define-public python-django-netfields
  (package
    (name "python-django-netfields")
    (version "1.2.2")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "django-netfields" version))
              (sha256
               (base32
                "1c47azr5am0q8g45x0fbn0cay7vyrack6n7k6siliw1j2p0gzi7s"))))
    (build-system python-build-system)
    (arguments '(#:tests? #f))      ;XXX: Requires a running PostgreSQL server
    (native-inputs
     `(("python-django" ,python-django)))
    (propagated-inputs
     `(("python-netaddr" ,python-netaddr)
       ("python-six" ,python-six)))
    (home-page "https://github.com/jimfunk/django-postgresql-netfields")
    (synopsis "PostgreSQL netfields implementation for Django")
    (description
     "This package provides mappings for the PostgreSQL @code{INET} and
@code{CIDR} fields for use in Django projects.")
    (license license:bsd-3)))

(define-public python-django-url-filter
  (package
    (name "python-django-url-filter")
    (version "0.3.15")
    (home-page "https://github.com/miki725/django-url-filter")
    (source (origin
              (method git-fetch)
              (uri (git-reference (url home-page) (commit version)))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0r4zhqhs8y6cnplwyvcb0zpijizw1ifnszs38n4w8138657f9026"))))
    (build-system python-build-system)
    (arguments
     '(#:tests? #f            ;FIXME: Django raises "Apps aren't loaded yet"!?
       #:phases (modify-phases %standard-phases
                  (add-before 'check 'loosen-requirements
                    (lambda _
                      ;; Do not depend on compatibility package for old
                      ;; Python versions.
                      (substitute* "requirements.txt"
                        (("enum-compat") ""))
                      #t))
                  (replace 'check
                    (lambda* (#:key tests? #:allow-other-keys)
                      (if tests?
                          (begin
                            (setenv "PYTHONPATH"
                                    (string-append "./build/lib:.:"
                                                   (getenv "PYTHONPATH")))
                            (setenv "DJANGO_SETTINGS_MODULE"
                                    "test_project.settings")
                            (invoke "pytest" "-vv" "--doctest-modules"
                                    "tests/" "url_filter/"))
                          (format #t "test suite not run~%")))))))
    (native-inputs
     `(("python-django" ,python-django)))
    (propagated-inputs
     `(("python-cached-property" ,python-cached-property)
       ("python-six" ,python-six)))
    (synopsis "Filter data via human-friendly URLs")
    (description
     "The main goal of Django URL Filter is to provide an easy URL interface
for filtering data.  It allows the user to safely filter by model attributes
and also specify the lookup type for each filter (very much like
Django's filtering system in ORM).")
    (license license:expat)))


code:
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Guillaume Le Vaillant <glv@posteo.net>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages djvu)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix utils)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system python)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages base)
  #:use-module (gnu packages check)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages gawk)
  #:use-module (gnu packages gettext)
  #:use-module (gnu packages ghostscript)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages image)
  #:use-module (gnu packages imagemagick)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages ncurses)
  #:use-module (gnu packages ocr)
  #:use-module (gnu packages pdf)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-web)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages qt)
  #:use-module (gnu packages wxwidgets)
  #:use-module (gnu packages xml)
  #:use-module (gnu packages xorg))

(define-public djvulibre
  (package
    (name "djvulibre")
    (version "3.5.28")
    (source
     (origin
       (method url-fetch)
       (uri (string-append "mirror://sourceforge/djvu/DjVuLibre/"
                           (string-replace-substring version "." ",")
                           "/djvulibre-" version ".tar.gz"))
       (sha256
        (base32 "0manxn1ly5n8nqamv47hz7akxi6v0rzwc9j1c3x99vngrjlr5qw2"))
       (modules '((guix build utils)))
       (snippet
        '(begin
           ;; This bundles software (e.g., zlib) and is entirely superfluous.
           (delete-file-recursively "win32")
           #t))))
    (build-system gnu-build-system)
    (native-inputs
     ;; The 3.5.28 release tarball isn't bootstrapped.
     `(("autoconf" ,autoconf)
       ("automake" ,automake)
       ("libtool" ,libtool)))
    (inputs
     `(("libjpeg-turbo" ,libjpeg-turbo)
       ("libtiff" ,libtiff)
       ("zlib" ,zlib)))
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'bootstrap 'make-reproducible
           (lambda _
             ;; Ensure there are no timestamps in .svgz files.
             (substitute* "desktopfiles/Makefile.am"
               (("gzip") "gzip -n"))
             #t)))))
    (home-page "http://djvu.sourceforge.net/")
    (synopsis "Implementation of DjVu, the document format")
    (description "DjVuLibre is an implementation of DjVu,
including viewers, browser plugins, decoders, simple encoders, and
utilities.")
    (license license:gpl2+)))

(define-public djview
  (package
    (name "djview")
    (version "4.12")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://git.code.sf.net/p/djvu/djview-git")
             (commit (string-append "release." version))))
       (sha256
        (base32 "0mn9ywjbc7iga50lbjclrk892g0x0rap0dmb6ybzjyarybdhhcxp"))
       (file-name (git-file-name name version))))
    (build-system gnu-build-system)
    (native-inputs
     `(("autoconf" ,autoconf)
       ("automake" ,automake)
       ("libtool" ,libtool)
       ("pkg-config" ,pkg-config)
       ("qttools" ,qttools)))
    (inputs
     `(("djvulibre" ,djvulibre)
       ("glib" ,glib)
       ("libxt" ,libxt)
       ("libtiff" ,libtiff)
       ("qtbase" ,qtbase-5)))
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'fix-desktop-file
           ;; Executable is "djview", not "djview4".
           (lambda _
             (substitute* "desktopfiles/djvulibre-djview4.desktop"
               (("Exec=djview4 %f") "Exec=djview %f"))
             #t))
         (add-after 'unpack 'make-files-writable
           (lambda _
             (for-each make-file-writable
                       (find-files "."))
             #t)))))
    (home-page "http://djvu.sourceforge.net/djview4.html")
    (synopsis "Viewer for the DjVu image format")
    (description "DjView is a standalone viewer for DjVu files.

Its features include navigating documents, zooming and panning page images,
producing and displaying thumbnails, displaying document outlines, searching
documents for particular words in the hidden text layer, copying hidden text
to the clipboard, saving pages and documents as bundled or indirect multi-page
files, and printing page and documents.

The viewer can simultaneously display several pages using a side-by-side or
a continuous layout.")
    (license license:gpl2+)))

(define-public pdf2djvu
  (package
    (name "pdf2djvu")
    (version "0.9.17.1")
    (source
     (origin
       (method url-fetch)
       (uri (string-append
             "https://github.com/jwilk/pdf2djvu/releases/download/" version
             "/pdf2djvu-" version ".tar.xz"))
       (sha256
        (base32 "18r648kna6ccw0m0nfxxnsmz541k69d0w9zzqvm1x2l5qyyvgfsv"))))
    (build-system gnu-build-system)
    (native-inputs
     `(("gettext" ,gettext-minimal)
       ("pkg-config" ,pkg-config)
       ("python2" ,python-2)
       ("python2-nose" ,python2-nose)))
    (inputs
     `(("djvulibre" ,djvulibre)
       ("exiv2" ,exiv2)
       ("graphicsmagick" ,graphicsmagick)
       ("poppler" ,poppler)
       ("poppler-data" ,poppler-data)
       ("util-linux-lib" ,util-linux "lib"))) ; for libuuid
    (arguments
     `(#:test-target "test"))
    (synopsis "PDF to DjVu converter")
    (description
     "@code{pdf2djvu} creates DjVu files from PDF files.
It is able to extract:
@itemize
@item graphics,
@item text layer,
@item hyperlinks,
@item document outline (bookmarks),
@item metadata (including XMP metadata).
@end itemize\n")
    (home-page "https://jwilk.net/software/pdf2djvu")
    (license license:gpl2)))

(define-public djvu2pdf
  (package
    (name "djvu2pdf")
    (version "0.9.2")
    (source
     (origin
       (method url-fetch)
       (uri (string-append "https://0x2a.at/site/projects/djvu2pdf/djvu2pdf-"
                           version ".tar.gz"))
       (sha256
        (base32 "0v2ax30m7j1yi4m02nzn9rc4sn4vzqh5vywdh96r64j4pwvn5s5g"))))
    (build-system gnu-build-system)
    (inputs
     `(("djvulibre" ,djvulibre)
       ("gawk" ,gawk)
       ("ghostscript" ,ghostscript)
       ("grep" ,grep)
       ("ncurses" ,ncurses)
       ("which" ,which)))
    (arguments
     `(#:tests? #f ; No test suite
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'fix-paths
           (lambda* (#:key inputs #:allow-other-keys)
             (let ((djvulibre (assoc-ref inputs "djvulibre"))
                   (gawk (assoc-ref inputs "gawk"))
                   (ghostscript (assoc-ref inputs "ghostscript"))
                   (grep (assoc-ref inputs "grep"))
                   (ncurses (assoc-ref inputs "ncurses"))
                   (which (assoc-ref inputs "which")))
               (substitute* "djvu2pdf"
                 (("awk")
                  (string-append gawk "/bin/awk"))
                 (("ddjvu")
                  (string-append djvulibre "/bin/ddjvu"))
                 (("djvudump")
                  (string-append djvulibre "/bin/djvudump"))
                 (("grep")
                  (string-append grep "/bin/grep"))
                 (("gs")
                  (string-append ghostscript "/bin/gs"))
                 (("tput ")
                  (string-append ncurses "/bin/tput "))
                 (("which")
                  (string-append which "/bin/which"))))
             #t))
         (delete 'configure)
         (delete 'build)
         (replace 'install
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref %outputs "out")))
               (install-file "djvu2pdf"
                             (string-append out "/bin"))
               (install-file "djvu2pdf.1.gz"
                             (string-append out "/share/man/man1"))
               #t))))))
    (synopsis "DjVu to PDF converter")
    (description "This is a small tool to convert DjVu files to PDF files.")
    (home-page "https://0x2a.at/site/projects/djvu2pdf/")
    (license license:gpl2+)))

(define-public minidjvu
  (package
    (name "minidjvu")
    (version "0.8")
    (source
     (origin
       (method url-fetch)
       (uri (string-append "mirror://sourceforge/minidjvu/minidjvu/"
                           version "/minidjvu-" version ".tar.gz"))
       (sha256
        (base32 "0jmpvy4g68k6xgplj9zsl6brg6vi81mx3nx2x9hfbr1f4zh95j79"))))
    (build-system gnu-build-system)
    (native-inputs
     `(("gettext" ,gettext-minimal)))
    (inputs
     `(("libjpeg-turbo" ,libjpeg-turbo)
       ("libtiff" ,libtiff)
       ("zlib" ,zlib)))
    (arguments
     '(#:configure-flags '("--disable-static")
       #:parallel-build? #f
       #:tests? #f ; No test suite
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'fix-paths
           (lambda _
             (substitute* "Makefile.in"
               (("/usr/bin/gzip")
                "gzip"))
             #t))
         (add-before 'install 'make-lib-directory
           (lambda* (#:key outputs #:allow-other-keys)
             (mkdir-p (string-append (assoc-ref outputs "out") "/lib"))
             #t)))))
    (synopsis "Black and white DjVu encoder")
    (description
     "@code{minidjvu} is a multipage DjVu encoder and single page
encoder/decoder.  It doesn't support colors or grayscales, just black
and white.")
    (home-page "https://sourceforge.net/projects/minidjvu/")
    (license license:gpl2)))

(define-public djvusmooth
  (package
    (name "djvusmooth")
    (version "0.3")
    (source
     (origin
       (method url-fetch)
       (uri (string-append
             "https://github.com/jwilk/djvusmooth/releases/download/" version
             "/djvusmooth-" version ".tar.gz"))
       (sha256
        (base32 "0z403cklvxzz0qaczgv83ax0nknrd9h8micp04j9kjfdxk2sgval"))))
    (build-system python-build-system)
    (inputs
     `(("djvulibre" ,djvulibre)
       ("python2-djvulibre" ,python2-djvulibre)
       ("python2-subprocess32" ,python2-subprocess32)
       ("python2-wxpython" ,python2-wxpython)))
    (arguments
     `(#:python ,python-2
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'fix-paths
           (lambda* (#:key inputs #:allow-other-keys)
             (substitute* "lib/djvused.py"
               (("djvused_path = 'djvused'")
                (string-append "djvused_path = '"
                               (assoc-ref inputs "djvulibre")
                               "/bin/djvused'"))))))))
    (synopsis "Graphical editor for DjVu documents")
    (description
     "@code{djvusmooth} is a graphical editor for DjVu_ documents.
It is able to:
@itemize
@item edit document metadata,
@item edit document outline (bookmarks),
@item add, remove or edit hyperlinks,
@item correct occasional errors in the hidden text layer.
@end itemize\n")
    (home-page "https://jwilk.net/software/djvusmooth")
    (license license:gpl2)))

(define-public didjvu
  (package
    (name "didjvu")
    (version "0.9")
    (source
     (origin
       (method url-fetch)
       (uri (string-append
             "https://github.com/jwilk/didjvu/releases/download/" version
             "/didjvu-" version ".tar.gz"))
       (sha256
        (base32 "0xyrnk8d2khi7q1zr28gjkjq6frz4mkb5jdl8821yzf12k7c8pbv"))))
    (build-system gnu-build-system)
    (native-inputs
     `(("python2-nose" ,python2-nose)))
    (inputs
     `(("djvulibre" ,djvulibre)
       ("minidjvu" ,minidjvu)
       ("python" ,python-2)
       ("python2-gamera" ,python2-gamera)
       ("python2-pillow" ,python2-pillow)))
    (arguments
     `(#:modules ((guix build gnu-build-system)
                  ((guix build python-build-system) #:prefix python:)
                  (guix build utils))
       #:imported-modules (,@%gnu-build-system-modules
                           (guix build python-build-system))
       #:test-target "test"
       #:phases
       (modify-phases %standard-phases
         (delete 'configure)
         (add-before 'check 'disable-failing-test
           (lambda _
             (substitute* "tests/test_ipc.py"
               ;; test_wait_signal gets stuck forever
               (("yield self\\._test_signal, name")
                "return True")
               ;; test_path fails to find a file it should have created
               (("path = os\\.getenv\\('PATH'\\)\\.split\\(':'\\)")
                "return True"))
             (substitute* "tests/test_timestamp.py"
               ;; test_timezones fails with:
               ;;   '2009-12-18T21:25:14Z' != '2009-12-18T22:25:14+01:00'
               (("@fork_isolation")
                "return True"))))
         (replace 'install
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
               (invoke "make"
                       "DESTDIR="
                       (string-append "PREFIX=" out)
                       "install"))))
         (add-after 'install 'wrap-python
           (assoc-ref python:%standard-phases 'wrap))
         (add-after 'wrap-python 'wrap-path
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out"))
                   (djvulibre (assoc-ref inputs "djvulibre")))
               (wrap-program (string-append out "/bin/didjvu")
                 `("PATH" ":" prefix (,(string-append djvulibre "/bin"))))))))))
    (synopsis "DjVu encoder with foreground/background separation")
    (description
     "@code{didjvu} uses the @code{Gamera} framework to separate the foreground
and background layers of images, which can then be encoded into a DjVu file.")
    (home-page "https://jwilk.net/software/didjvu")
    (license license:gpl2)))

(define-public ocrodjvu
  (package
    (name "ocrodjvu")
    (version "0.12")
    (source
     (origin
       (method url-fetch)
       (uri (string-append
             "https://github.com/jwilk/ocrodjvu/releases/download/" version
             "/ocrodjvu-" version ".tar.xz"))
       (sha256
        (base32 "09w9rqr7z2jd5kwp178zz2yrsc82mxs7gksipg92znxzgzhmw2ng"))))
    (build-system gnu-build-system)
    (native-inputs
     `(("libxml2" ,libxml2)
       ("python2-nose" ,python2-nose)
       ("python2-pillow" ,python2-pillow)))
    (inputs
     `(("djvulibre" ,djvulibre)
       ("ocrad" ,ocrad)
       ("python" ,python-2)
       ("python2-djvulibre" ,python2-djvulibre)
       ("python2-html5lib" ,python2-html5lib)
       ("python2-lxml" ,python2-lxml)
       ("python2-pyicu" ,python2-pyicu)
       ("python2-subprocess32" ,python2-subprocess32)
       ("tesseract-ocr" ,tesseract-ocr)))
    (arguments
     `(#:modules ((guix build gnu-build-system)
                  ((guix build python-build-system) #:prefix python:)
                  (guix build utils))
       #:imported-modules (,@%gnu-build-system-modules
                           (guix build python-build-system))
       #:test-target "test"
       #:phases
       (modify-phases %standard-phases
         (delete 'configure)
         (add-before 'check 'disable-failing-test
           (lambda _
             (substitute* "tests/test_ipc.py"
               ;; test_wait_signal gets stuck forever
               (("yield self\\._test_signal, name")
                "return True")
               ;; test_path fails to find a file it should have created
               (("path = os\\.getenv\\('PATH'\\)\\.split\\(':'\\)")
                "return True"))
             ;; Disable tests with tesseract. They can't work without
             ;; the language files that must downloaded by the final user
             ;; as they are not packaged in Guix.
             (substitute* "tests/ocrodjvu/test.py"
               (("engines = stdout\\.getvalue\\(\\)\\.splitlines\\(\\)")
                "engines = ['ocrad']"))
             (substitute* "tests/ocrodjvu/test_integration.py"
               (("engines = 'tesseract', 'cuneiform', 'gocr', 'ocrad'")
                "engines = 'ocrad'"))))
         (replace 'install
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
               (invoke "make"
                       "DESTDIR="
                       (string-append "PREFIX=" out)
                       "install"))))
         (add-after 'install 'wrap-python
           (assoc-ref python:%standard-phases 'wrap))
         (add-after 'wrap-python 'wrap-path
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out"))
                   (djvulibre (assoc-ref inputs "djvulibre"))
                   (ocrad (assoc-ref inputs "ocrad"))
                   (tesseract (assoc-ref inputs "tesseract-ocr")))
               (for-each (lambda (file)
                           (wrap-program (string-append out "/bin/" file)
                             `("PATH" ":" prefix
                               (,(string-append djvulibre "/bin:"
                                                ocrad "/bin:"
                                                tesseract "/bin")))))
                         '("djvu2hocr"
                           "hocr2djvused"
                           "ocrodjvu"))))))))
    (synopsis "Program to perform OCR on DjVu files")
    (description
     "@code{ocrodjvu} is a wrapper for OCR systems, that allows you to perform
OCR on DjVu files.")
    (home-page "https://jwilk.net/software/ocrodjvu")
    (license license:gpl2)))