1{
2 lib,
3 buildPythonPackage,
4 callPackage,
5 fetchpatch,
6 fetchPypi,
7 axisregistry,
8 babelfont,
9 beautifulsoup4,
10 beziers,
11 cmarkgfm,
12 collidoscope,
13 defcon,
14 dehinter,
15 fonttools,
16 font-v,
17 freetype-py,
18 gflanguages,
19 gfsubsets,
20 git,
21 glyphsets,
22 lxml,
23 installShellFiles,
24 jinja2,
25 munkres,
26 opentypespec,
27 ots-python,
28 packaging,
29 pip-api,
30 protobuf,
31 pytestCheckHook,
32 pytest-xdist,
33 pythonRelaxDepsHook,
34 pyyaml,
35 requests,
36 requests-mock,
37 rich,
38 setuptools,
39 setuptools-scm,
40 shaperglot,
41 stringbrewer,
42 toml,
43 unicodedata2,
44 ufo2ft,
45 ufolint,
46 vharfbuzz,
47}:
48
49buildPythonPackage rec {
50 pname = "fontbakery";
51 version = "0.12.5";
52
53 src = fetchPypi {
54 inherit pname version;
55 hash = "sha256-DN1v5MQtMhHO12tVPkJUuIfh+X3kb1o71zAwNgtLH+I=";
56 };
57
58 pyproject = true;
59
60 dependencies = [
61 axisregistry
62 babelfont
63 beautifulsoup4
64 beziers
65 cmarkgfm
66 collidoscope
67 defcon
68 dehinter
69 fonttools
70 font-v
71 freetype-py
72 gflanguages
73 gfsubsets
74 glyphsets
75 lxml
76 jinja2
77 munkres
78 ots-python
79 opentypespec
80 packaging
81 pip-api
82 protobuf
83 pyyaml
84 requests
85 rich
86 shaperglot
87 stringbrewer
88 toml
89 ufolint
90 unicodedata2
91 vharfbuzz
92 ufo2ft
93 ];
94 build-system = [
95 setuptools
96 setuptools-scm
97 ];
98 nativeBuildInputs = [
99 installShellFiles
100 pythonRelaxDepsHook
101 ];
102
103 pythonRelaxDeps = [
104 "collidoscope"
105 "protobuf"
106 "vharfbuzz"
107 ];
108
109 doCheck = true;
110 nativeCheckInputs = [
111 git
112 pytestCheckHook
113 pytest-xdist
114 requests-mock
115 ufolint
116 ];
117 preCheck = ''
118 # Let the tests invoke 'fontbakery' command.
119 export PATH="$out/bin:$PATH"
120 # font-v tests assume they are running from a git checkout, although they
121 # don't care which one. Create a dummy git repo to satisfy the tests:
122 git init -b main
123 git config user.email test@example.invalid
124 git config user.name Test
125 git commit --allow-empty --message 'Dummy commit for tests'
126 '';
127 disabledTests = [
128 # These require network access:
129 "test_check_description_broken_links"
130 "test_check_description_family_update"
131 "test_check_metadata_designer_profiles"
132 "test_check_metadata_has_tags"
133 "test_check_metadata_includes_production_subsets"
134 "test_check_vertical_metrics"
135 "test_check_vertical_metrics_regressions"
136 "test_check_cjk_vertical_metrics"
137 "test_check_cjk_vertical_metrics_regressions"
138 "test_check_fontbakery_version_live_apis"
139 ];
140
141 postInstall = ''
142 installShellCompletion --bash --name fontbakery \
143 snippets/fontbakery.bash-completion
144 '';
145
146 passthru.tests.simple = callPackage ./tests.nix { };
147
148 meta = with lib; {
149 description = "Tool for checking the quality of font projects";
150 homepage = "https://github.com/googlefonts/fontbakery";
151 license = licenses.asl20;
152 maintainers = with maintainers; [ danc86 ];
153 };
154}