mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-03 20:33:21 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
68 lines
1.6 KiB
Nix
68 lines
1.6 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
buildPythonPackage,
|
|
fetchFromGitHub,
|
|
pythonOlder,
|
|
poetry-core,
|
|
pytestCheckHook,
|
|
go,
|
|
ffmpeg-headless,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "ffmpy";
|
|
version = "0.4.0";
|
|
pyproject = true;
|
|
|
|
disabled = pythonOlder "3.8.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "Ch00k";
|
|
repo = "ffmpy";
|
|
rev = "refs/tags/${version}";
|
|
hash = "sha256-XWI0Hq4vf9Q0/dRzmu1B7EQHdQRkWaNJaBaqusWW7YM=";
|
|
};
|
|
|
|
postPatch = ''
|
|
# default to store ffmpeg
|
|
substituteInPlace ffmpy.py \
|
|
--replace-fail \
|
|
'executable: str = "ffmpeg",' \
|
|
'executable: str = "${ffmpeg-headless}/bin/ffmpeg",'
|
|
|
|
# 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
|
|
echo 'FFmpeg.__init__.__defaults__ = ("ffmpeg", *FFmpeg.__init__.__defaults__[1:])' >>"$fname"
|
|
done
|
|
'';
|
|
|
|
pythonImportsCheck = [ "ffmpy" ];
|
|
|
|
nativeBuildInputs = [ poetry-core ];
|
|
|
|
nativeCheckInputs = [
|
|
pytestCheckHook
|
|
go
|
|
];
|
|
|
|
disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
|
|
# expects a FFExecutableNotFoundError, gets a NotADirectoryError raised by os
|
|
"test_invalid_executable_path"
|
|
];
|
|
|
|
# the vendored ffmpeg mock binary assumes FHS
|
|
preCheck = ''
|
|
rm -v tests/ffmpeg/ffmpeg
|
|
echo Building tests/ffmpeg/ffmpeg...
|
|
HOME=$(mktemp -d) go build -o tests/ffmpeg/ffmpeg tests/ffmpeg/ffmpeg.go
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Simple python interface for FFmpeg/FFprobe";
|
|
homepage = "https://github.com/Ch00k/ffmpy";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ pbsds ];
|
|
};
|
|
}
|