asciidoc: add support for aafigure filter

This commit is contained in:
Bjørn Forsman 2013-09-22 22:38:23 +02:00
parent 0e9599ca94
commit ff4b28be47
2 changed files with 17 additions and 2 deletions

View File

@ -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"

View File

@ -563,7 +563,7 @@ let
mcelog = callPackage ../os-specific/linux/mcelog { };
asciidoc = callPackage ../tools/typesetting/asciidoc {
inherit (pythonPackages) matplotlib numpy;
inherit (pythonPackages) matplotlib numpy aafigure recursivePthLoader;
};
autossh = callPackage ../tools/networking/autossh { };