at master 1.4 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 pythonOlder, 5 fetchFromGitHub, 6 setuptools, 7 ziafont, 8 pytestCheckHook, 9 nbval, 10 latex2mathml, 11 writableTmpDirAsHomeHook, 12 fetchurl, 13}: 14buildPythonPackage rec { 15 pname = "ziamath"; 16 version = "0.12"; 17 pyproject = true; 18 19 disabled = pythonOlder "3.9"; 20 21 src = fetchFromGitHub { 22 owner = "cdelker"; 23 repo = "ziamath"; 24 tag = version; 25 hash = "sha256-ShR9O170Q26l6XHSe2CO4bEuQm4JNOxiPZ2kbKDLNEU="; 26 }; 27 28 build-system = [ setuptools ]; 29 30 dependencies = [ ziafont ]; 31 32 nativeCheckInputs = [ 33 pytestCheckHook 34 nbval 35 latex2mathml 36 writableTmpDirAsHomeHook 37 ]; 38 39 preCheck = 40 let 41 # The test notebooks try to download font files, unless they already exist in the test directory, 42 # so we prepare them in advance. 43 checkFonts = lib.map fetchurl (import ./checkfonts.nix); 44 copyFontCmd = font: "cp ${font} test/${lib.last (lib.splitString "/" font.url)}\n"; 45 in 46 lib.concatMapStrings copyFontCmd checkFonts; 47 48 pytestFlags = [ "--nbval-lax" ]; 49 50 pythonImportsCheck = [ "ziamath" ]; 51 52 meta = { 53 description = "Render MathML and LaTeX Math to SVG without Latex installation"; 54 homepage = "https://ziamath.readthedocs.io/en/latest/"; 55 changelog = "https://ziamath.readthedocs.io/en/latest/changes.html"; 56 license = lib.licenses.mit; 57 maintainers = [ lib.maintainers.sfrijters ]; 58 }; 59}