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 hash = "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 doCheck = false;
27 pythonImportsCheck = [ "mpv" ];
28
29 meta = with lib; {
30 description = "A python interface to the mpv media player";
31 homepage = "https://github.com/jaseg/python-mpv";
32 license = licenses.agpl3Plus;
33 };
34}