<commit_before>{ stdenv, fetchurl, python, pyqt5, sip_4_16, poppler_utils, pkgconfig, libpng
, imagemagick, libjpeg, fontconfig, podofo, qtbase, icu, sqlite
, makeWrapper, unrarSupport ? false, chmlib, pythonPackages, xz, libusb1, libmtp
, xdg_utils
}:

stdenv.mkDerivation rec {
  version = "2.50.1";
  name = "calibre-${version}";

  src = fetchurl {
    url = "http://download.calibre-ebook.com/${version}/${name}.tar.xz";
    sha256 = "0fy5fwj53hl8bcl412d2y61xm1nmkry24dlanj07nn6dhmrs0cm9";
  };

  inherit python;

  patches = [
    # Patch from Debian that switches the version update change from
    # enabled by default to disabled by default.
    ./no_updates_dialog.patch
  ] ++ stdenv.lib.optional (!unrarSupport) ./dont_build_unrar_plugin.patch;

  prePatch = ''<commit_msg>calibre: 2.50.1 -> 2.51.0<commit_after>{ stdenv, fetchurl, python, pyqt5, sip_4_16, poppler_utils, pkgconfig, libpng
, imagemagick, libjpeg, fontconfig, podofo, qtbase, icu, sqlite
, makeWrapper, unrarSupport ? false, chmlib, pythonPackages, xz, libusb1, libmtp
, xdg_utils
}:

stdenv.mkDerivation rec {
  version = "2.51.0";
  name = "calibre-${version}";

  src = fetchurl {
    url = "http://download.calibre-ebook.com/${version}/${name}.tar.xz";
    sha256 = "1rhpcxic4g2zyr5s3xn8dayyb45l9r8zyniaig8j7pl5kmsfjijn";
  };

  inherit python;

  patches = [
    # Patch from Debian that switches the version update change from
    # enabled by default to disabled by default.
    ./no_updates_dialog.patch
  ] ++ stdenv.lib.optional (!unrarSupport) ./dont_build_unrar_plugin.patch;

  prePatch = ''
{'fraction_non_alphanumeric': 0.1268939393939394, 'fraction_numerical': 0.04040404040404041, 'mean_word_length': 4.301003344481606, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6877001', 'n_tokens_mistral': 645, 'n_tokens_neox': 604, 'n_words': 126}