about summary refs log tree commit diff
path: root/pkgs/development/python-modules/statmake/default.nix
blob: 50e93eeac9b6e206490c13911836a2e0418f218f (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
{ lib
, attrs
, buildPythonPackage
, cattrs
, exceptiongroup
, fetchFromGitHub
, fonttools
, fs
, importlib-metadata
, poetry-core
, pytestCheckHook
, pythonOlder
, ufo2ft
, ufoLib2
}:

buildPythonPackage rec {
  pname = "statmake";
  version = "0.5.1";
  format = "pyproject";

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "daltonmaag";
    repo = pname;
    rev = "refs/tags/v${version}";
    sha256 = "sha256-BpxjAr65ZQEJ0PSUIPtS78UvJbMG91qkV8py2K/+W2E=";
  };

  nativeBuildInputs = [
    poetry-core
  ];

  propagatedBuildInputs = [
    attrs
    cattrs
    fonttools
    # required by fonttools[ufo]
    fs
  ] ++ lib.optionals (pythonOlder "3.11") [
    exceptiongroup
  ] ++ lib.optionals (pythonOlder "3.8") [
    importlib-metadata
  ];

  checkInputs = [
    pytestCheckHook
    ufo2ft
    ufoLib2
  ];

  postPatch = ''
    # https://github.com/daltonmaag/statmake/pull/41
    substituteInPlace pyproject.toml \
      --replace 'requires = ["poetry>=1.0.0"]' 'requires = ["poetry-core"]' \
      --replace 'build-backend = "poetry.masonry.api"' 'build-backend = "poetry.core.masonry.api"' \
      --replace 'cattrs = "^1.1"' 'cattrs = ">= 1.1"'
  '';

  pythonImportsCheck = [
    "statmake"
  ];

  meta = with lib; {
    description = "Applies STAT information from a Stylespace to a variable font";
    homepage = "https://github.com/daltonmaag/statmake";
    license = licenses.mit;
    maintainers = with maintainers; [ jtojnar ];
  };
}