Yueh-Shun Li 76e2a397c2 treewide: pytestFlagsArray -> pytestFlags and join flag and option argument
This treewide change targets Python packages
that specifies pytest flags with pytestFlagsArray,
and whose flags cannot be consructed by other pytestCheckHook-honoured arguments.

Use the __structuredAttrs-agnostic argument pytestFlags
instead of the deprecated pytestFlagsArray.

For flags with option arguments,
join each flag and their option argument into a single command-line argument
following POSIX Utility Argument Syntax[1]
for easier overriding (remove/replace).

Examples:

* [ "-W" "ignore:message:WarningClass" ] ->
  [ "-Wignore:message:WarningClass" ]

* [ "--reruns" "3" ] ->
  [ "--reruns=3" ]

[1]: https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html
2025-06-16 01:02:16 +08:00

60 lines
1.4 KiB
Nix

{
lib,
buildPythonPackage,
pythonOlder,
fetchFromGitHub,
setuptools,
ziafont,
pytestCheckHook,
nbval,
latex2mathml,
writableTmpDirAsHomeHook,
fetchurl,
}:
buildPythonPackage rec {
pname = "ziamath";
version = "0.12";
pyproject = true;
disabled = pythonOlder "3.9";
src = fetchFromGitHub {
owner = "cdelker";
repo = "ziamath";
tag = version;
hash = "sha256-ShR9O170Q26l6XHSe2CO4bEuQm4JNOxiPZ2kbKDLNEU=";
};
build-system = [ setuptools ];
dependencies = [ ziafont ];
nativeCheckInputs = [
pytestCheckHook
nbval
latex2mathml
writableTmpDirAsHomeHook
];
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;
pytestFlags = [ "--nbval-lax" ];
pythonImportsCheck = [ "ziamath" ];
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 = lib.licenses.mit;
maintainers = [ lib.maintainers.sfrijters ];
};
}