about summary refs log tree commit diff
path: root/pkgs/development/python-modules/fontbakery/default.nix
blob: 7ac5f86b1ee2a4ed9453265cfc5312d8f4e07fb8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
{ lib
, buildPythonPackage
, callPackage
, fetchpatch
, fetchPypi
, axisregistry
, babelfont
, beautifulsoup4
, beziers
, cmarkgfm
, collidoscope
, defcon
, dehinter
, fonttools
, font-v
, freetype-py
, gflanguages
, gfsubsets
, git
, glyphsets
, lxml
, installShellFiles
, jinja2
, munkres
, opentypespec
, ots-python
, packaging
, pip-api
, protobuf
, pytestCheckHook
, pytest-xdist
, pythonRelaxDepsHook
, pyyaml
, requests
, requests-mock
, rich
, setuptools
, setuptools-scm
, shaperglot
, stringbrewer
, toml
, unicodedata2
, ufo2ft
, ufolint
, vharfbuzz
}:

buildPythonPackage rec {
  pname = "fontbakery";
  version = "0.12.2";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-sHkTxu8TdPXbUZvpJH46SF8U4JNIzfFb5HJEXCqomOI=";
  };

  pyproject = true;

  dependencies = [
    axisregistry
    babelfont
    beautifulsoup4
    beziers
    cmarkgfm
    collidoscope
    defcon
    dehinter
    fonttools
    font-v
    freetype-py
    gflanguages
    gfsubsets
    glyphsets
    lxml
    jinja2
    munkres
    ots-python
    opentypespec
    packaging
    pip-api
    protobuf
    pyyaml
    requests
    rich
    shaperglot
    stringbrewer
    toml
    ufolint
    unicodedata2
    vharfbuzz
    ufo2ft
  ];
  build-system = [
    setuptools
    setuptools-scm
  ];
  nativeBuildInputs = [
    installShellFiles
    pythonRelaxDepsHook
  ];

  pythonRelaxDeps = [
    "collidoscope"
    "protobuf"
    "vharfbuzz"
  ];

  doCheck = true;
  nativeCheckInputs = [
    git
    pytestCheckHook
    pytest-xdist
    requests-mock
    ufolint
  ];
  preCheck = ''
    # Let the tests invoke 'fontbakery' command.
    export PATH="$out/bin:$PATH"
    # font-v tests assume they are running from a git checkout, although they
    # don't care which one. Create a dummy git repo to satisfy the tests:
    git init -b main
    git config user.email test@example.invalid
    git config user.name Test
    git commit --allow-empty --message 'Dummy commit for tests'
  '';
  disabledTests = [
    # These require network access:
    "test_check_description_broken_links"
    "test_check_description_family_update"
    "test_check_metadata_designer_profiles"
    "test_check_metadata_has_tags"
    "test_check_metadata_includes_production_subsets"
    "test_check_vertical_metrics"
    "test_check_vertical_metrics_regressions"
    "test_check_cjk_vertical_metrics"
    "test_check_cjk_vertical_metrics_regressions"
    "test_check_fontbakery_version_live_apis"
  ];

  postInstall = ''
    installShellCompletion --bash --name fontbakery \
      snippets/fontbakery.bash-completion
  '';

  passthru.tests.simple = callPackage ./tests.nix { };

  meta = with lib; {
    description = "Tool for checking the quality of font projects";
    homepage = "https://github.com/googlefonts/fontbakery";
    license = licenses.asl20;
    maintainers = with maintainers; [ danc86 ];
  };
}