1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 ffmpeg-full,
7 pytestCheckHook,
8 pythonOlder,
9 setuptools,
10 substituteAll,
11}:
12
13buildPythonPackage rec {
14 pname = "pydub";
15 version = "0.25.1";
16 pyproject = true;
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "jiaaro";
22 repo = "pydub";
23 rev = "refs/tags/v${version}";
24 hash = "sha256-FTEMT47wPXK5i4ZGjTVAhI/NjJio3F2dbBZzYzClU3c=";
25 };
26
27 patches = [
28 # Fix test assertions, https://github.com/jiaaro/pydub/pull/769
29 (fetchpatch {
30 name = "fix-assertions.patch";
31 url = "https://github.com/jiaaro/pydub/commit/66c1bf7813ae8621a71484fdcdf609734c0d8efd.patch";
32 hash = "sha256-3OIzvTgGK3r4/s5y7izHvouB4uJEmjO6cgKvegtTf7A=";
33 })
34 # Fix paths to ffmpeg, ffplay and ffprobe
35 (substituteAll {
36 src = ./ffmpeg-fix-path.patch;
37 ffmpeg = lib.getExe ffmpeg-full;
38 ffplay = lib.getExe' ffmpeg-full "ffplay";
39 ffprobe = lib.getExe' ffmpeg-full "ffprobe";
40 })
41 ];
42
43 nativeBuildInputs = [ setuptools ];
44
45 nativeCheckInputs = [
46 pytestCheckHook
47 ];
48
49 pythonImportsCheck = [
50 "pydub"
51 "pydub.audio_segment"
52 "pydub.playback"
53 ];
54
55 pytestFlagsArray = [ "test/test.py" ];
56
57 meta = with lib; {
58 description = "Manipulate audio with a simple and easy high level interface";
59 homepage = "http://pydub.com";
60 changelog = "https://github.com/jiaaro/pydub/blob/v${version}/CHANGELOG.md";
61 license = licenses.mit;
62 maintainers = [ ];
63 };
64}