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