1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 fetchFromGitHub,
6 pytestCheckHook,
7 setuptools,
8 setuptools-scm,
9 distutils,
10 ttfautohint,
11 fonttools,
12}:
13
14buildPythonPackage rec {
15 pname = "ttfautohint-py";
16 version = "0.5.1";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "fonttools";
21 repo = "ttfautohint-py";
22 rev = "refs/tags/v${version}";
23 hash = "sha256-NTog461RpyHKo/Qpicj3tflehaKj9LlZEN9qeCMM6JQ=";
24 };
25
26 postPatch = ''
27 substituteInPlace src/python/ttfautohint/__init__.py \
28 --replace-fail 'find_library("ttfautohint")' '"${lib.getLib ttfautohint}/lib/libttfautohint${stdenv.hostPlatform.extensions.sharedLibrary}"'
29 '';
30
31 env.TTFAUTOHINTPY_BUNDLE_DLL = false;
32
33 build-system = [
34 setuptools
35 setuptools-scm
36 distutils
37 ];
38
39 buildInputs = [ ttfautohint ];
40
41 nativeCheckInputs = [
42 pytestCheckHook
43 fonttools
44 ];
45
46 pythonImportsCheck = [ "ttfautohint" ];
47
48 meta = {
49 description = "Python wrapper for ttfautohint, a free auto-hinter for TrueType fonts";
50 homepage = "https://github.com/fonttools/ttfautohint-py";
51 changelog = "https://github.com/fonttools/ttfautohint-py/releases/tag/v${version}";
52 license = lib.licenses.mit;
53 maintainers = with lib.maintainers; [ jopejoe1 ];
54 };
55}