ranger: cleanup, use pytestCheckHook

This commit is contained in:
Sandro Jäckel 2021-02-12 04:16:32 +01:00
parent f787a71451
commit b2bc6ccc65
No known key found for this signature in database
GPG Key ID: 3AF5A43A3EECC2E5

View File

@ -1,12 +1,8 @@
{ lib, fetchFromGitHub, python3Packages, file, less, highlight { lib, fetchFromGitHub, python3Packages, file, less, highlight
, imagePreviewSupport ? true, w3m ? null}: , imagePreviewSupport ? true, w3m }:
with lib;
assert imagePreviewSupport -> w3m != null;
python3Packages.buildPythonApplication rec { python3Packages.buildPythonApplication rec {
name = "ranger-${version}"; pname = "ranger";
version = "1.9.3"; version = "1.9.3";
src = fetchFromGitHub { src = fetchFromGitHub {
@ -18,14 +14,10 @@ python3Packages.buildPythonApplication rec {
LC_ALL = "en_US.UTF-8"; LC_ALL = "en_US.UTF-8";
checkInputs = with python3Packages; [ pytest ]; checkInputs = with python3Packages; [ pytestCheckHook ];
propagatedBuildInputs = [ file ] propagatedBuildInputs = [ file ]
++ lib.optionals (imagePreviewSupport) [ python3Packages.pillow ]; ++ lib.optionals (imagePreviewSupport) [ python3Packages.pillow ];
checkPhase = ''
py.test tests
'';
preConfigure = '' preConfigure = ''
${lib.optionalString (highlight != null) '' ${lib.optionalString (highlight != null) ''
sed -i -e 's|^\s*highlight\b|${highlight}/bin/highlight|' \ sed -i -e 's|^\s*highlight\b|${highlight}/bin/highlight|' \
@ -45,7 +37,7 @@ python3Packages.buildPythonApplication rec {
# give file previews out of the box # give file previews out of the box
substituteInPlace ranger/config/rc.conf \ substituteInPlace ranger/config/rc.conf \
--replace "#set preview_script ~/.config/ranger/scope.sh" "set preview_script $out/share/doc/ranger/config/scope.sh" --replace "#set preview_script ~/.config/ranger/scope.sh" "set preview_script $out/share/doc/ranger/config/scope.sh"
'' + optionalString imagePreviewSupport '' '' + lib.optionalString imagePreviewSupport ''
substituteInPlace ranger/ext/img_display.py \ substituteInPlace ranger/ext/img_display.py \
--replace /usr/lib/w3m ${w3m}/libexec/w3m --replace /usr/lib/w3m ${w3m}/libexec/w3m
@ -57,8 +49,8 @@ python3Packages.buildPythonApplication rec {
meta = with lib; { meta = with lib; {
description = "File manager with minimalistic curses interface"; description = "File manager with minimalistic curses interface";
homepage = "http://ranger.github.io/"; homepage = "http://ranger.github.io/";
license = licenses.gpl3; license = licenses.gpl3Only;
platforms = platforms.unix; platforms = platforms.unix;
maintainers = [ maintainers.toonn maintainers.magnetophon ]; maintainers = with maintainers; [ toonn magnetophon ];
}; };
} }