asciidoc: 8.6.9 -> 9.0.4 (#102398)

Main motivation was to port it to Python3 which is due to #101964.
So:

- Switch from asciidoc to asciidoc-py3
- Switch from Python 2 to Python 3
- This needs autoreconfHook now
- We also need to do some patching in a2x.py
- Switch to patchShebangs (more readable)
- Only input w3m if we actually build with it
This commit is contained in:
Janne Heß 2021-01-21 11:36:35 +01:00 committed by GitHub
parent df8b20163b
commit e48b0ede04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 18 deletions

View File

@ -1,5 +1,5 @@
{ fetchurl, lib, stdenv, python2
{ fetchurl, lib, stdenv, python3
, fetchFromGitHub, autoreconfHook
, enableStandardFeatures ? false
, sourceHighlight ? null
, highlight ? null
@ -144,14 +144,17 @@ let
in
stdenv.mkDerivation rec {
name = "asciidoc-8.6.9";
pname = "asciidoc";
version = "9.0.4";
src = fetchurl {
url = "mirror://sourceforge/asciidoc/${name}.tar.gz";
sha256 = "1w71nk527lq504njmaf0vzr93pgahkgzzxzglrq6bay8cw2rvnvq";
src = fetchFromGitHub {
owner = "asciidoc";
repo = "asciidoc-py3";
rev = version;
sha256 = "1gspxw5i0axymxdjzj5rmhf10gyl2gqr666gz141nv042l9dm5vi";
};
buildInputs = [ python2 unzip ];
nativeBuildInputs = [ python3 unzip autoreconfHook ];
# install filters early, so their shebangs are patched too
patchPhase = with lib; ''
@ -212,7 +215,7 @@ stdenv.mkDerivation rec {
# the odp backend already has that fix. Copy it here until fixed upstream.
sed -i "s|'/etc/asciidoc/backends/odt/asciidoc.ott'|os.path.dirname(__file__),'asciidoc.ott'|" \
"$out/etc/asciidoc/backends/odt/a2x-backend.py"
'' + optionalString enableStandardFeatures ''
'' + (if enableStandardFeatures then ''
sed -e "s|dot|${graphviz}/bin/dot|g" \
-e "s|neato|${graphviz}/bin/neato|g" \
-e "s|twopi|${graphviz}/bin/twopi|g" \
@ -222,7 +225,8 @@ stdenv.mkDerivation rec {
sed -e "s|run('latex|run('${texlive}/bin/latex|g" \
-e "s|cmd = 'dvipng'|cmd = '${texlive}/bin/dvipng'|g" \
-i "filters/latex/latex2png.py"
-e "s|cmd = 'dvisvgm'|cmd = '${texlive}/bin/dvisvgm'|g" \
-i "filters/latex/latex2img.py"
sed -e "s|run('abc2ly|run('${lilypond}/bin/abc2ly|g" \
-e "s|run('lilypond|run('${lilypond}/bin/lilypond|g" \
@ -249,11 +253,13 @@ stdenv.mkDerivation rec {
-e "s|^XMLLINT =.*|XMLLINT = '${libxml2.bin}/bin/xmllint'|" \
-e "s|^EPUBCHECK =.*|EPUBCHECK = 'nixpkgs_is_missing_epubcheck'|" \
-i a2x.py
'' + ''
for n in $(find "$out" . -name \*.py); do
sed -i -e "s,^#![[:space:]]*.*/bin/env python,#!${python2}/bin/python,g" "$n"
chmod +x "$n"
done
'' else ''
sed -e "s|^ENV =.*|ENV = dict(XML_CATALOG_FILES='${docbook_xml_dtd_45}/xml/dtd/docbook/catalog.xml ${docbook_xsl_ns}/xml/xsl/docbook/catalog.xml ${docbook_xsl}/xml/xsl/docbook/catalog.xml')|" \
-e "s|^XSLTPROC =.*|XSLTPROC = '${libxslt.bin}/bin/xsltproc'|" \
-e "s|^XMLLINT =.*|XMLLINT = '${libxml2.bin}/bin/xmllint'|" \
-i a2x.py
'') + ''
patchShebangs .
sed -i -e "s,/etc/vim,,g" Makefile.in
'';

View File

@ -2820,20 +2820,21 @@ in
arpoison = callPackage ../tools/networking/arpoison { };
asciidoc = callPackage ../tools/typesetting/asciidoc {
inherit (python2Packages) matplotlib numpy aafigure recursivePthLoader;
w3m = w3m-batch;
inherit (python3.pkgs) matplotlib numpy aafigure recursivePthLoader;
enableStandardFeatures = false;
};
asciidoc-full = appendToName "full" (asciidoc.override {
inherit (python2Packages) pygments;
inherit (python3.pkgs) pygments;
texlive = texlive.combine { inherit (texlive) scheme-minimal dvipng; };
w3m = w3m-batch;
enableStandardFeatures = true;
});
asciidoc-full-with-plugins = appendToName "full-with-plugins" (asciidoc.override {
inherit (python2Packages) pygments;
inherit (python3.pkgs) pygments;
texlive = texlive.combine { inherit (texlive) scheme-minimal dvipng; };
w3m = w3m-batch;
enableStandardFeatures = true;
enableExtraPlugins = true;
});