<commit_before>{ stdenv, fetchFromGitHub, pythonPackages, file, less
, imagePreviewSupport ? true, w3m ? null}:

with stdenv.lib;

assert imagePreviewSupport -> w3m != null;

pythonPackages.buildPythonApplication rec {
  name = "ranger-v${version}";
  version = "1.9.0";

  src = fetchFromGitHub {
    owner = "ranger";
    repo = "ranger";
    rev = "v${version}";
    sha256= "0h3qz0sr21390xdshhlfisvscja33slv1plzcisg1wrdgwgyr5j6";
  };

  checkInputs = with pythonPackages; [ pytest ];
  propagatedBuildInputs = [ file ];

  checkPhase = ''
    py.test tests
  '';

  preConfigure = ''
    substituteInPlace ranger/data/scope.sh \
      --replace "/bin/echo" "echo"

    substituteInPlace ranger/__init__.py \
      --replace "DEFAULT_PAGER = 'less'" "DEFAULT_PAGER = '${stdenv.lib.getBin less}/bin/less'"

    for i in ranger/config/rc.conf doc/config/rc.conf ; do<commit_msg>ranger: don't include "v" in nix-perceived version<commit_after>{ stdenv, fetchFromGitHub, pythonPackages, file, less
, imagePreviewSupport ? true, w3m ? null}:

with stdenv.lib;

assert imagePreviewSupport -> w3m != null;

pythonPackages.buildPythonApplication rec {
  name = "ranger-${version}";
  version = "1.9.0";

  src = fetchFromGitHub {
    owner = "ranger";
    repo = "ranger";
    rev = "v${version}";
    sha256= "0h3qz0sr21390xdshhlfisvscja33slv1plzcisg1wrdgwgyr5j6";
  };

  checkInputs = with pythonPackages; [ pytest ];
  propagatedBuildInputs = [ file ];

  checkPhase = ''
    py.test tests
  '';

  preConfigure = ''
    substituteInPlace ranger/data/scope.sh \
      --replace "/bin/echo" "echo"

    substituteInPlace ranger/__init__.py \
      --replace "DEFAULT_PAGER = 'less'" "DEFAULT_PAGER = '${stdenv.lib.getBin less}/bin/less'"

    for i in ranger/config/rc.conf doc/config/rc.conf ; do
{'fraction_non_alphanumeric': 0.1364142538975501, 'fraction_numerical': 0.024498886414253896, 'mean_word_length': 3.6076923076923078, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7647463', 'n_tokens_mistral': 686, 'n_tokens_neox': 664, 'n_words': 127}