summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/ffmpeg-python/default.nix
blob: b7ae441c9f7ea89e30d4a5523c09aa047e675dea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  replaceVars,
  fetchpatch2,
  setuptools,
  pytestCheckHook,
  pytest-mock,
  ffmpeg,
}:

buildPythonPackage {
  pname = "ffmpeg-python";
  version = "0.2.0-unstable-2022-07-11";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "kkroening";
    repo = "ffmpeg-python";
    rev = "df129c7ba30aaa9ffffb81a48f53aa7253b0b4e6";
    hash = "sha256-jPiFhYRwfuS+vo6LsLw0+65NWy2A+B+EdC8SewZTRP4=";
  };

  patches = [
    (replaceVars ./ffmpeg-location.patch { inherit ffmpeg; })

    # Remove dependency on `future`
    # https://github.com/kkroening/ffmpeg-python/pull/795
    (fetchpatch2 {
      url = "https://github.com/kkroening/ffmpeg-python/commit/dce459d39ace25f03edbabdad1735064787568f7.patch?full_index=1";
      hash = "sha256-ZptCFplL88d0p2s741ymHiwyDsDGVFylBJ8FTrZDGMc=";
    })

    # Fix ffmpeg/tests/test_ffmpeg.py: test_pipe() (v1: ignore duplicate frames)
    # https://github.com/kkroening/ffmpeg-python/pull/726
    (fetchpatch2 {
      url = "https://github.com/kkroening/ffmpeg-python/commit/557ed8e81ff48c5931c9249ec4aae525347ecf85.patch?full_index=1";
      hash = "sha256-XrL9yLaBg1tu63OYZauEb/4Ghp2zHtiF6vB+1YYbv1Y=";
    })

    # Fix `test__probe` on FFmpeg 7
    # https://github.com/kkroening/ffmpeg-python/pull/848
    (fetchpatch2 {
      url = "https://github.com/kkroening/ffmpeg-python/commit/eeaa83398ba1d4e5b470196f7d4c7ca4ba9e8ddf.patch?full_index=1";
      hash = "sha256-/qxez4RF/RPRr9nA+wp+XB49L3VNgnMwMQhFD2NwijU=";
    })
  ];

  build-system = [ setuptools ];

  nativeCheckInputs = [
    pytestCheckHook
    pytest-mock
  ];

  pythonImportsCheck = [ "ffmpeg" ];

  meta = {
    description = "Python bindings for FFmpeg - with complex filtering support";
    homepage = "https://github.com/kkroening/ffmpeg-python";
    license = lib.licenses.asl20;
    maintainers = [ lib.maintainers.emily ];
  };
}