1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, cffi
6, libspotify
7}:
8
9buildPythonPackage rec {
10 pname = "pyspotify";
11 version = "2.1.3";
12
13 src = fetchFromGitHub {
14 owner = "mopidy";
15 repo = "pyspotify";
16 rev = "v${version}";
17 sha256 = "sha256-CjIRwSlR5HPOJ9tp7lrdcDPiKH3p/PxvEJ8sqVD5s3Q=";
18 };
19
20 propagatedBuildInputs = [ cffi ];
21 buildInputs = [ libspotify ];
22
23 # python zip complains about old timestamps
24 preConfigure = ''
25 find -print0 | xargs -0 touch
26 '';
27
28 postInstall = lib.optionalString stdenv.isDarwin ''
29 find "$out" -name _spotify.so -exec \
30 install_name_tool -change \
31 @loader_path/../Frameworks/libspotify.framework/libspotify \
32 ${libspotify}/lib/libspotify.dylib \
33 {} \;
34 '';
35
36 # There are no tests
37 doCheck = false;
38
39 meta = with lib; {
40 homepage = "http://pyspotify.mopidy.com";
41 description = "A Python interface to Spotify’s online music streaming service";
42 license = licenses.unfree;
43 maintainers = with maintainers; [ lovek323 ];
44 };
45}