root/anki.scm

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
(define-module (hidamari-blue anki)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system python)
  #:use-module (guix utils)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:renamer (symbol-prefix-proc 'license:))
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages qt)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages audio)
  #:use-module (gnu packages python)
  #:use-module (gnu packages compression))

;;; status: requires Qt 5.7+ to continue
;;; PyQt5.QtWebEngineWidgets is missing from pyqt, maybe for above reason

(define-public python-pyaudio
  (package
   (name "python-pyaudio")
   (version "0.2.11")
   (source
    (origin
     (method url-fetch)
     (uri (string-append
           "https://pypi.python.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-"
           version
           ".tar.gz"))
     (sha256
      (base32
       "0x7vdsigm7xgvyg3shd3lj113m8zqj2pxmrgdyj66kmnw0qdxgwk"))))
   (build-system python-build-system)
   (inputs `(("portaudio" ,portaudio)))
   (home-page
    "http://people.csail.mit.edu/hubert/pyaudio/")
   (synopsis
    "Bindings for PortAudio v19, the cross-platform audio input/output stream library.")
   (description
    "Bindings for PortAudio v19, the cross-platform audio input/output stream library.")
   (license #f)))

(define-public python2-pyaudio
  (package
   (inherit (package-with-python2
             (strip-python2-variant python-pyaudio)))
   (arguments `(#:python ,python-2))))

;;; send2trash will not build for python3
;;; wtf it does not work with python3, can you mix it?
(define python-send2trash
  (package
   (name "python-send2trash")
   (version "1.3.0")
   (source
    (origin
     (method url-fetch)
     (uri (string-append
           "https://pypi.python.org/packages/cd/62/e40006ddd56e1b5aa49d343aa2cb3a9014174c237af2cf70011cba173c73/Send2Trash-"
           version
           ".tar.gz"))
     (sha256
      (base32
       "1zjq5ki02l0vl4f1xymsnqyxipx6q81a435p46db07l3mqg4dx1k"))))
   (build-system python-build-system)
   (home-page "http://github.com/hsoft/send2trash")
   (synopsis
    "Send file to trash natively under Mac OS X, Windows and Linux.")
   (description
    "Send file to trash natively under Mac OS X, Windows and Linux.")
   (license license:bsd-3)))

(define-public python2-send2trash
  (package
   (inherit (package-with-python2
             (strip-python2-variant python-send2trash)))
   (arguments `(#:python ,python-2))))

(define-public anki
  (let ((commit "7f7b8fc52faaa4b6d7de3478bb26328c36a73080"))
    (package
     (name "anki")
     (version (string-append "2.0.45-" commit))
     ;; (source (origin
     ;;          (method url-fetch)
     ;;          (uri (string-append "https://apps.ankiweb.net/downloads/current/anki-"
     ;;                              version "-source.tgz"))
     ;;          (sha256
     ;;           (base32
     ;;            "0yqs4j2r4mp025r2af34s51q05ahwmywla34i0agsjwlixb936q0"))))

     ;; the tar ball release does not contain pip files
     (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/dae/anki")
                    (commit commit)))
              (sha256
               (base32
                "0999rk1agqsk62chb746l2kp1xf109y7k31rjjhdqim60cmnci3r"))))

     (arguments `(#:phases
                  (modify-phases
                   %standard-phases
                   (add-before 'build 'create-setup
                               (lambda* (#:key source version inputs #:allow-other-keys)
                                 (call-with-output-file "setup.py"
                                   (lambda (port)
                                     (display
                                      "#!/usr/bin/env python

from distutils.core import setup

setup(name='Anki',
      version='2.0.45',
      description='Anki Flashcard reptition program',
      author='Anki developers',
      author_email='todo',
      url='https://apps.ankiweb.net/',
      packages=['anki'],
      scripts=['runanki'],
     )"  port)))
                                 (system* "./tools/build_ui.sh")
                                 ;; TODO wait for qt5.7+ to hit
                                 ;; (substitute* "aqt/qt.py"
                                 ;;              (("from PyQt5.QtWebEngineWidgets import QWebEnginePage")
                                 ;;               "#from PyQt5.QtWebEngineWidgets import QWebEnginePage"))
                                 (substitute* "aqt/qt.py"
                                              (("raise Exception\\(\"Your Qt version is known to be broken.\"\\)")
                                               "print(\"The japanease/chinese IME does not work with qt-5.8.0\")")))))))
     (build-system python-build-system)
     (inputs `(("zlib" ,zlib)
               ("qt" ,qt)
               ("pyaudio" ,python-pyaudio)
               ("httplib2" ,python-httplib2)
               ("send2trash" ,python2-send2trash)
               ("bs4",python-beautifulsoup4)
               ("python-requests" ,python-requests)
               ("python-sip" ,python-sip)
               ("python-pyqt" ,python-pyqt)))
     (native-inputs `(("nose" ,python-nose)
                      ("perl" ,perl)))
     (synopsis "Anki flash card repetition gui")
     (description "Graphical program for doing multi media flash card repetitions
 in spaced intervals.")
     (home-page "https://apps.ankiweb.net/")
     (license license:agpl3+))))