unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Smith <robertsmith@posteo.net>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: Robert Smith <robertsmith@posteo.net>, 39367@debbugs.gnu.org
Subject: [bug#39367] [PATCH v2] gnu: Add anki.
Date: Tue,  4 Feb 2020 13:01:15 +0100	[thread overview]
Message-ID: <20200204120115.7611-1-robertsmith@posteo.net> (raw)
In-Reply-To: <20200131120112.4532-1-robertsmith@posteo.net>

* gnu/packages/education.scm (anki): New variable.
---
 gnu/packages/education.scm | 103 +++++++++++++++++++++++++++++++++++++
 1 file changed, 103 insertions(+)

Nicolas, I was able to wrap the PYTHONPATH environment variable into the
binary, avoiding any propagated inputs. I still have to set 'PREFIX'
manually, as in the GNU build system that is done in the configure
stage, which anki doesn't have. I also removed perl as a native input,
which was an uncaught mistake from last time (the last patch woud have
built without perl as well).

Thanks again for reviewing my work!

-Robert

diff --git a/gnu/packages/education.scm b/gnu/packages/education.scm
index 4f8d7582c7..dcb57c8874 100644
--- a/gnu/packages/education.scm
+++ b/gnu/packages/education.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018, 2019, 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; Copyright © 2020 Robert Smith <robertsmith@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,6 +25,7 @@
 (define-module (gnu packages education)
   #:use-module (ice-9 regex)
   #:use-module (gnu packages)
+  #:use-module (gnu packages audio)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages compression)
@@ -39,14 +41,18 @@
   #:use-module (gnu packages javascript)
   #:use-module (gnu packages kde)
   #:use-module (gnu packages kde-frameworks) ; extra-cmake-modules
+  #:use-module (gnu packages mp3)
   #:use-module (gnu packages perl)
   #: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 sdl)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages video)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages xml)
   #:use-module ((guix licenses) #:prefix license:)
@@ -714,3 +720,100 @@ each key.  A collection of lessons are included for a wide range of different
 languages and keyboard layouts, and typing statistics are used to dynamically
 adjust the level of difficulty.")
     (license license:gpl2)))
+
+(define-public anki
+  (package
+    (name "anki")
+    ;; Later versions have dependencies on npm packages not yet in guix
+    (version "2.1.16")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://apps.ankiweb.net/downloads/archive/anki-"
+                           version "-source.tgz"))
+       (sha256
+        (base32 "1gfr51rnllkyzli73p4r51h5ypzfa3m7lic3m3rzpywmqwrxs07k"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:make-flags (list (string-append "PREFIX=" %output))
+       #:tests? #f ;no check target
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-after 'install 'wrap
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
+                   ;; List of paths to the site-packages directories of python
+                   ;; library inputs
+                   (site-packages (map
+                                   (lambda (pyinput)
+                                     (string-append
+                                      (cdr pyinput)
+                                      "/lib/python"
+                                      ;; Calculate the python version to avoid
+                                      ;; breaking with future 3.X releases
+                                      ,(version-major+minor
+                                        (package-version python-wrapper))
+                                      "/site-packages"))
+                                   (filter
+                                    (lambda (input)
+                                      (and
+                                       (>= (string-length (car input)) 7)
+                                       (string= (car input) "python-" 0 7)))
+                                    inputs)))
+                   (qtwebengineprocess (string-append
+                                        (assoc-ref inputs "qtwebengine")
+                                        "/lib/qt5/libexec/QtWebEngineProcess")))
+               ;; The program fails to find the QtWebEngineProcess program, so
+               ;; we set QTWEBENGINEPROCESS_PATH to help it.  PYTHONPATH is
+               ;; wrapped to avoid declaring python libraries as propagated
+               ;; inputs
+               (for-each (lambda (program)
+                           (wrap-program program
+                             `("QTWEBENGINEPROCESS_PATH" =
+                               (,qtwebengineprocess))
+                             `("PYTHONPATH" =
+                               ,site-packages)))
+                         (find-files bin ".*")))
+             #t)))))
+    (native-inputs
+     `(("xdg-utils" ,xdg-utils)))
+    (inputs
+     `(("lame" ,lame)
+       ("mpv" ,mpv)
+       ("python" ,python-wrapper)
+       ("python-beautifulsoup4" ,python-beautifulsoup4)
+       ("python-decorator" ,python-decorator)
+       ("python-distro" ,python-distro)
+       ("python-jsonschema" ,python-jsonschema)
+       ("python-markdown" ,python-markdown)
+       ("python-pyaudio" ,python-pyaudio)
+       ;; python-pyqtwebengine must preceed python-pyqt in the PYTHONPATH
+       ("python-pyqtwebengine" ,python-pyqtwebengine)
+       ("python-pyqt" ,python-pyqt)
+       ("python-requests" ,python-requests)
+       ("python-send2trash" ,python-send2trash)
+       ("python-sip" ,python-sip)
+       ;;qtwebengine is included in pyqtwebengine, included here for easy
+       ;;wrapping
+       ("qtwebengine" ,qtwebengine)))
+    (home-page "https://apps.ankiweb.net/")
+    (synopsis "Powerful, intelligent flash cards")
+    (description "Anki is a program which makes remembering things
+easy.  Because it's a lot more efficient than traditional study
+methods, you can either greatly decrease your time spent studying, or
+greatly increase the amount you learn.
+
+Anyone who needs to remember things in their daily life can benefit
+from Anki.  Since it is content-agnostic and supports images, audio,
+videos and scientific markup (via LaTeX), the possibilities are
+endless.  For example:
+@itemize
+@item Learning a language
+@item Studying for medical and law exams
+@item Memorizing people's names and faces
+@item Brushing up on geography
+@item Mastering long poems
+@item Even practicing guitar chords!
+@end itemize")
+    (license license:agpl3+)))
-- 
2.25.0

  parent reply	other threads:[~2020-02-04 12:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31 12:01 [bug#39367] [PATCH] gnu: Add anki Robert Smith
2020-02-02 13:01 ` Nicolas Goaziou
2020-02-03 16:11   ` Robert Smith
2020-02-03 16:18     ` Nicolas Goaziou
2020-02-04 12:01 ` Robert Smith [this message]
2020-02-05 14:03   ` bug#39367: [PATCH v2] " Nicolas Goaziou

Reply instructions:

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

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

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

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

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

  git send-email \
    --in-reply-to=20200204120115.7611-1-robertsmith@posteo.net \
    --to=robertsmith@posteo.net \
    --cc=39367@debbugs.gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /path/to/YOUR_REPLY

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

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

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

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