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