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