about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/fontbakery/default.nix
blob: 15404df86d814f4b303a3c37135866d481386f53 (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
{ lib
, buildPythonPackage
, callPackage
, fetchpatch
, fetchPypi
, axisregistry
, babelfont
, beautifulsoup4
, beziers
, cmarkgfm
, collidoscope
, defcon
, dehinter
, fonttools
, font-v
, freetype-py
, gflanguages
, git
, glyphsets
, lxml
, installShellFiles
, munkres
, opentypespec
, ots-python
, packaging
, pip-api
, protobuf
, pytestCheckHook
, pytest-xdist
, pythonRelaxDepsHook
, pyyaml
, requests
, requests-mock
, rich
, setuptools-scm
, shaperglot
, stringbrewer
, toml
, unicodedata2
, ufo2ft
, ufolint
, vharfbuzz
}:

buildPythonPackage rec {
  pname = "fontbakery";
  version = "0.11.2";
  format = "setuptools";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-61EXlf+d5kJeUF41OEnGNLaOcSvFWUDFgarVvHQZYmw=";
  };

  patches = [
    # Mock HTTP requests in tests (note we still have to skip some below)
    # https://github.com/googlefonts/fontbakery/pull/4124
    (fetchpatch {
      url = "https://github.com/fonttools/fontbakery/pull/4124.patch";
      hash = "sha256-NXuC2+TtxpHYMdd0t+cF0FJ3lrh4exP5yxspEasKKd0=";
    })
  ];

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

  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_vertical_metrics_regressions"
    "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 ];
  };
}