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