Skip to content

Commit fcd67e5

Browse files
committed
python3Packages.python-ffmpeg: give ffmpeg access, run tests
1 parent 2af6de6 commit fcd67e5

File tree

1 file changed

+30
-8
lines changed
  • pkgs/development/python-modules/python-ffmpeg

1 file changed

+30
-8
lines changed

pkgs/development/python-modules/python-ffmpeg/default.nix

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,46 @@
11
{
22
lib,
33
buildPythonPackage,
4+
fetchFromGitHub,
5+
ffmpeg-headless,
6+
setuptools,
47
pyee,
5-
fetchPypi,
6-
setuptools-scm,
8+
pytestCheckHook,
9+
pytest-asyncio,
710
}:
811

912
buildPythonPackage rec {
10-
pname = "python_ffmpeg";
13+
pname = "python-ffmpeg";
1114
version = "2.0.12";
1215
pyproject = true;
1316

14-
src = fetchPypi {
15-
inherit pname version;
16-
sha256 = "GayAr1oGSi9TwkWvGpCbLXZI6gRVANltO81Qe4jUPcc=";
17+
src = fetchFromGitHub {
18+
owner = "jonghwanhyeon";
19+
repo = "python-ffmpeg";
20+
tag = "v${version}";
21+
hash = "sha256-1dhkjrg7QUtYSyEV9c88HphdcFuSCSaGJqVAQmMF/5E=";
1722
};
1823

19-
propagatedBuildInputs = [ pyee ];
24+
postPatch = ''
25+
substituteInPlace ffmpeg/{ffmpeg.py,asyncio/ffmpeg.py,protocol.py} \
26+
--replace-fail 'executable: str = "ffmpeg"' 'executable: str = "${lib.getExe ffmpeg-headless}"'
27+
substituteInPlace tests/helpers.py \
28+
--replace-fail '"ffprobe"' '"${lib.getExe' ffmpeg-headless "ffprobe"}"'
29+
30+
# Some systems can finish before the `0.1` timeout.
31+
substituteInPlace tests/test_{,asyncio_}timeout.py \
32+
--replace-fail 'ffmpeg.execute(timeout=0.1)' 'ffmpeg.execute(timeout=0.01)'
33+
'';
34+
35+
build-system = [ setuptools ];
36+
37+
dependencies = [ pyee ];
38+
39+
nativeCheckInputs = [
40+
pytestCheckHook
41+
pytest-asyncio
42+
];
2043

21-
nativeBuildInputs = [ setuptools-scm ];
2244
pythonImportsCheck = [ "ffmpeg" ];
2345

2446
meta = {

0 commit comments

Comments
 (0)