nixpkgs/pkgs/tools/misc/svtplay-dl/default.nix
2021-01-15 17:12:36 +07:00

53 lines
1.4 KiB
Nix

{ lib, stdenv, fetchFromGitHub, makeWrapper, python3Packages, perl, zip
, gitMinimal, ffmpeg }:
let
inherit (python3Packages)
python nose pycrypto pyyaml requests mock python-dateutil setuptools;
in stdenv.mkDerivation rec {
pname = "svtplay-dl";
version = "2.8";
src = fetchFromGitHub {
owner = "spaam";
repo = "svtplay-dl";
rev = version;
sha256 = "1977xyxi9jfj7qra1sz7c9lk885cadpci66jvbzvnwm6d60m05lb";
};
pythonPaths = [ pycrypto pyyaml requests ];
buildInputs = [ python perl nose mock makeWrapper python-dateutil setuptools ] ++ pythonPaths;
nativeBuildInputs = [ gitMinimal zip ];
postPatch = ''
substituteInPlace scripts/run-tests.sh \
--replace 'PYTHONPATH=lib' 'PYTHONPATH=lib:$PYTHONPATH'
sed -i '/def test_sublang2\?(/ i\ @unittest.skip("accesses network")' \
lib/svtplay_dl/tests/test_postprocess.py
'';
makeFlags = [ "PREFIX=$(out)" "SYSCONFDIR=$(out)/etc" "PYTHON=${python.interpreter}" ];
postInstall = ''
wrapProgram "$out/bin/svtplay-dl" \
--prefix PATH : "${ffmpeg}" \
--prefix PYTHONPATH : "$PYTHONPATH"
'';
doCheck = true;
checkPhase = ''
sh scripts/run-tests.sh -2
'';
meta = with lib; {
homepage = "https://github.com/spaam/svtplay-dl";
description = "Command-line tool to download videos from svtplay.se and other sites";
license = licenses.mit;
platforms = lib.platforms.unix;
maintainers = [ maintainers.rycee ];
};
}