2021-12-06 16:07:01 +00:00
|
|
|
{ lib, stdenv, buildPythonPackage, fetchFromGitHub, requests
|
|
|
|
, pytestCheckHook, flask, flask-cors, dbus-python, mock, isPy27 }:
|
2020-10-11 12:50:04 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "SwSpotify";
|
2021-12-06 16:07:01 +00:00
|
|
|
version = "1.2.2";
|
2020-10-11 12:50:04 +00:00
|
|
|
disabled = isPy27;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "SwagLyrics";
|
|
|
|
repo = "SwSpotify";
|
|
|
|
rev = "v${version}";
|
2021-12-06 16:07:01 +00:00
|
|
|
sha256 = "sha256-571knnY8LegIbqyPeKUfl+d0suTWAMQHYLN7edKFNdI=";
|
2020-10-11 12:50:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2021-12-06 16:07:01 +00:00
|
|
|
requests flask flask-cors dbus-python
|
2020-10-11 12:50:04 +00:00
|
|
|
];
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
postPatch = ''
|
2020-10-11 12:50:04 +00:00
|
|
|
substituteInPlace setup.py \
|
2021-12-06 16:07:01 +00:00
|
|
|
--replace 'flask==2.0.1' 'flask'
|
2020-10-11 12:50:04 +00:00
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
doCheck = !stdenv.isDarwin;
|
|
|
|
|
2020-10-11 12:50:04 +00:00
|
|
|
checkPhase = ''
|
2021-12-06 16:07:01 +00:00
|
|
|
pytest tests/test_spotify.py::${if stdenv.isDarwin then "DarwinTests" else "LinuxTests"}
|
2020-10-11 12:50:04 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
checkInputs = [ pytestCheckHook mock ];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
pythonImportsCheck = [ "SwSpotify" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
2020-10-11 12:50:04 +00:00
|
|
|
homepage = "https://github.com/SwagLyrics/SwSpotify";
|
|
|
|
description = "Library to get the currently playing song and artist from Spotify";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ siraben ];
|
2021-12-06 16:07:01 +00:00
|
|
|
platforms = platforms.unix;
|
2020-10-11 12:50:04 +00:00
|
|
|
};
|
|
|
|
}
|