nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv, buildPythonPackage, fetchPypi, fetchpatch, pythonOlder
2, fonttools, defcon, lxml, fs, unicodedata2, zopfli, brotlipy, fontpens
3, brotli, fontmath, mutatormath, booleanoperations
4, ufoprocessor, ufonormalizer, psautohint, tqdm
5, setuptools-scm, scikit-build
6, cmake
7, antlr4_9
8, pytestCheckHook
9# Enables some expensive tests, useful for verifying an update
10, runAllTests ? false
11, afdko
12}:
13
14buildPythonPackage rec {
15 pname = "afdko";
16 version = "3.8.1";
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchPypi {
21 inherit pname version;
22 sha256 = "sha256-BaSpw7TiBymCvoP0/z1zynWKQJH/PjbbGf85ZI9LOZw=";
23 };
24
25 format = "pyproject";
26
27 nativeBuildInputs = [
28 setuptools-scm
29 scikit-build
30 cmake
31 ];
32
33 buildInputs = [
34 antlr4_9.runtime.cpp
35 ];
36
37 patches = [
38 # Don't try to install cmake and ninja using pip
39 ./no-pypi-build-tools.patch
40
41 # Use antlr4 runtime from nixpkgs and link it dynamically
42 ./use-dynamic-system-antlr4-runtime.patch
43 ];
44
45 # setup.py will always (re-)execute cmake in buildPhase
46 dontConfigure = true;
47
48 propagatedBuildInputs = [
49 booleanoperations
50 fonttools
51 lxml # fonttools[lxml], defcon[lxml] extra
52 fs # fonttools[ufo] extra
53 unicodedata2 # fonttools[unicode] extra
54 brotlipy # fonttools[woff] extra
55 zopfli # fonttools[woff] extra
56 fontpens
57 brotli
58 defcon
59 fontmath
60 mutatormath
61 ufoprocessor
62 ufonormalizer
63 psautohint
64 tqdm
65 ];
66
67 checkInputs = [ pytestCheckHook ];
68 preCheck = ''
69 export PATH=$PATH:$out/bin
70
71 # Update tests to match ufinormalizer-0.6.1 expectations:
72 # https://github.com/adobe-type-tools/afdko/issues/1418
73 find tests -name layerinfo.plist -delete
74 '';
75 disabledTests = lib.optionals (!runAllTests) [
76 # Disable slow tests, reduces test time ~25 %
77 "test_report"
78 "test_post_overflow"
79 "test_cjk"
80 "test_extrapolate"
81 "test_filename_without_dir"
82 "test_overwrite"
83 "test_options"
84 ] ++ lib.optionals (stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isRiscV) [
85 # aarch64-only (?) failure, unknown reason so far
86 # https://github.com/adobe-type-tools/afdko/issues/1425
87 "test_spec"
88 ] ++ lib.optionals (stdenv.hostPlatform.isi686) [
89 "test_type1mm_inputs"
90 ];
91
92 passthru.tests = {
93 fullTestsuite = afdko.override { runAllTests = true; };
94 };
95
96 meta = with lib; {
97 description = "Adobe Font Development Kit for OpenType";
98 homepage = "https://adobe-type-tools.github.io/afdko/";
99 license = licenses.asl20;
100 maintainers = [ maintainers.sternenseemann ];
101 };
102}