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