1{ lib, stdenv, buildPythonPackage, fetchFromGitHub, python, isPy27
2, mpv
3}:
4
5buildPythonPackage rec {
6 pname = "mpv";
7 version = "1.0.1";
8 disabled = isPy27;
9
10 src = fetchFromGitHub {
11 owner = "jaseg";
12 repo = "python-mpv";
13 rev = "v${version}";
14 sha256 = "sha256-UCJ1PknnWQiFciTEMxTUqDzz0Z8HEWycLuQqYeyQhoM=";
15 };
16
17 buildInputs = [ mpv ];
18
19 postPatch = ''
20 substituteInPlace mpv.py \
21 --replace "sofile = ctypes.util.find_library('mpv')" \
22 'sofile = "${mpv}/lib/libmpv${stdenv.targetPlatform.extensions.sharedLibrary}"'
23 '';
24
25 # tests impure, will error if it can't load libmpv.so
26 checkPhase = "${python.interpreter} -c 'import mpv'";
27
28 meta = with lib; {
29 description = "A python interface to the mpv media player";
30 homepage = "https://github.com/jaseg/python-mpv";
31 license = licenses.agpl3Plus;
32 };
33}