1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, mpv
6, setuptools
7}:
8
9buildPythonPackage rec {
10 pname = "mpv";
11 version = "1.0.4";
12 format = "pyproject";
13
14 src = fetchFromGitHub {
15 owner = "jaseg";
16 repo = "python-mpv";
17 rev = "v${version}";
18 hash = "sha256-qP5Biw4sTLioAhmMZX+Pemue2PWc3N7afAe38dwJv3U=";
19 };
20
21 nativeBuildInputs = [
22 setuptools
23 ];
24
25 buildInputs = [ mpv ];
26
27 postPatch = ''
28 substituteInPlace mpv.py \
29 --replace "sofile = ctypes.util.find_library('mpv')" \
30 'sofile = "${mpv}/lib/libmpv${stdenv.hostPlatform.extensions.sharedLibrary}"'
31 '';
32
33 # tests impure, will error if it can't load libmpv.so
34 doCheck = false;
35 pythonImportsCheck = [ "mpv" ];
36
37 meta = with lib; {
38 description = "A python interface to the mpv media player";
39 homepage = "https://github.com/jaseg/python-mpv";
40 license = licenses.agpl3Plus;
41 maintainers = with maintainers; [ onny ];
42 };
43}