python3Packages.ffmpy: unbreak build with uv-build >=0.8.0 (#426347)

This commit is contained in:
Gaétan Lepage 2025-07-22 13:57:00 +02:00 committed by GitHub
commit d04876e8e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -24,22 +24,29 @@ buildPythonPackage rec {
hash = "sha256-U20mBg+428kkka6NY9qc7X8jH8A5bKa++g2+PTn/MYg="; hash = "sha256-U20mBg+428kkka6NY9qc7X8jH8A5bKa++g2+PTn/MYg=";
}; };
postPatch = '' postPatch =
# default to store ffmpeg # Default to store ffmpeg.
''
substituteInPlace ffmpy/ffmpy.py \ substituteInPlace ffmpy/ffmpy.py \
--replace-fail \ --replace-fail \
'executable: str = "ffmpeg",' \ 'executable: str = "ffmpeg",' \
'executable: str = "${ffmpeg-headless}/bin/ffmpeg",' 'executable: str = "${lib.getExe ffmpeg-headless}",'
''
# The tests test a mock that does not behave like ffmpeg. If we default to the nix-store ffmpeg they fail. # The tests test a mock that does not behave like ffmpeg. If we default to the nix-store ffmpeg they fail.
+ ''
for fname in tests/*.py; do for fname in tests/*.py; do
echo >>"$fname" 'FFmpeg.__init__.__defaults__ = ("ffmpeg", *FFmpeg.__init__.__defaults__[1:])' echo >>"$fname" 'FFmpeg.__init__.__defaults__ = ("ffmpeg", *FFmpeg.__init__.__defaults__[1:])'
done done
''
# uv-build in nixpkgs is now at 0.8.0, which otherwise breaks the constraint set by the package.
+ ''
substituteInPlace pyproject.toml \
--replace-fail 'requires = ["uv_build>=0.7.9,<0.8.0"]' 'requires = ["uv_build>=0.7.9,<0.9.0"]'
''; '';
pythonImportsCheck = [ "ffmpy" ]; pythonImportsCheck = [ "ffmpy" ];
nativeBuildInputs = [ uv-build ]; build-system = [ uv-build ];
nativeCheckInputs = [ nativeCheckInputs = [
pytestCheckHook pytestCheckHook