nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 pytestCheckHook,
7 nbval,
8 writableTmpDirAsHomeHook,
9 fetchurl,
10}:
11buildPythonPackage rec {
12 pname = "ziafont";
13 version = "0.11";
14 pyproject = true;
15
16 src = fetchFromGitHub {
17 owner = "cdelker";
18 repo = "ziafont";
19 tag = version;
20 hash = "sha256-KjJ+/Yo5mLV6m7Y0eIGHECH0RvdI+eaFTccDmytNTKI=";
21 };
22
23 build-system = [ setuptools ];
24
25 nativeCheckInputs = [
26 pytestCheckHook
27 writableTmpDirAsHomeHook
28 nbval
29 ];
30
31 preCheck =
32 let
33 # The test notebooks try to download font files, unless they already exist in the test directory,
34 # so we prepare them in advance.
35 checkFonts = lib.map fetchurl (import ./checkfonts.nix);
36 copyFontCmd = font: "cp ${font} test/${lib.last (lib.splitString "/" font.url)}\n";
37 in
38 lib.concatMapStrings copyFontCmd checkFonts;
39
40 pytestFlags = [ "--nbval-lax" ];
41
42 pythonImportsCheck = [ "ziafont" ];
43
44 meta = {
45 description = "Convert TTF/OTF font glyphs to SVG paths";
46 homepage = "https://ziafont.readthedocs.io/en/latest/";
47 changelog = "https://github.com/cdelker/ziafont/blob/main/CHANGES.md";
48 license = lib.licenses.mit;
49 maintainers = [ lib.maintainers.sfrijters ];
50 };
51}