parent
9f4d90d738
commit
5599116753
@ -1,40 +1,57 @@ |
||||
{ lib, stdenv, buildPythonPackage, fetchFromGitHub, requests |
||||
, pytestCheckHook, flask, flask-cors, dbus-python, mock, isPy27 |
||||
, poetry-core }: |
||||
{ lib |
||||
, stdenv |
||||
, buildPythonPackage |
||||
, dbus-python |
||||
, fetchFromGitHub |
||||
, flask |
||||
, flask-cors |
||||
, poetry-core |
||||
, pythonOlder |
||||
, requests |
||||
}: |
||||
|
||||
buildPythonPackage rec { |
||||
pname = "SwSpotify"; |
||||
pname = "swspotify"; |
||||
version = "1.2.3"; |
||||
disabled = isPy27; |
||||
format = "pyproject"; |
||||
|
||||
disabled = pythonOlder "3.6"; |
||||
|
||||
src = fetchFromGitHub { |
||||
owner = "SwagLyrics"; |
||||
repo = "SwSpotify"; |
||||
rev = "v${version}"; |
||||
sha256 = "sha256-xGLvc154xnje45Akf7H1qqQRUc03gGVt8AhGlkcP3kY="; |
||||
hash = "sha256-xGLvc154xnje45Akf7H1qqQRUc03gGVt8AhGlkcP3kY="; |
||||
}; |
||||
|
||||
nativeBuildInputs = [ poetry-core ]; |
||||
|
||||
propagatedBuildInputs = [ requests flask flask-cors ] |
||||
++ lib.optionals stdenv.isLinux [ dbus-python ]; |
||||
|
||||
doCheck = !stdenv.isDarwin; |
||||
|
||||
checkPhase = '' |
||||
pytest tests/test_spotify.py::${if stdenv.isDarwin then "DarwinTests" else "LinuxTests"} |
||||
nativeBuildInputs = [ |
||||
poetry-core |
||||
]; |
||||
|
||||
propagatedBuildInputs = [ |
||||
dbus-python |
||||
flask |
||||
flask-cors |
||||
requests |
||||
]; |
||||
|
||||
postPatch = '' |
||||
# Detection of the platform doesn't always works with 1.2.3 |
||||
substituteInPlace pyproject.toml \ |
||||
--replace 'dbus-python = {version = "^1.2.16", platform = "linux"}' "" |
||||
''; |
||||
|
||||
checkInputs = [ pytestCheckHook mock ]; |
||||
# Tests want to use Dbus |
||||
doCheck = false; |
||||
|
||||
pythonImportsCheck = [ "SwSpotify" ]; |
||||
pythonImportsCheck = [ |
||||
"SwSpotify" |
||||
]; |
||||
|
||||
meta = with lib; { |
||||
homepage = "https://github.com/SwagLyrics/SwSpotify"; |
||||
description = "Library to get the currently playing song and artist from Spotify"; |
||||
homepage = "https://github.com/SwagLyrics/SwSpotify"; |
||||
license = licenses.mit; |
||||
maintainers = with maintainers; [ siraben ]; |
||||
platforms = platforms.unix; |
||||
}; |
||||
} |
||||
|
Loading…
Reference in new issue