1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 pytestCheckHook,
6 setuptools,
7 setuptools-scm,
8 resvg,
9 pngquant,
10 absl-py,
11 fonttools,
12 lxml,
13 ninja,
14 picosvg,
15 pillow,
16 regex,
17 toml,
18 tomlkit,
19 ufo2ft,
20 ufolib2,
21 zopfli,
22}:
23
24buildPythonPackage rec {
25 pname = "nanoemoji";
26 version = "0.15.1";
27 pyproject = true;
28
29 src = fetchFromGitHub {
30 owner = "googlefonts";
31 repo = "nanoemoji";
32 rev = "refs/tags/v${version}";
33 hash = "sha256-P/lT0PnjTdYzyttICzszu4OL5kj+X8GHZ8doL3tpXQM=";
34 };
35
36 patches = [
37 # this is necessary because the tests clear PATH/PYTHONPATH otherwise
38 ./test-pythonpath.patch
39 # minor difference in the test output, most likely due to different dependency versions
40 ./fix-test.patch
41 ];
42
43 build-system = [
44 setuptools
45 setuptools-scm
46 ];
47
48 nativeBuildInputs = [
49 pngquant
50 resvg
51 ];
52
53 # these two packages are just prebuilt wheels containing the respective binaries
54 pythonRemoveDeps = [
55 "pngquant-cli"
56 "resvg-cli"
57 ];
58
59 dependencies = [
60 absl-py
61 fonttools
62 lxml
63 ninja
64 picosvg
65 pillow
66 regex
67 toml
68 tomlkit
69 ufo2ft
70 ufolib2
71 zopfli
72 ];
73
74 nativeCheckInputs = [
75 pytestCheckHook
76 ninja
77 picosvg
78 ];
79
80 makeWrapperArgs = [
81 "--prefix PATH : ${
82 lib.makeBinPath [
83 pngquant
84 resvg
85 ]
86 }"
87 ];
88
89 preCheck = ''
90 # make sure the built binaries (nanoemoji/maximum_color) can be found by the test
91 export PATH="$out/bin:$PATH"
92 '';
93
94 meta = with lib; {
95 description = "Wee tool to build color fonts";
96 homepage = "https://github.com/googlefonts/nanoemoji";
97 changelog = "https://github.com/googlefonts/nanoemoji/releases/tag/v${version}";
98 license = licenses.asl20;
99 maintainers = with maintainers; [ _999eagle ];
100 };
101}