2021-12-06 16:07:01 +00:00
|
|
|
{ lib, stdenv, buildPythonPackage, fetchFromGitHub, requests
|
2022-02-20 05:27:41 +00:00
|
|
|
, pytestCheckHook, flask, flask-cors, dbus-python, mock, isPy27
|
|
|
|
, poetry-core }:
|
2020-10-11 12:50:04 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "SwSpotify";
|
2022-02-20 05:27:41 +00:00
|
|
|
version = "1.2.3";
|
2020-10-11 12:50:04 +00:00
|
|
|
disabled = isPy27;
|
2022-02-20 05:27:41 +00:00
|
|
|
format = "pyproject";
|
2020-10-11 12:50:04 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "SwagLyrics";
|
|
|
|
repo = "SwSpotify";
|
|
|
|
rev = "v${version}";
|
2022-02-20 05:27:41 +00:00
|
|
|
sha256 = "sha256-xGLvc154xnje45Akf7H1qqQRUc03gGVt8AhGlkcP3kY=";
|
2020-10-11 12:50:04 +00:00
|
|
|
};
|
|
|
|
|
2022-02-20 05:27:41 +00:00
|
|
|
nativeBuildInputs = [ poetry-core ];
|
2020-10-11 12:50:04 +00:00
|
|
|
|
2022-02-20 05:27:41 +00:00
|
|
|
propagatedBuildInputs = [ requests flask flask-cors ]
|
|
|
|
++ lib.optionals stdenv.isLinux [ dbus-python ];
|
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
|
|
|
};
|
|
|
|
}
|