<commit_before>{ stdenv
, fetchFromGitLab
, meson
, ninja
, pkgconfig
, python3
, libxml2Python
, docbook_xml_dtd_43
, docbook_xsl
, libxslt
, gettext
, gnome3
, withDblatex ? false, dblatex
}:

stdenv.mkDerivation rec {
  pname = "gtk-doc";
  version = "1.32";

  src = fetchFromGitLab {
    domain = "gitlab.gnome.org";
    owner = "GNOME";
    repo = pname;
    rev = "GTK_DOC_${stdenv.lib.replaceStrings ["."] ["_"] version }";
    sha256 = "14fihxj662gg4ln1ngff6s52zzkpbcc58qa0nxysxypnhp0h4ypk";
  };

  patches = [
    passthru.respect_xml_catalog_files_var_patch
  ];

  outputDevdoc = "out";

  nativeBuildInputs = [
    gettext
    meson
    ninja
  ];

  buildInputs = [
    docbook_xml_dtd_43
    docbook_xsl
    libxslt
    pkgconfig
    python3
    python3.pkgs.pygments # Needed for https://gitlab.gnome.org/GNOME/gtk-doc/blob/GTK_DOC_1_32/meson.build#L42
    libxml2Python
  ]
  ++ stdenv.lib.optional withDblatex dblatex
  ;

  mesonFlags = [
    "-Dtests=false"
    "-Dyelp_manual=false"
  ];

  # Make pygments available for binaries, python.withPackages creates a wrapper
  # but scripts are not allowed in shebangs so we link it into sys.path.
  postInstall = ''
    ln -s ${python3.pkgs.pygments}/${python3.sitePackages}/* $out/share/gtk-doc/python/
  '';

  doCheck = false; # requires a lot of stuff
  doInstallCheck = false; # fails<commit_msg>gtk-doc: clean up<commit_after>{ stdenv
, fetchFromGitLab
, meson
, ninja
, pkg-config
, python3
, docbook_xml_dtd_43
, docbook_xsl
, libxslt
, gettext
, gnome3
, withDblatex ? false, dblatex
}:

python3.pkgs.buildPythonApplication rec {
  pname = "gtk-doc";
  version = "1.32";

  format = "other";

  src = fetchFromGitLab {
    domain = "gitlab.gnome.org";
    owner = "GNOME";
    repo = pname;
    rev = "GTK_DOC_${stdenv.lib.replaceStrings ["."] ["_"] version }";
    sha256 = "14fihxj662gg4ln1ngff6s52zzkpbcc58qa0nxysxypnhp0h4ypk";
  };

  patches = [
    passthru.respect_xml_catalog_files_var_patch
  ];

  outputDevdoc = "out";

  nativeBuildInputs = [
    pkg-config
    gettext
    meson
    ninja
    libxslt # for xsltproc
  ];

  buildInputs = [
    docbook_xml_dtd_43
    docbook_xsl
    libxslt
  ] ++ stdenv.lib.optionals withDblatex [
    dblatex
  ];

  pythonPath = with python3.pkgs; [
    pygments # Needed for https://gitlab.gnome.org/GNOME/gtk-doc/blob/GTK_DOC_1_32/meson.build#L42
    (anytree.override { withGraphviz = false; })
    lxml
  ];

  mesonFlags = [
    "-Dtests=false"
    "-Dyelp_manual=false"
  ];

  doCheck = false; # requires a lot of stuff
  doInstallCheck = false; # fails

  postFixup = ''
    # Do not propagate Python
    substituteInPlace $out/nix-support/propagated-build-inputs \
      --replace "${python3}" ""
  '';
{'fraction_non_alphanumeric': 0.11910851297040555, 'fraction_numerical': 0.026671538180489587, 'mean_word_length': 3.1929555895865236, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 9}, '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': '3015973', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1066, 'n_words': 186}