1{ lib, stdenv, buildPythonPackage, fetchFromGitHub, requests 2, pytestCheckHook, flask, flask-cors, dbus-python, mock, isPy27 }: 3 4buildPythonPackage rec { 5 pname = "SwSpotify"; 6 version = "1.2.2"; 7 disabled = isPy27; 8 9 src = fetchFromGitHub { 10 owner = "SwagLyrics"; 11 repo = "SwSpotify"; 12 rev = "v${version}"; 13 sha256 = "sha256-571knnY8LegIbqyPeKUfl+d0suTWAMQHYLN7edKFNdI="; 14 }; 15 16 propagatedBuildInputs = [ 17 requests flask flask-cors dbus-python 18 ]; 19 20 postPatch = '' 21 substituteInPlace setup.py \ 22 --replace 'flask==2.0.1' 'flask' 23 ''; 24 25 doCheck = !stdenv.isDarwin; 26 27 checkPhase = '' 28 pytest tests/test_spotify.py::${if stdenv.isDarwin then "DarwinTests" else "LinuxTests"} 29 ''; 30 31 checkInputs = [ pytestCheckHook mock ]; 32 33 pythonImportsCheck = [ "SwSpotify" ]; 34 35 meta = with lib; { 36 homepage = "https://github.com/SwagLyrics/SwSpotify"; 37 description = "Library to get the currently playing song and artist from Spotify"; 38 license = licenses.mit; 39 maintainers = with maintainers; [ siraben ]; 40 platforms = platforms.unix; 41 }; 42}