2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub, makeWrapper, python3Packages, perl, zip
|
2020-11-24 20:01:07 +01:00
|
|
|
, gitMinimal, ffmpeg }:
|
2015-01-01 16:34:58 +01:00
|
|
|
|
2016-08-14 14:28:05 +02:00
|
|
|
let
|
2019-09-14 16:47:09 +02:00
|
|
|
|
|
|
|
inherit (python3Packages)
|
2021-06-10 22:27:57 +02:00
|
|
|
python pytest nose cryptography pyyaml requests mock python-dateutil setuptools;
|
2019-09-14 16:47:09 +02:00
|
|
|
|
2016-08-14 14:28:05 +02:00
|
|
|
in stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "svtplay-dl";
|
2021-07-14 15:00:33 +02:00
|
|
|
version = "4.1";
|
2015-01-01 16:34:58 +01:00
|
|
|
|
2015-05-31 22:38:44 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "spaam";
|
|
|
|
repo = "svtplay-dl";
|
|
|
|
rev = version;
|
2021-07-14 15:00:33 +02:00
|
|
|
sha256 = "0b0q4k5aacw2nna5higr6sk5lsdn62lw2l9lccfy5s3m530banni";
|
2015-01-01 16:34:58 +01:00
|
|
|
};
|
|
|
|
|
2021-04-05 17:59:58 +02:00
|
|
|
pythonPaths = [ cryptography pyyaml requests ];
|
2021-06-10 22:27:57 +02:00
|
|
|
buildInputs = [ python perl mock python-dateutil setuptools ] ++ pythonPaths;
|
2021-02-07 10:17:39 +01:00
|
|
|
nativeBuildInputs = [ gitMinimal zip makeWrapper ];
|
2021-06-10 22:27:57 +02:00
|
|
|
checkInputs = [ nose pytest ];
|
2015-01-01 16:34:58 +01:00
|
|
|
|
|
|
|
postPatch = ''
|
2016-08-27 23:55:37 +02:00
|
|
|
substituteInPlace scripts/run-tests.sh \
|
2015-01-01 16:34:58 +01:00
|
|
|
--replace 'PYTHONPATH=lib' 'PYTHONPATH=lib:$PYTHONPATH'
|
2020-10-03 22:34:03 +02:00
|
|
|
|
|
|
|
sed -i '/def test_sublang2\?(/ i\ @unittest.skip("accesses network")' \
|
|
|
|
lib/svtplay_dl/tests/test_postprocess.py
|
2015-01-01 16:34:58 +01:00
|
|
|
'';
|
|
|
|
|
2019-10-27 14:03:25 +01:00
|
|
|
makeFlags = [ "PREFIX=$(out)" "SYSCONFDIR=$(out)/etc" "PYTHON=${python.interpreter}" ];
|
2015-01-01 16:34:58 +01:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
wrapProgram "$out/bin/svtplay-dl" \
|
2020-11-24 20:01:07 +01:00
|
|
|
--prefix PATH : "${ffmpeg}" \
|
2015-01-01 16:34:58 +01:00
|
|
|
--prefix PYTHONPATH : "$PYTHONPATH"
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
2018-01-14 20:45:17 +01:00
|
|
|
checkPhase = ''
|
|
|
|
sh scripts/run-tests.sh -2
|
|
|
|
'';
|
2015-01-01 16:34:58 +01:00
|
|
|
|
2021-07-14 15:00:33 +02:00
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
$out/bin/svtplay-dl --help > /dev/null
|
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/spaam/svtplay-dl";
|
2015-01-01 16:34:58 +01:00
|
|
|
description = "Command-line tool to download videos from svtplay.se and other sites";
|
|
|
|
license = licenses.mit;
|
2021-01-15 10:19:50 +01:00
|
|
|
platforms = lib.platforms.unix;
|
2015-01-01 16:34:58 +01:00
|
|
|
};
|
|
|
|
}
|