1{ lib 2, stdenv 3, buildPythonPackage 4, pythonOlder 5, isPyPy 6, fetchFromGitHub 7, setuptools-scm 8, fs 9, lxml 10, brotli 11, brotlicffi 12, zopfli 13, unicodedata2 14, lz4 15, scipy 16, munkres 17, matplotlib 18, sympy 19, xattr 20, skia-pathops 21, uharfbuzz 22, pytestCheckHook 23}: 24 25buildPythonPackage rec { 26 pname = "fonttools"; 27 version = "4.42.1"; 28 format = "setuptools"; 29 30 disabled = pythonOlder "3.7"; 31 32 src = fetchFromGitHub { 33 owner = pname; 34 repo = pname; 35 rev = "refs/tags/${version}"; 36 hash = "sha256-fcFFJi9Hr0m74LwFIhhhm/bMfxepAvg4/ymU53MmsPg="; 37 }; 38 39 nativeBuildInputs = [ setuptools-scm ]; 40 41 passthru.optional-dependencies = let 42 extras = { 43 ufo = [ fs ]; 44 lxml = [ lxml ]; 45 woff = [ (if isPyPy then brotlicffi else brotli) zopfli ]; 46 unicode = lib.optional (pythonOlder "3.11") unicodedata2; 47 graphite = [ lz4 ]; 48 interpolatable = [ (if isPyPy then munkres else scipy) ]; 49 plot = [ matplotlib ]; 50 symfont = [ sympy ]; 51 type1 = lib.optional stdenv.isDarwin xattr; 52 pathops = [ skia-pathops ]; 53 repacker = [ uharfbuzz ]; 54 }; 55 in extras // { 56 all = lib.concatLists (lib.attrValues extras); 57 }; 58 59 nativeCheckInputs = [ 60 pytestCheckHook 61 ] ++ lib.concatLists (lib.attrVals ([ 62 "woff" 63 "interpolatable" 64 "ufo" 65 ] ++ lib.optionals (!skia-pathops.meta.broken) [ 66 "pathops" # broken 67 ] ++ [ 68 "repacker" 69 ]) passthru.optional-dependencies); 70 71 pythonImportsCheck = [ "fontTools" ]; 72 73 preCheck = '' 74 # tests want to execute the "fonttools" executable from $PATH 75 export PATH="$out/bin:$PATH" 76 ''; 77 78 # Timestamp tests have timing issues probably related 79 # to our file timestamp normalization 80 disabledTests = [ 81 "test_recalc_timestamp_ttf" 82 "test_recalc_timestamp_otf" 83 "test_ttcompile_timestamp_calcs" 84 ]; 85 86 disabledTestPaths = [ 87 # avoid test which depend on fs and matplotlib 88 # fs and matplotlib were removed to prevent strong cyclic dependencies 89 "Tests/misc/plistlib_test.py" 90 "Tests/pens" 91 "Tests/ufoLib" 92 ]; 93 94 meta = with lib; { 95 homepage = "https://github.com/fonttools/fonttools"; 96 description = "A library to manipulate font files from Python"; 97 license = licenses.mit; 98 maintainers = [ maintainers.sternenseemann ]; 99 }; 100}