nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 66 lines 1.6 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 uv-build, 7 pytestCheckHook, 8 go, 9 ffmpeg-headless, 10}: 11 12buildPythonPackage rec { 13 pname = "ffmpy"; 14 version = "1.0.0"; 15 pyproject = true; 16 17 src = fetchFromGitHub { 18 owner = "Ch00k"; 19 repo = "ffmpy"; 20 tag = version; 21 hash = "sha256-TDE/r6qoWpkIU47+FPLqWgZAJd9FxSbZthhLh9g4evo="; 22 }; 23 24 postPatch = 25 # Default to store ffmpeg. 26 '' 27 substituteInPlace ffmpy/ffmpy.py \ 28 --replace-fail \ 29 'executable: str = "ffmpeg",' \ 30 'executable: str = "${lib.getExe ffmpeg-headless}",' 31 '' 32 # The tests test a mock that does not behave like ffmpeg. If we default to the nix-store ffmpeg they fail. 33 + '' 34 for fname in tests/*.py; do 35 echo >>"$fname" 'FFmpeg.__init__.__defaults__ = ("ffmpeg", *FFmpeg.__init__.__defaults__[1:])' 36 done 37 ''; 38 39 pythonImportsCheck = [ "ffmpy" ]; 40 41 build-system = [ uv-build ]; 42 43 nativeCheckInputs = [ 44 pytestCheckHook 45 go 46 ]; 47 48 disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [ 49 # expects a FFExecutableNotFoundError, gets a NotADirectoryError raised by os 50 "test_invalid_executable_path" 51 ]; 52 53 # the vendored ffmpeg mock binary assumes FHS 54 preCheck = '' 55 rm -v tests/ffmpeg/ffmpeg 56 echo Building tests/ffmpeg/ffmpeg... 57 HOME=$(mktemp -d) go build -o tests/ffmpeg/ffmpeg tests/ffmpeg/ffmpeg.go 58 ''; 59 60 meta = { 61 description = "Simple python interface for FFmpeg/FFprobe"; 62 homepage = "https://github.com/Ch00k/ffmpy"; 63 license = lib.licenses.mit; 64 maintainers = with lib.maintainers; [ pbsds ]; 65 }; 66}