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