GNU bug report logs -
#39367
[PATCH] gnu: Add anki.
Previous Next
Reported by: Robert Smith <robertsmith <at> posteo.net>
Date: Fri, 31 Jan 2020 12:03:02 UTC
Severity: normal
Tags: patch
Done: Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 39367 in the body.
You can then email your comments to 39367 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#39367
; Package
guix-patches
.
(Fri, 31 Jan 2020 12:03:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Robert Smith <robertsmith <at> posteo.net>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Fri, 31 Jan 2020 12:03:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* gnu/packages/education.scm (anki): New variable.
---
Add package anki to guix, using a slightly outdated version to avoid NPM
dependencies
gnu/packages/education.scm | 80 ++++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
diff --git a/gnu/packages/education.scm b/gnu/packages/education.scm
index 4f8d7582c7..3f1fa2ca52 100644
--- a/gnu/packages/education.scm
+++ b/gnu/packages/education.scm
@@ -5,6 +5,7 @@
;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim <at> flashner.co.il>
;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me <at> tobias.gr>
;;; Copyright © 2018, 2019, 2020 Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
+;;; Copyright © 2020 Robert Smith <robertsmith <at> 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,77 @@ 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
+ ;; The program fails to find the QtWebEngineProcess program,
+ ;; so we set QTWEBENGINEPROCESS_PATH to help it.
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
+ (qtwebengineprocess (string-append
+ (assoc-ref inputs "qtwebengine")
+ "/lib/qt5/libexec/QtWebEngineProcess")))
+ (for-each (lambda (program)
+ (wrap-program program
+ `("QTWEBENGINEPROCESS_PATH" =
+ (,qtwebengineprocess))))
+ (find-files bin ".*")))
+ #t)))))
+ (native-inputs
+ `(("perl" ,perl)
+ ("xdg-utils" ,xdg-utils)))
+ (inputs
+ `(("python" ,python-wrapper)
+ ("qtwebengine" ,qtwebengine)
+ ("mpv" ,mpv)
+ ("lame" ,lame)))
+ (propagated-inputs
+ `(("python-pyqtwebengine" ,python-pyqtwebengine)
+ ("python-pyqt" ,python-pyqt)
+ ("python-beautifulsoup4" ,python-beautifulsoup4)
+ ("python-decorator" ,python-decorator)
+ ("python-distro" ,python-distro)
+ ("python-markdown" ,python-markdown)
+ ("python-jsonschema" ,python-jsonschema)
+ ("python-pyaudio" ,python-pyaudio)
+ ("python-requests" ,python-requests)
+ ("python-send2trash" ,python-send2trash)
+ ("python-sip" ,python-sip)))
+ (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
Information forwarded
to
guix-patches <at> gnu.org
:
bug#39367
; Package
guix-patches
.
(Sun, 02 Feb 2020 13:02:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 39367 <at> debbugs.gnu.org (full text, mbox):
Hello,
Robert Smith <robertsmith <at> posteo.net> writes:
> * gnu/packages/education.scm (anki): New variable.
Thank you! Some comments follow.
> + '(#:make-flags (list (string-append "PREFIX=" %output))
OOC, isn't it automatic in gnu-build-system?
> + (inputs
> + `(("python" ,python-wrapper)
> + ("qtwebengine" ,qtwebengine)
> + ("mpv" ,mpv)
> + ("lame" ,lame)))
> + (propagated-inputs
> + `(("python-pyqtwebengine" ,python-pyqtwebengine)
> + ("python-pyqt" ,python-pyqt)
> + ("python-beautifulsoup4" ,python-beautifulsoup4)
> + ("python-decorator" ,python-decorator)
> + ("python-distro" ,python-distro)
> + ("python-markdown" ,python-markdown)
> + ("python-jsonschema" ,python-jsonschema)
> + ("python-pyaudio" ,python-pyaudio)
> + ("python-requests" ,python-requests)
> + ("python-send2trash" ,python-send2trash)
> + ("python-sip" ,python-sip)))
Please order inputs and propagated-inputs alphabetically.
The package builds fine, but when trying to run "anki", I get the
following error:
ModuleNotFoundError: No module named 'decorator'
It looks like you also need to wrap PYTHONPATH around the executable. WDYT?
Regards,
--
Nicolas Goaziou
Information forwarded
to
guix-patches <at> gnu.org
:
bug#39367
; Package
guix-patches
.
(Mon, 03 Feb 2020 16:12:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 39367 <at> debbugs.gnu.org (full text, mbox):
On Sun Feb 2, 2020 at 2:01 PM Nicolas Goaziou wrote:
> > + '(#:make-flags (list (string-append "PREFIX=" %output))
>
> OOC, isn't it automatic in gnu-build-system?
For some reason I thought that this usually happened in the configure
stage, which I deleted. You're probably right, I'll double-check and fix
if necessary.
> Please order inputs and propagated-inputs alphabetically.
Will fix!
> The package builds fine, but when trying to run "anki", I get the
> following error:
>
> ModuleNotFoundError: No module named 'decorator'
>
> It looks like you also need to wrap PYTHONPATH around the executable. WDYT?
Since Anki uses python at run time, is the proper action to wrap the
executable with the desired pythonpath, or to declare python as a
propagated input? Propagating python sounds simpler, but would likely be
inconvienent for users who need custom python versions. I'll look into
wrapping PYTHONPATH and I will resubmit. Thank you for reviewing my
patch!
Best,
Robert
Information forwarded
to
guix-patches <at> gnu.org
:
bug#39367
; Package
guix-patches
.
(Mon, 03 Feb 2020 16:19:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 39367 <at> debbugs.gnu.org (full text, mbox):
Hello,
"Robert Smith" <robertsmith <at> posteo.net> writes:
> Since Anki uses python at run time, is the proper action to wrap the
> executable with the desired pythonpath, or to declare python as a
> propagated input? Propagating python sounds simpler, but would likely be
> inconvienent for users who need custom python versions. I'll look into
> wrapping PYTHONPATH and I will resubmit.
As a rule of thumb, with a few exceptions—notably in
emacs-build-system—, propagated-inputs should ideally be used as a last
resort, when nothing else works.
Regards,
--
Nicolas Goaziou
Information forwarded
to
guix-patches <at> gnu.org
:
bug#39367
; Package
guix-patches
.
(Tue, 04 Feb 2020 12:02:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 39367 <at> debbugs.gnu.org (full text, mbox):
* 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 <at> flashner.co.il>
;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me <at> tobias.gr>
;;; Copyright © 2018, 2019, 2020 Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
+;;; Copyright © 2020 Robert Smith <robertsmith <at> 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
Reply sent
to
Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
:
You have taken responsibility.
(Wed, 05 Feb 2020 14:04:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Robert Smith <robertsmith <at> posteo.net>
:
bug acknowledged by developer.
(Wed, 05 Feb 2020 14:04:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 39367-done <at> debbugs.gnu.org (full text, mbox):
Hello,
Robert Smith <robertsmith <at> posteo.net> writes:
> * gnu/packages/education.scm (anki): New variable.
Applied as 8534c9491d86406ade201bacc3b14fdf63a1f39d.
I refactored a bit the part filtering Python packages, added a comment
about why `configure' phase was deleted.
Thank you!
Regards,
--
Nicolas Goaziou
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 05 Mar 2020 12:24:08 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 100 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.