anki: Enable tests (#31582)

* anki: Enable tests

Convert package to use buildPythonApplication instead of mkDerivation

* anki: ignore tests via pytest arguments

authored by adisbladis and committed by Jörg Thalheim d3cb4de9 1a102a36

+48 -22
+2 -2
pkgs/games/anki/beautifulsoup.nix
··· 1 - { pythonPackages, isPy3k, pkgs }: 2 3 - pythonPackages.buildPythonPackage rec { 4 name = "beautifulsoup-3.2.1"; 5 disabled = isPy3k; 6
··· 1 + { buildPythonPackage, isPy3k, pkgs }: 2 3 + buildPythonPackage rec { 4 name = "beautifulsoup-3.2.1"; 5 disabled = isPy3k; 6
+45 -19
pkgs/games/anki/default.nix
··· 1 - { stdenv, lib, fetchurl, substituteAll, lame, mplayer 2 , libpulseaudio 3 # This little flag adds a huge number of dependencies, but we assume that 4 # everyone wants Anki to draw plots with statistics by default. 5 , plotsSupport ? true 6 - , python2Packages 7 }: 8 9 let 10 - version = "2.0.47"; 11 - inherit (python2Packages) python wrapPython sqlalchemy pyaudio beautifulsoup4 httplib2 matplotlib pyqt4; 12 - qt4 = pyqt4.qt; 13 - 14 # Development version of anki has bumped to beautifulsoup4 15 - beautifulsoup = python2Packages.callPackage ./beautifulsoup.nix { 16 - pythonPackages = python2Packages; 17 - }; 18 19 - in 20 - stdenv.mkDerivation rec { 21 name = "anki-${version}"; 22 src = fetchurl { 23 urls = [ 24 "https://apps.ankiweb.net/downloads/current/${name}-source.tgz" ··· 28 sha256 = "067bsidqzy1zc301i2pk4biwp2kwvgk4kydp5z5s551acinkbdgv"; 29 }; 30 31 - pythonPath = [ pyqt4 sqlalchemy pyaudio beautifulsoup httplib2 ] 32 - ++ lib.optional plotsSupport matplotlib; 33 34 - buildInputs = [ python wrapPython lame mplayer libpulseaudio ]; 35 36 - phases = [ "unpackPhase" "patchPhase" "installPhase" ]; 37 38 patches = [ 39 # Disable updated version check. ··· 46 }) 47 ]; 48 49 postPatch = '' 50 substituteInPlace oldanki/lang.py --subst-var-by anki $out 51 substituteInPlace anki/lang.py --subst-var-by anki $out ··· 58 rm "locale/"*.qm 59 ''; 60 61 installPhase = '' 62 pp=$out/lib/${python.libPrefix}/site-packages 63 ··· 87 wrapPythonPrograms 88 ''; 89 90 - meta = { 91 homepage = http://ankisrs.net/; 92 description = "Spaced repetition flashcard program"; 93 - license = stdenv.lib.licenses.gpl3; 94 95 longDescription = '' 96 Anki is a program which makes remembering things easy. Because it is a lot ··· 105 or even practicing guitar chords! 106 ''; 107 108 - maintainers = with stdenv.lib.maintainers; [ the-kenny ]; 109 - platforms = stdenv.lib.platforms.mesaPlatforms; 110 }; 111 }
··· 1 + { stdenv 2 + , buildPythonPackage 3 + , callPackage 4 + , lib 5 + , python 6 + , fetchurl 7 + , substituteAll 8 + , lame 9 + , mplayer 10 , libpulseaudio 11 + , pyqt4 12 + , sqlalchemy 13 + , pyaudio 14 + , httplib2 15 + , matplotlib 16 + , pytest 17 + , glibcLocales 18 + , nose 19 # This little flag adds a huge number of dependencies, but we assume that 20 # everyone wants Anki to draw plots with statistics by default. 21 , plotsSupport ? true 22 }: 23 24 let 25 # Development version of anki has bumped to beautifulsoup4 26 + beautifulsoup = callPackage ./beautifulsoup.nix { }; 27 28 + qt4 = pyqt4.qt; 29 + 30 + in buildPythonPackage rec { 31 + version = "2.0.47"; 32 name = "anki-${version}"; 33 + 34 src = fetchurl { 35 urls = [ 36 "https://apps.ankiweb.net/downloads/current/${name}-source.tgz" ··· 40 sha256 = "067bsidqzy1zc301i2pk4biwp2kwvgk4kydp5z5s551acinkbdgv"; 41 }; 42 43 + propagatedBuildInputs = [ pyqt4 sqlalchemy pyaudio beautifulsoup httplib2 ] 44 + ++ lib.optional plotsSupport matplotlib; 45 46 + checkInputs = [ pytest glibcLocales nose ]; 47 48 + buildInputs = [ lame mplayer libpulseaudio ]; 49 50 patches = [ 51 # Disable updated version check. ··· 58 }) 59 ]; 60 61 + buildPhase = '' 62 + # Dummy build phase 63 + # Anki does not use setup.py 64 + ''; 65 + 66 postPatch = '' 67 substituteInPlace oldanki/lang.py --subst-var-by anki $out 68 substituteInPlace anki/lang.py --subst-var-by anki $out ··· 75 rm "locale/"*.qm 76 ''; 77 78 + # UTF-8 locale needed for testing 79 + LC_ALL = "en_US.UTF-8"; 80 + 81 + checkPhase = '' 82 + # - Anki writes some files to $HOME during tests 83 + # - Skip tests using network 84 + env HOME=$TMP pytest --ignore tests/test_sync.py 85 + ''; 86 + 87 installPhase = '' 88 pp=$out/lib/${python.libPrefix}/site-packages 89 ··· 113 wrapPythonPrograms 114 ''; 115 116 + meta = with stdenv.lib; { 117 homepage = http://ankisrs.net/; 118 description = "Spaced repetition flashcard program"; 119 + license = licenses.gpl3; 120 121 longDescription = '' 122 Anki is a program which makes remembering things easy. Because it is a lot ··· 131 or even practicing guitar chords! 132 ''; 133 134 + maintainers = with maintainers; [ the-kenny ]; 135 + platforms = platforms.mesaPlatforms; 136 }; 137 }
+1 -1
pkgs/top-level/all-packages.nix
··· 17638 17639 angband = callPackage ../games/angband { }; 17640 17641 - anki = callPackage ../games/anki { }; 17642 17643 armagetronad = callPackage ../games/armagetronad { }; 17644
··· 17638 17639 angband = callPackage ../games/angband { }; 17640 17641 + anki = python2Packages.callPackage ../games/anki { }; 17642 17643 armagetronad = callPackage ../games/armagetronad { }; 17644