Merge pull request #222012 from SFrijters/schemdraw

This commit is contained in:
Sandro 2023-04-06 22:21:13 +02:00 committed by GitHub
commit 98140dd07b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 217 additions and 0 deletions

View file

@ -0,0 +1,55 @@
{ lib
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, poetry-core
, setuptools
, pytestCheckHook
, multidict
, xmljson
}:
buildPythonPackage rec {
pname = "latex2mathml";
version = "3.75.2";
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "roniemartinez";
repo = pname;
rev = version;
hash = "sha256-i/F1B/Rndg66tiKok1PDMK/rT5c2e8upnQrMSCTUzpU=";
};
format = "pyproject";
nativeBuildInputs = [
poetry-core
];
propagatedBuildInputs = [
setuptools # needs pkg_resources at runtime
];
nativeCheckInputs = [
pytestCheckHook
multidict
xmljson
];
# Disable code coverage in check phase
postPatch = ''
sed -i '/--cov/d' pyproject.toml
'';
pythonImportsCheck = [ "latex2mathml" ];
meta = with lib; {
description = "Pure Python library for LaTeX to MathML conversion";
homepage = "https://github.com/roniemartinez/latex2mathml";
changelog = "https://github.com/roniemartinez/latex2mathml/releases/tag/${version}";
license = licenses.mit;
maintainers = with maintainers; [ sfrijters ];
};
}

View file

@ -0,0 +1,68 @@
{ lib
, buildPythonPackage
, pythonOlder
, fetchFromBitbucket
, pyparsing
, matplotlib
, latex2mathml
, ziafont
, ziamath
, pytestCheckHook
, nbval
}:
buildPythonPackage rec {
pname = "schemdraw";
version = "0.16";
format = "pyproject";
disabled = pythonOlder "3.8";
src = fetchFromBitbucket {
owner = "cdelker";
repo = pname;
rev = version;
hash = "sha256-W9sXtYI8gEwQPRo50taEGT6AQG1tdAbeCtX49eHVvFQ=";
};
propagatedBuildInputs = [
pyparsing
];
passthru.optional-dependencies = {
matplotlib = [
matplotlib
];
svgmath = [
latex2mathml
ziafont
ziamath
];
};
nativeCheckInputs = [
pytestCheckHook
nbval
matplotlib
latex2mathml
ziafont
ziamath
];
# Strip out references to unfree fonts from the test suite
postPatch = ''
substituteInPlace test/test_styles.ipynb --replace "font='Times', " ""
'';
pytestFlagsArray = [ "--nbval-lax" ];
pythonImportsCheck = [ "schemdraw" ];
meta = with lib; {
description = "A 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 ];
};
}

View file

@ -0,0 +1,39 @@
{ lib
, buildPythonPackage
, pythonOlder
, fetchFromBitbucket
, pytestCheckHook
, nbval
}:
buildPythonPackage rec {
pname = "ziafont";
version = "0.5";
disabled = pythonOlder "3.8";
src = fetchFromBitbucket {
owner = "cdelker";
repo = pname;
rev = version;
hash = "sha256-mTQ2yRG+E2nZ2g9eSg+XTzK8A1EgKsRfbvNO3CdYeLg=";
};
nativeCheckInputs = [
pytestCheckHook
nbval
];
preCheck = "rm test/manyfonts.ipynb"; # Tries to download fonts
pytestFlagsArray = [ "--nbval-lax" ];
pythonImportsCheck = [ "ziafont" ];
meta = with lib; {
description = "Convert TTF/OTF font glyphs to SVG paths";
homepage = "https://ziafont.readthedocs.io/en/latest/";
license = licenses.mit;
maintainers = with maintainers; [ sfrijters ];
};
}

View file

@ -0,0 +1,45 @@
{ lib
, buildPythonPackage
, pythonOlder
, fetchFromBitbucket
, ziafont
, pytestCheckHook
, nbval
, latex2mathml
}:
buildPythonPackage rec {
pname = "ziamath";
version = "0.7";
disabled = pythonOlder "3.8";
src = fetchFromBitbucket {
owner = "cdelker";
repo = pname;
rev = version;
hash = "sha256-JuuCDww0EZEHZLxB5oQrWEJpv0szjwe4iXCRGl7OYTA=";
};
propagatedBuildInputs = [
ziafont
];
nativeCheckInputs = [
pytestCheckHook
nbval
latex2mathml
];
pytestFlagsArray = [ "--nbval-lax" ];
pythonImportsCheck = [ "ziamath" ];
meta = with lib; {
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 ];
};
}

View file

@ -4795,6 +4795,8 @@ with pkgs;
gladtex = callPackage ../tools/typesetting/tex/gladtex { };
latex2mathml = with python3Packages; toPythonApplication latex2mathml;
latexrun = callPackage ../tools/typesetting/tex/latexrun { };
lkproof = callPackage ../tools/typesetting/tex/lkproof { };

View file

@ -5341,6 +5341,8 @@ self: super: with self; {
laszip = callPackage ../development/python-modules/laszip { };
latex2mathml = callPackage ../development/python-modules/latex2mathml { };
latexcodec = callPackage ../development/python-modules/latexcodec { };
latexify-py = callPackage ../development/python-modules/latexify-py { };
@ -10529,6 +10531,8 @@ self: super: with self; {
schema-salad = callPackage ../development/python-modules/schema-salad { };
schemdraw = callPackage ../development/python-modules/schemdraw { };
schiene = callPackage ../development/python-modules/schiene { };
schwifty = callPackage ../development/python-modules/schwifty { };
@ -12934,6 +12938,10 @@ self: super: with self; {
zha-quirks = callPackage ../development/python-modules/zha-quirks { };
ziafont = callPackage ../development/python-modules/ziafont { };
ziamath = callPackage ../development/python-modules/ziamath { };
zict = callPackage ../development/python-modules/zict { };
zigpy = callPackage ../development/python-modules/zigpy { };