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 gitMinimal,
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 pyyaml,
33 requests-mock,
34 requests,
35 rich,
36 setuptools-scm,
37 setuptools,
38 shaperglot,
39 stringbrewer,
40 toml,
41 ufo2ft,
42 ufolint,
43 ufomerge,
44 unicodedata2,
45 vharfbuzz,
46}:
47
48buildPythonPackage rec {
49 pname = "fontbakery";
50 version = "1.0.1";
51 pyproject = true;
52
53 src = fetchPypi {
54 inherit pname version;
55 hash = "sha256-OPOUNKy70sm/kqrxRi61MjfQp74AdqZh6Gt93LdlmU0=";
56 };
57
58 env.PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION = "python";
59
60 pythonRelaxDeps = [
61 "collidoscope"
62 "freetype-py"
63 "protobuf"
64 "vharfbuzz"
65 ];
66
67 build-system = [
68 setuptools
69 setuptools-scm
70 ];
71
72 nativeBuildInputs = [
73 installShellFiles
74 ];
75
76 dependencies = [
77 axisregistry
78 babelfont
79 beautifulsoup4
80 beziers
81 cmarkgfm
82 collidoscope
83 defcon
84 dehinter
85 font-v
86 fonttools
87 freetype-py
88 gflanguages
89 gfsubsets
90 glyphsets
91 jinja2
92 lxml
93 munkres
94 opentypespec
95 ots-python
96 packaging
97 pip-api
98 protobuf
99 pyyaml
100 requests
101 rich
102 shaperglot
103 stringbrewer
104 toml
105 ufo2ft
106 ufolint
107 ufomerge
108 unicodedata2
109 vharfbuzz
110 ];
111
112 nativeCheckInputs = [
113 gitMinimal
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_axes_match"
134 "test_check_description_broken_links"
135 "test_check_description_family_update"
136 "test_check_metadata_designer_profiles"
137 "test_check_metadata_has_tags"
138 "test_check_metadata_includes_production_subsets"
139 "test_check_vertical_metrics"
140 "test_check_vertical_metrics_regressions"
141 "test_check_cjk_vertical_metrics"
142 "test_check_cjk_vertical_metrics_regressions"
143 "test_check_fontbakery_version_live_apis"
144 "test_command_check_googlefonts"
145 # AssertionError
146 "test_check_shape_languages"
147 "test_command_config_file"
148 "test_config_override"
149 ];
150
151 disabledTestPaths = [
152 # ValueError: Check 'googlefonts/glyphsets/shape_languages' not found
153 "tests/test_checks_filesize.py"
154 "tests/test_checks_googlefonts_overrides.py"
155 ];
156
157 postInstall = ''
158 installShellCompletion --bash --name fontbakery \
159 snippets/fontbakery.bash-completion
160 '';
161
162 passthru.tests.simple = callPackage ./tests.nix { };
163
164 meta = with lib; {
165 description = "Tool for checking the quality of font projects";
166 homepage = "https://github.com/googlefonts/fontbakery";
167 changelog = "https://github.com/fonttools/fontbakery/blob/v${version}/CHANGELOG.md";
168 license = licenses.asl20;
169 mainProgram = "fontbakery";
170 maintainers = with maintainers; [ danc86 ];
171 };
172}