about summary refs log tree commit diff
path: root/pkgs/development/python-modules/ttfautohint-py/default.nix
blob: 98358555eed627b5ee9971d2df658ddd5dcd9a23 (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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pytestCheckHook,
  setuptools,
  setuptools-scm,
  distutils,
  ttfautohint,
  fonttools,
}:

buildPythonPackage rec {
  pname = "ttfautohint-py";
  version = "0.5.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "fonttools";
    repo = "ttfautohint-py";
    rev = "refs/tags/v${version}";
    hash = "sha256-NTog461RpyHKo/Qpicj3tflehaKj9LlZEN9qeCMM6JQ=";
  };

  postPatch = ''
    substituteInPlace src/python/ttfautohint/__init__.py \
      --replace-fail 'find_library("ttfautohint")' '"${lib.getLib ttfautohint}/lib/libttfautohint.so"'
  '';

  env.TTFAUTOHINTPY_BUNDLE_DLL = false;

  build-system = [
    setuptools
    setuptools-scm
    distutils
  ];

  buildInputs = [ ttfautohint ];

  nativeCheckInputs = [
    pytestCheckHook
    fonttools
  ];

  pythonImportsCheck = [ "ttfautohint" ];

  meta = {
    description = "Python wrapper for ttfautohint, a free auto-hinter for TrueType fonts";
    homepage = "https://github.com/fonttools/ttfautohint-py";
    changelog = "https://github.com/fonttools/ttfautohint-py/releases/tag/v${version}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ jopejoe1 ];
  };
}