diff --git a/pkgs/development/python-modules/swspotify/default.nix b/pkgs/development/python-modules/swspotify/default.nix index b1fc4d128cf..1e1a9fd9cea 100644 --- a/pkgs/development/python-modules/swspotify/default.nix +++ b/pkgs/development/python-modules/swspotify/default.nix @@ -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 ]; + nativeBuildInputs = [ + poetry-core + ]; - propagatedBuildInputs = [ requests flask flask-cors ] - ++ lib.optionals stdenv.isLinux [ dbus-python ]; + propagatedBuildInputs = [ + dbus-python + flask + flask-cors + requests + ]; - doCheck = !stdenv.isDarwin; - - checkPhase = '' - pytest tests/test_spotify.py::${if stdenv.isDarwin then "DarwinTests" else "LinuxTests"} + 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; }; }