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

73 lines
1.5 KiB
Nix

{
lib,
buildPythonPackage,
pythonOlder,
fetchFromGitHub,
setuptools,
pyparsing,
matplotlib,
latex2mathml,
ziafont,
ziamath,
pytestCheckHook,
nbval,
writableTmpDirAsHomeHook,
}:
buildPythonPackage rec {
pname = "schemdraw";
version = "0.20";
pyproject = true;
disabled = pythonOlder "3.9";
src = fetchFromGitHub {
owner = "cdelker";
repo = "schemdraw";
tag = version;
hash = "sha256-mt1XTrUH570zrJpCFo0jORAE/jo7H2T7sKpIskYw8bk=";
};
build-system = [ setuptools ];
dependencies = [ pyparsing ];
optional-dependencies = {
matplotlib = [ matplotlib ];
svgmath = [
latex2mathml
ziafont
ziamath
];
};
nativeCheckInputs = [
pytestCheckHook
nbval
matplotlib
latex2mathml
ziafont
ziamath
writableTmpDirAsHomeHook
];
# Strip out references to unfree fonts from the test suite
postPatch = ''
substituteInPlace test/test_backend.ipynb --replace-fail "(font='Times')" "()"
'';
preCheck = "rm test/test_pictorial.ipynb"; # Tries to download files
pytestFlags = [ "--nbval-lax" ];
pythonImportsCheck = [ "schemdraw" ];
meta = with lib; {
description = "Package for producing high-quality electrical circuit schematic diagrams";
homepage = "https://schemdraw.readthedocs.io/en/latest/";
changelog = "https://schemdraw.readthedocs.io/en/latest/changes.html";
license = licenses.mit;
maintainers = with maintainers; [ sfrijters ];
};
}