<commit_before>{ stdenv, fetchurl, python2, libxslt, texlive
, enableAllFeatures ? false, imagemagick ? null, transfig ? null, inkscape ? null, fontconfig ? null, ghostscript ? null

, tex ? texlive.combine { # satisfy all packages that ./configure mentions
    inherit (texlive) scheme-basic epstopdf anysize appendix changebar
      fancybox fancyvrb float footmisc listings jknapltx/*for mathrsfs.sty*/
      multirow overpic pdfpages graphics stmaryrd subfigure titlesec wasysym
      # pkgs below don't seem requested by dblatex, but our manual fails without them
      ec zapfding symbol eepic times rsfs cs tex4ht courier helvetic ly1;
  }
}:

# NOTE: enableAllFeatures just purifies the expression, it doesn't actually
# enable any extra features.

assert enableAllFeatures ->
  imagemagick != null &&
  transfig != null &&
  inkscape != null &&
  fontconfig != null &&
  ghostscript != null;

stdenv.mkDerivation rec {
  name = "dblatex-0.3.7";

  src = fetchurl {
    url = "mirror://sourceforge/dblatex/${name}.tar.bz2";
    sha256 = "0bkjgrn03dy5c7438s429wnv6z5ynxkr4pbhp2z49kynskgkzkjr";
  };

  buildInputs = [ python2 libxslt tex ]
    ++ stdenv.lib.optionals enableAllFeatures [ imagemagick transfig ];

  # TODO: dblatex tries to execute texindy command, but nixpkgs doesn't have
  # that yet. In Ubuntu, texindy is a part of the xindy package.
  preConfigure = ''
    sed -i 's|self.install_layout == "deb"|False|' setup.py
  '' + stdenv.lib.optionalString enableAllFeatures ''
    for file in $(find -name "*.py"); do
        sed -e 's|cmd = \["xsltproc|cmd = \["${libxslt.bin}/bin/xsltproc|g' \
            -e 's|Popen(\["xsltproc|Popen(\["${libxslt.bin}/bin/xsltproc|g' \
            -e 's|cmd = \["texindy|cmd = ["nixpkgs_is_missing_texindy|g' \
            -e 's|cmd = "epstopdf|cmd = "${tex}/bin/epstopdf|g' \
            -e 's|cmd = \["makeindex|cmd = ["${tex}/bin/makeindex|g' \
            -e 's|doc.program = "pdflatex"|doc.program = "${tex}/bin/pdflatex"|g' \
            -e 's|self.program = "latex"|self.program = "${tex}/bin/latex"|g' \<commit_msg>dblatex: 0.3.7 -> 0.3.10, fixes for the new texlive<commit_after>{ stdenv, fetchurl, python2, libxslt, texlive
, enableAllFeatures ? false, imagemagick ? null, transfig ? null, inkscape ? null, fontconfig ? null, ghostscript ? null

, tex ? texlive.combine { # satisfy all packages that ./configure mentions
    inherit (texlive) scheme-basic epstopdf anysize appendix changebar
      fancybox fancyvrb float footmisc listings jknapltx/*for mathrsfs.sty*/
      multirow overpic pdfpages graphics stmaryrd subfigure titlesec wasysym
      # pkgs below don't seem requested by dblatex, but our manual fails without them
      ec zapfding symbol eepic times rsfs cs tex4ht courier helvetic ly1;
  }
}:

# NOTE: enableAllFeatures just purifies the expression, it doesn't actually
# enable any extra features.

assert enableAllFeatures ->
  imagemagick != null &&
  transfig != null &&
  inkscape != null &&
  fontconfig != null &&
  ghostscript != null;

stdenv.mkDerivation rec {
  name = "dblatex-0.3.10";

  src = fetchurl {
    url = "mirror://sourceforge/dblatex/${name}.tar.bz2";
    sha256 = "1yicd861rqz78i2khl35j7nvc0ccv4jx4hzqrbhll17082vrdmkg";
  };

  buildInputs = [ python2 libxslt tex ]
    ++ stdenv.lib.optionals enableAllFeatures [ imagemagick transfig ];

  # TODO: dblatex tries to execute texindy command, but nixpkgs doesn't have
  # that yet. In Ubuntu, texindy is a part of the xindy package.
  preConfigure = ''
    sed -i 's|self.install_layout == "deb"|False|' setup.py
  '' + stdenv.lib.optionalString enableAllFeatures ''
    for file in $(find -name "*.py"); do
        sed -e 's|cmd = \["xsltproc|cmd = \["${libxslt.bin}/bin/xsltproc|g' \
            -e 's|Popen(\["xsltproc|Popen(\["${libxslt.bin}/bin/xsltproc|g' \
            -e 's|cmd = \["texindy|cmd = ["nixpkgs_is_missing_texindy|g' \
            -e 's|cmd = "epstopdf|cmd = "${tex}/bin/epstopdf|g' \
            -e 's|cmd = \["makeindex|cmd = ["${tex}/bin/makeindex|g' \
            -e 's|doc.program = "pdflatex"|doc.program = "${tex}/bin/pdflatex"|g' \
            -e 's|self.program = "latex"|self.program = "${tex}/bin/latex"|g' \
{'fraction_non_alphanumeric': 0.13527030245296498, 'fraction_numerical': 0.015479876160990712, 'mean_word_length': 3.347826086956522, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '4144660', 'n_tokens_mistral': 1565, 'n_tokens_neox': 1480, 'n_words': 367}