anki: Enable tests (#31582)
* anki: Enable tests Convert package to use buildPythonApplication instead of mkDerivation * anki: ignore tests via pytest arguments
This commit is contained in:
committed by
Jörg Thalheim
parent
1a102a36ba
commit
d3cb4de970
@@ -1,6 +1,6 @@
|
|||||||
{ pythonPackages, isPy3k, pkgs }:
|
{ buildPythonPackage, isPy3k, pkgs }:
|
||||||
|
|
||||||
pythonPackages.buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
name = "beautifulsoup-3.2.1";
|
name = "beautifulsoup-3.2.1";
|
||||||
disabled = isPy3k;
|
disabled = isPy3k;
|
||||||
|
|
||||||
|
|||||||
+45
-19
@@ -1,24 +1,36 @@
|
|||||||
{ stdenv, lib, fetchurl, substituteAll, lame, mplayer
|
{ stdenv
|
||||||
|
, buildPythonPackage
|
||||||
|
, callPackage
|
||||||
|
, lib
|
||||||
|
, python
|
||||||
|
, fetchurl
|
||||||
|
, substituteAll
|
||||||
|
, lame
|
||||||
|
, mplayer
|
||||||
, libpulseaudio
|
, libpulseaudio
|
||||||
|
, pyqt4
|
||||||
|
, sqlalchemy
|
||||||
|
, pyaudio
|
||||||
|
, httplib2
|
||||||
|
, matplotlib
|
||||||
|
, pytest
|
||||||
|
, glibcLocales
|
||||||
|
, nose
|
||||||
# This little flag adds a huge number of dependencies, but we assume that
|
# This little flag adds a huge number of dependencies, but we assume that
|
||||||
# everyone wants Anki to draw plots with statistics by default.
|
# everyone wants Anki to draw plots with statistics by default.
|
||||||
, plotsSupport ? true
|
, plotsSupport ? true
|
||||||
, python2Packages
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
version = "2.0.47";
|
# Development version of anki has bumped to beautifulsoup4
|
||||||
inherit (python2Packages) python wrapPython sqlalchemy pyaudio beautifulsoup4 httplib2 matplotlib pyqt4;
|
beautifulsoup = callPackage ./beautifulsoup.nix { };
|
||||||
|
|
||||||
qt4 = pyqt4.qt;
|
qt4 = pyqt4.qt;
|
||||||
|
|
||||||
# Development version of anki has bumped to beautifulsoup4
|
in buildPythonPackage rec {
|
||||||
beautifulsoup = python2Packages.callPackage ./beautifulsoup.nix {
|
version = "2.0.47";
|
||||||
pythonPackages = python2Packages;
|
|
||||||
};
|
|
||||||
|
|
||||||
in
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
name = "anki-${version}";
|
name = "anki-${version}";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
urls = [
|
urls = [
|
||||||
"https://apps.ankiweb.net/downloads/current/${name}-source.tgz"
|
"https://apps.ankiweb.net/downloads/current/${name}-source.tgz"
|
||||||
@@ -28,12 +40,12 @@ stdenv.mkDerivation rec {
|
|||||||
sha256 = "067bsidqzy1zc301i2pk4biwp2kwvgk4kydp5z5s551acinkbdgv";
|
sha256 = "067bsidqzy1zc301i2pk4biwp2kwvgk4kydp5z5s551acinkbdgv";
|
||||||
};
|
};
|
||||||
|
|
||||||
pythonPath = [ pyqt4 sqlalchemy pyaudio beautifulsoup httplib2 ]
|
propagatedBuildInputs = [ pyqt4 sqlalchemy pyaudio beautifulsoup httplib2 ]
|
||||||
++ lib.optional plotsSupport matplotlib;
|
++ lib.optional plotsSupport matplotlib;
|
||||||
|
|
||||||
buildInputs = [ python wrapPython lame mplayer libpulseaudio ];
|
checkInputs = [ pytest glibcLocales nose ];
|
||||||
|
|
||||||
phases = [ "unpackPhase" "patchPhase" "installPhase" ];
|
buildInputs = [ lame mplayer libpulseaudio ];
|
||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
# Disable updated version check.
|
# Disable updated version check.
|
||||||
@@ -46,6 +58,11 @@ stdenv.mkDerivation rec {
|
|||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
# Dummy build phase
|
||||||
|
# Anki does not use setup.py
|
||||||
|
'';
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
substituteInPlace oldanki/lang.py --subst-var-by anki $out
|
substituteInPlace oldanki/lang.py --subst-var-by anki $out
|
||||||
substituteInPlace anki/lang.py --subst-var-by anki $out
|
substituteInPlace anki/lang.py --subst-var-by anki $out
|
||||||
@@ -58,6 +75,15 @@ stdenv.mkDerivation rec {
|
|||||||
rm "locale/"*.qm
|
rm "locale/"*.qm
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# UTF-8 locale needed for testing
|
||||||
|
LC_ALL = "en_US.UTF-8";
|
||||||
|
|
||||||
|
checkPhase = ''
|
||||||
|
# - Anki writes some files to $HOME during tests
|
||||||
|
# - Skip tests using network
|
||||||
|
env HOME=$TMP pytest --ignore tests/test_sync.py
|
||||||
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
pp=$out/lib/${python.libPrefix}/site-packages
|
pp=$out/lib/${python.libPrefix}/site-packages
|
||||||
|
|
||||||
@@ -87,10 +113,10 @@ stdenv.mkDerivation rec {
|
|||||||
wrapPythonPrograms
|
wrapPythonPrograms
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = with stdenv.lib; {
|
||||||
homepage = http://ankisrs.net/;
|
homepage = http://ankisrs.net/;
|
||||||
description = "Spaced repetition flashcard program";
|
description = "Spaced repetition flashcard program";
|
||||||
license = stdenv.lib.licenses.gpl3;
|
license = licenses.gpl3;
|
||||||
|
|
||||||
longDescription = ''
|
longDescription = ''
|
||||||
Anki is a program which makes remembering things easy. Because it is a lot
|
Anki is a program which makes remembering things easy. Because it is a lot
|
||||||
@@ -105,7 +131,7 @@ stdenv.mkDerivation rec {
|
|||||||
or even practicing guitar chords!
|
or even practicing guitar chords!
|
||||||
'';
|
'';
|
||||||
|
|
||||||
maintainers = with stdenv.lib.maintainers; [ the-kenny ];
|
maintainers = with maintainers; [ the-kenny ];
|
||||||
platforms = stdenv.lib.platforms.mesaPlatforms;
|
platforms = platforms.mesaPlatforms;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17638,7 +17638,7 @@ with pkgs;
|
|||||||
|
|
||||||
angband = callPackage ../games/angband { };
|
angband = callPackage ../games/angband { };
|
||||||
|
|
||||||
anki = callPackage ../games/anki { };
|
anki = python2Packages.callPackage ../games/anki { };
|
||||||
|
|
||||||
armagetronad = callPackage ../games/armagetronad { };
|
armagetronad = callPackage ../games/armagetronad { };
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user