diff --git a/pkgs/development/python-modules/mpv/default.nix b/pkgs/development/python-modules/mpv/default.nix index cd9ca9451b8b..f5ae020c71c6 100644 --- a/pkgs/development/python-modules/mpv/default.nix +++ b/pkgs/development/python-modules/mpv/default.nix @@ -1,25 +1,33 @@ -{ stdenv -, buildPythonPackage -, fetchPypi -, pkgs +{ stdenv, buildPythonPackage, fetchFromGitHub, python, isPy27 +, mpv }: buildPythonPackage rec { pname = "mpv"; - version = "0.1"; + version = "0.3.9"; + disabled = isPy27; - src = fetchPypi { - inherit pname version; - sha256 = "0b9kd70mshdr713f3l1lbnz1q0vlg2y76h5d8liy1bzqm7hjcgfw"; + src = fetchFromGitHub { + owner = "jaseg"; + repo = "python-mpv"; + rev = "v${version}"; + sha256 = "112kr9wppcyy3shsb7v7kq0s1pdw6vw3v2fvqicm7qb2f49y2p4q"; }; - buildInputs = [ pkgs.mpv ]; - patchPhase = "substituteInPlace mpv.py --replace libmpv.so ${pkgs.mpv}/lib/libmpv.so"; + buildInputs = [ mpv ]; + + postPatch = '' + substituteInPlace mpv.py \ + --replace "sofile = ctypes.util.find_library('mpv')" \ + 'sofile = "${mpv}/lib/libmpv${stdenv.targetPlatform.extensions.sharedLibrary}"' + ''; + + # tests impure, will error if it can't load libmpv.so + checkPhase = "${python.interpreter} -c 'import mpv'"; meta = with stdenv.lib; { description = "A python interface to the mpv media player"; homepage = "https://github.com/jaseg/python-mpv"; license = licenses.agpl3; }; - } diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 6b89401cb958..043a443f172c 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3712,7 +3712,7 @@ in { mpd2 = callPackage ../development/python-modules/mpd2 { }; - mpv = callPackage ../development/python-modules/mpv { }; + mpv = callPackage ../development/python-modules/mpv { mpv = pkgs.mpv; }; mrbob = callPackage ../development/python-modules/mrbob {};