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