python3Packages.ziamath: 0.10 -> 0.11

This commit is contained in:
Stefan Frijters
2024-08-11 12:33:02 +02:00
parent 5a04de283e
commit b8ea3d2bd6
2 changed files with 36 additions and 15 deletions
@@ -0,0 +1,19 @@
# Based on the calls to testfont(url) in test/styles.ipynb
[
{
url = "https://mirrors.ctan.org/fonts/libertinus-fonts/otf/LibertinusMath-Regular.otf";
hash = "sha256-PY4QUzxz9/vO4k2rl5GBfno0r3/Zh1FAhif1OPDic7w=";
}
{
url = "https://mirrors.ctan.org/fonts/firamath/FiraMath-Regular.otf";
hash = "sha256-ICjL091NjAzxYIUg60dZlWqDpnkx17bY58MTUgGG41s=";
}
{
url = "https://mirrors.ctan.org/fonts/erewhon-math/Erewhon-Math.otf";
hash = "sha256-7SjKC+XP9KpFAWtZxc+FZZ4VETnDxokUGz+nZ/CWIbI=";
}
{
url = "https://mirrors.ctan.org/fonts/concmath-otf/Concrete-Math.otf";
hash = "sha256-YCukkUgNQoBlotuD0vF1ts9JL8x6xaEW9JxK++GVGZ4=";
}
]
@@ -8,20 +8,20 @@
pytestCheckHook,
nbval,
latex2mathml,
fetchurl,
}:
buildPythonPackage rec {
pname = "ziamath";
version = "0.10";
version = "0.11";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "cdelker";
repo = pname;
rev = version;
hash = "sha256-Drssi+YySh4OhVYAOvgIwzeeu5dQbUUXuhwTedhUUt8=";
repo = "ziamath";
rev = "refs/tags/${version}";
hash = "sha256-DLpbidQEeQVKxGCbS2jeeCvmVK9ElDIDQMj5bh/x7/Q=";
};
build-system = [ setuptools ];
@@ -34,22 +34,24 @@ buildPythonPackage rec {
latex2mathml
];
pytestFlagsArray = [ "--nbval-lax" ];
preCheck =
let
# The test notebooks try to download font files, unless they already exist in the test directory,
# so we prepare them in advance.
checkFonts = lib.map fetchurl (import ./checkfonts.nix);
copyFontCmd = font: "cp ${font} test/${lib.last (lib.splitString "/" font.url)}\n";
in
lib.concatMapStrings copyFontCmd checkFonts;
# Prevent the test suite from attempting to download fonts
postPatch = ''
substituteInPlace test/styles.ipynb \
--replace '"def testfont(exprs, fonturl):\n",' '"def testfont(exprs, fonturl):\n", " return\n",' \
--replace "mathfont='FiraMath-Regular.otf', " ""
'';
pytestFlagsArray = [ "--nbval-lax" ];
pythonImportsCheck = [ "ziamath" ];
meta = with lib; {
meta = {
description = "Render MathML and LaTeX Math to SVG without Latex installation";
homepage = "https://ziamath.readthedocs.io/en/latest/";
changelog = "https://ziamath.readthedocs.io/en/latest/changes.html";
license = licenses.mit;
maintainers = with maintainers; [ sfrijters ];
license = lib.licenses.mit;
maintainers = [ lib.maintainers.sfrijters ];
};
}