diff --git a/pkgs/development/python-modules/python-ffmpeg/default.nix b/pkgs/development/python-modules/python-ffmpeg/default.nix index 1991f7492667..0641ab386b5f 100644 --- a/pkgs/development/python-modules/python-ffmpeg/default.nix +++ b/pkgs/development/python-modules/python-ffmpeg/default.nix @@ -1,24 +1,46 @@ { lib, buildPythonPackage, + fetchFromGitHub, + ffmpeg-headless, + setuptools, pyee, - fetchPypi, - setuptools-scm, + pytestCheckHook, + pytest-asyncio, }: buildPythonPackage rec { - pname = "python_ffmpeg"; + pname = "python-ffmpeg"; version = "2.0.12"; pyproject = true; - src = fetchPypi { - inherit pname version; - sha256 = "GayAr1oGSi9TwkWvGpCbLXZI6gRVANltO81Qe4jUPcc="; + src = fetchFromGitHub { + owner = "jonghwanhyeon"; + repo = "python-ffmpeg"; + tag = "v${version}"; + hash = "sha256-1dhkjrg7QUtYSyEV9c88HphdcFuSCSaGJqVAQmMF/5E="; }; - propagatedBuildInputs = [ pyee ]; + postPatch = '' + substituteInPlace ffmpeg/{ffmpeg.py,asyncio/ffmpeg.py,protocol.py} \ + --replace-fail 'executable: str = "ffmpeg"' 'executable: str = "${lib.getExe ffmpeg-headless}"' + substituteInPlace tests/helpers.py \ + --replace-fail '"ffprobe"' '"${lib.getExe' ffmpeg-headless "ffprobe"}"' + + # Some systems can finish before the `0.1` timeout. + substituteInPlace tests/test_{,asyncio_}timeout.py \ + --replace-fail 'ffmpeg.execute(timeout=0.1)' 'ffmpeg.execute(timeout=0.01)' + ''; + + build-system = [ setuptools ]; + + dependencies = [ pyee ]; + + nativeCheckInputs = [ + pytestCheckHook + pytest-asyncio + ]; - nativeBuildInputs = [ setuptools-scm ]; pythonImportsCheck = [ "ffmpeg" ]; meta = {