From patchwork Tue Feb 4 12:01:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Smith X-Patchwork-Id: 20079 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 3499B168C9; Tue, 4 Feb 2020 12:02:15 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 98A72168BE for ; Tue, 4 Feb 2020 12:02:14 +0000 (GMT) Received: from localhost ([::1]:57050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iywuE-0004Qu-34 for patchwork@mira.cbaines.net; Tue, 04 Feb 2020 07:02:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45377) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iywu4-0004Qn-Of for guix-patches@gnu.org; Tue, 04 Feb 2020 07:02:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iywu2-0001L6-QY for guix-patches@gnu.org; Tue, 04 Feb 2020 07:02:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:36719) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iywu2-0001Iq-D1 for guix-patches@gnu.org; Tue, 04 Feb 2020 07:02:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iywu2-0003Ma-AP for guix-patches@gnu.org; Tue, 04 Feb 2020 07:02:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#39367] [PATCH v2] gnu: Add anki. References: <20200131120112.4532-1-robertsmith@posteo.net> In-Reply-To: <20200131120112.4532-1-robertsmith@posteo.net> Resent-From: Robert Smith Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 04 Feb 2020 12:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39367 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Nicolas Goaziou Cc: Robert Smith , 39367@debbugs.gnu.org Received: via spool by 39367-submit@debbugs.gnu.org id=B39367.158081772012920 (code B ref 39367); Tue, 04 Feb 2020 12:02:02 +0000 Received: (at 39367) by debbugs.gnu.org; 4 Feb 2020 12:02:00 +0000 Received: from localhost ([127.0.0.1]:42692 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iywtw-0003MH-9K for submit@debbugs.gnu.org; Tue, 04 Feb 2020 07:01:59 -0500 Received: from mout01.posteo.de ([185.67.36.65]:51554) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iywts-0003Lw-2K for 39367@debbugs.gnu.org; Tue, 04 Feb 2020 07:01:55 -0500 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id DF79B160060 for <39367@debbugs.gnu.org>; Tue, 4 Feb 2020 13:01:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1580817704; bh=tdTnavOnqucmQZzGc3TQTutUlQj0+K4KLN3VHus6iyQ=; h=From:To:Cc:Subject:Date:From; b=g1OknwSvU/z28x3CpNQWaE70YcyzIzbPRrfpzezUHlz2NOWOuCG+ElRC/MmAwysa5 XxaQVYM0tRafxlnSJtEvw8puegZR87aAGqYN6degIrrabMqYfhSHs5aDT/xwsu+FvY 9FmrPIJTn9FFTuIntp6oC6dBZmb2kZAHNxBTFh6H8+zYQqUNd3vLykeciFM0rFjHu2 LIVt936oj89EHV8gH2e785Nbt5WznGM3J0DrhE3rB1ctaDwNPoaR/abFmZi+cRM9MW Uj53GIl1piiuZVdD6s3LZWNqfFaO4G0bP7Jb8qLYxw+g/eATIivxYt39DAJ9Pwjt6k SmfCGAY4tqYfA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 48BjwR6pbyz6tm9; Tue, 4 Feb 2020 13:01:43 +0100 (CET) From: Robert Smith Date: Tue, 4 Feb 2020 13:01:15 +0100 Message-Id: <20200204120115.7611-1-robertsmith@posteo.net> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * 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 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice ;;; Copyright © 2018, 2019, 2020 Nicolas Goaziou +;;; Copyright © 2020 Robert Smith ;;; ;;; 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+)))