at master 2.6 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 pythonOlder, 6 isPyPy, 7 fetchFromGitHub, 8 setuptools, 9 setuptools-scm, 10 lxml, 11 brotli, 12 brotlicffi, 13 zopfli, 14 unicodedata2, 15 lz4, 16 scipy, 17 munkres, 18 pycairo, 19 matplotlib, 20 sympy, 21 xattr, 22 skia-pathops, 23 uharfbuzz, 24 pytest7CheckHook, 25}: 26 27buildPythonPackage rec { 28 pname = "fonttools"; 29 version = "4.59.0"; 30 pyproject = true; 31 32 disabled = pythonOlder "3.8"; 33 34 src = fetchFromGitHub { 35 owner = "fonttools"; 36 repo = "fonttools"; 37 tag = version; 38 hash = "sha256-f3iedVwwh98XkFzPJ/+XZ2n4pcDXDoPlQki+neGVuXE="; 39 }; 40 41 build-system = [ 42 setuptools 43 setuptools-scm 44 ]; 45 46 optional-dependencies = 47 let 48 extras = { 49 ufo = [ ]; 50 lxml = [ lxml ]; 51 woff = [ 52 (if isPyPy then brotlicffi else brotli) 53 zopfli 54 ]; 55 unicode = lib.optional (pythonOlder "3.13") unicodedata2; 56 graphite = [ lz4 ]; 57 interpolatable = [ 58 pycairo 59 (if isPyPy then munkres else scipy) 60 ]; 61 plot = [ matplotlib ]; 62 symfont = [ sympy ]; 63 type1 = lib.optional stdenv.hostPlatform.isDarwin xattr; 64 pathops = lib.optional (lib.meta.availableOn stdenv.hostPlatform skia-pathops) skia-pathops; 65 repacker = [ uharfbuzz ]; 66 }; 67 in 68 extras // { all = lib.concatLists (lib.attrValues extras); }; 69 70 nativeCheckInputs = [ 71 # test suite fails with pytest>=8.0.1 72 # https://github.com/fonttools/fonttools/issues/3458 73 pytest7CheckHook 74 ] 75 ++ lib.concatLists ( 76 lib.attrVals ( 77 [ 78 "woff" 79 # "interpolatable" is not included because it only contains 2 tests at the time of writing but adds 270 extra dependencies 80 "ufo" 81 ] 82 ++ lib.optionals (!skia-pathops.meta.broken) [ 83 "pathops" # broken 84 ] 85 ++ [ "repacker" ] 86 ) optional-dependencies 87 ); 88 89 pythonImportsCheck = [ "fontTools" ]; 90 91 preCheck = '' 92 # tests want to execute the "fonttools" executable from $PATH 93 export PATH="$out/bin:$PATH" 94 ''; 95 96 # Timestamp tests have timing issues probably related 97 # to our file timestamp normalization 98 disabledTests = [ 99 "test_recalc_timestamp_ttf" 100 "test_recalc_timestamp_otf" 101 "test_ttcompile_timestamp_calcs" 102 ]; 103 104 meta = with lib; { 105 homepage = "https://github.com/fonttools/fonttools"; 106 description = "Library to manipulate font files from Python"; 107 changelog = "https://github.com/fonttools/fonttools/blob/${src.tag}/NEWS.rst"; 108 license = licenses.mit; 109 maintainers = [ maintainers.sternenseemann ]; 110 }; 111}