1{ lib
2, attrs
3, buildPythonPackage
4, cattrs
5, exceptiongroup
6, fetchFromGitHub
7, fonttools
8, fs
9, importlib-metadata
10, poetry-core
11, pytestCheckHook
12, pythonOlder
13, ufo2ft
14, ufoLib2
15}:
16
17buildPythonPackage rec {
18 pname = "statmake";
19 version = "0.5.1";
20 format = "pyproject";
21
22 disabled = pythonOlder "3.7";
23
24 src = fetchFromGitHub {
25 owner = "daltonmaag";
26 repo = pname;
27 rev = "refs/tags/v${version}";
28 sha256 = "sha256-BpxjAr65ZQEJ0PSUIPtS78UvJbMG91qkV8py2K/+W2E=";
29 };
30
31 nativeBuildInputs = [
32 poetry-core
33 ];
34
35 propagatedBuildInputs = [
36 attrs
37 cattrs
38 fonttools
39 # required by fonttools[ufo]
40 fs
41 ] ++ lib.optionals (pythonOlder "3.11") [
42 exceptiongroup
43 ] ++ lib.optionals (pythonOlder "3.8") [
44 importlib-metadata
45 ];
46
47 checkInputs = [
48 pytestCheckHook
49 ufo2ft
50 ufoLib2
51 ];
52
53 postPatch = ''
54 # https://github.com/daltonmaag/statmake/pull/41
55 substituteInPlace pyproject.toml \
56 --replace 'requires = ["poetry>=1.0.0"]' 'requires = ["poetry-core"]' \
57 --replace 'build-backend = "poetry.masonry.api"' 'build-backend = "poetry.core.masonry.api"' \
58 --replace 'cattrs = "^1.1"' 'cattrs = ">= 1.1"'
59 '';
60
61 pythonImportsCheck = [
62 "statmake"
63 ];
64
65 meta = with lib; {
66 description = "Applies STAT information from a Stylespace to a variable font";
67 homepage = "https://github.com/daltonmaag/statmake";
68 license = licenses.mit;
69 maintainers = with maintainers; [ jtojnar ];
70 };
71}