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