Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 buildPythonPackage, 4 setuptools, 5 sphinx, 6 cairosvg, 7 inkscape, 8 librsvg, 9 fetchPypi, 10 11 withCairosvg ? false, 12 withInkscape ? false, 13 withLibrsvg ? true, 14}: 15 16assert (withCairosvg || withInkscape || withLibrsvg); 17 18buildPythonPackage rec { 19 pname = "sphinxcontrib-svg2pdfconverter"; 20 version = "1.3.0"; 21 pyproject = true; 22 23 src = fetchPypi { 24 inherit version; 25 pname = "sphinxcontrib_svg2pdfconverter"; 26 hash = "sha256-ZBGkzC9X7tlqDXu/oTn2jL55gwGIgeHm18RgU81pkR8="; 27 }; 28 29 # for enabled modules: provide the full path to the binary 30 postPatch = 31 lib.optionalString withLibrsvg '' 32 substituteInPlace sphinxcontrib/rsvgconverter.py \ 33 --replace-fail "'rsvg_converter_bin', 'rsvg-convert'" "'rsvg_converter_bin', '${lib.getExe' librsvg "rsvg-convert"}'" 34 '' 35 + lib.optionalString withInkscape '' 36 substituteInPlace sphinxcontrib/inkscapeconverter.py \ 37 --replace-fail "'inkscape_converter_bin', 'inkscape'" "'inkscape_converter_bin', '${lib.getExe inkscape}'" 38 ''; 39 40 build-system = [ setuptools ]; 41 42 dependencies = [ sphinx ] ++ lib.optional withCairosvg cairosvg; 43 44 doCheck = false; # no tests 45 46 pythonImportsCheck = 47 lib.optional withCairosvg "sphinxcontrib.cairosvgconverter" 48 ++ lib.optional withInkscape "sphinxcontrib.inkscapeconverter" 49 ++ lib.optional withLibrsvg "sphinxcontrib.rsvgconverter"; 50 51 pythonNamespaces = [ "sphinxcontrib" ]; 52 53 meta = { 54 description = "Sphinx SVG to PDF converter extension"; 55 homepage = "https://github.com/missinglinkelectronics/sphinxcontrib-svg2pdfconverter"; 56 license = lib.licenses.bsd2; 57 maintainers = with lib.maintainers; [ dansbandit ]; 58 }; 59}