nixpkgs/pkgs/development/python-modules/mpv/default.nix
2020-05-23 18:57:32 +00:00

34 lines
863 B
Nix

{ stdenv, buildPythonPackage, fetchFromGitHub, python, isPy27
, mpv
}:
buildPythonPackage rec {
pname = "mpv";
version = "0.4.6";
disabled = isPy27;
src = fetchFromGitHub {
owner = "jaseg";
repo = "python-mpv";
rev = "v${version}";
sha256 = "1fh0fdv0k2yz7l6a62hf2svpgz34dzn84sh8fnv2x7wrkwd6r8qn";
};
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;
};
}