From ff4b28be4794b1fb99c4aedb5fb979ba734923c0 Mon Sep 17 00:00:00 2001 From: Bjørn Forsman Date: Sun, 22 Sep 2013 22:38:23 +0200 Subject: asciidoc: add support for aafigure filter --- pkgs/tools/typesetting/asciidoc/default.nix | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'pkgs/tools/typesetting/asciidoc/default.nix') diff --git a/pkgs/tools/typesetting/asciidoc/default.nix b/pkgs/tools/typesetting/asciidoc/default.nix index a381fb863eb2..42fcfa57a914 100644 --- a/pkgs/tools/typesetting/asciidoc/default.nix +++ b/pkgs/tools/typesetting/asciidoc/default.nix @@ -5,13 +5,15 @@ , enableDiagFilter ? false, blockdiag ? null, seqdiag ? null, actdiag ? null, nwdiag ? null , enableQrcodeFilter ? false, qrencode ? null , enableMatplotlibFilter ? false, matplotlib ? null, numpy ? null +, enableAafigureFilter ? false, aafigure ? null, recursivePthLoader ? null }: -assert (enableDitaaFilter || enableMscgenFilter || enableDiagFilter || enableQrcodeFilter) -> unzip != null; +assert (enableDitaaFilter || enableMscgenFilter || enableDiagFilter || enableQrcodeFilter || enableAafigureFilter) -> unzip != null; assert enableDitaaFilter -> jre != null; assert enableMscgenFilter -> mscgen != null; assert enableDiagFilter -> blockdiag != null && seqdiag != null && actdiag != null && nwdiag != null; assert enableMatplotlibFilter -> matplotlib != null && numpy != null; +assert enableAafigureFilter -> aafigure != null && recursivePthLoader != null; let ditaaFilterSrc = fetchurl { @@ -42,6 +44,11 @@ let sha256 = "0yfhkm2dr8gnp0fcg25x89hwiymkri2m5cyqzmzragzwj0hbmcf1"; }; + aafigureFilterSrc = fetchurl { + url = "https://asciidoc-aafigure-filter.googlecode.com/files/aafigure-filter-1.1.zip"; + sha256 = "1hq2s30dvmv5dqvj0xm1qwdwafhgm9w1iyr0lr0c40cyk8h00j8j"; + }; + in stdenv.mkDerivation rec { @@ -91,6 +98,14 @@ stdenv.mkDerivation rec { numpy_path="$(toPythonPath ${numpy})" sed -i "/^import.*sys/asys.path.append(\"$matplotlib_path\"); sys.path.append(\"$numpy_path\");" \ "$out/etc/asciidoc/filters/mpl/mplw.py" + '' + optionalString enableAafigureFilter '' + echo "Extracting aafigure filter" + unzip -d "$out/etc/asciidoc/filters/aafigure" "${aafigureFilterSrc}" + # Add aafigure to sys.path (and it needs recursive-pth-loader) + pth_loader_path="$(toPythonPath ${recursivePthLoader})" + aafigure_path="$(toPythonPath ${aafigure})" + sed -i "/^import.*sys/asys.path.append(\"$pth_loader_path\"); sys.path.append(\"$aafigure_path\"); import sitecustomize" \ + "$out/etc/asciidoc/filters/aafigure/aafig2img.py" '' + '' for n in $(find "$out" . -name \*.py); do sed -i -e "s,^#![[:space:]]*/usr/bin/env python,#!${python}/bin/python,g" "$n" -- cgit 1.4.1