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 tag = "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 + lib.optionalString stdenv.hostPlatform.isLinux ''
31 substituteInPlace src/python/ttfautohint/memory.py \
32 --replace-fail 'find_library("c")' '"${lib.getLib stdenv.cc.libc}/lib/libc.so.6"'
33 '';
34
35 env.TTFAUTOHINTPY_BUNDLE_DLL = false;
36
37 build-system = [
38 setuptools
39 setuptools-scm
40 distutils
41 ];
42
43 dependencies = [
44 setuptools # for pkg_resources
45 ];
46
47 buildInputs = [ ttfautohint ];
48
49 nativeCheckInputs = [
50 pytestCheckHook
51 fonttools
52 ];
53
54 pythonImportsCheck = [ "ttfautohint" ];
55
56 meta = {
57 description = "Python wrapper for ttfautohint, a free auto-hinter for TrueType fonts";
58 homepage = "https://github.com/fonttools/ttfautohint-py";
59 changelog = "https://github.com/fonttools/ttfautohint-py/releases/tag/v${version}";
60 license = lib.licenses.mit;
61 maintainers = with lib.maintainers; [ jopejoe1 ];
62 };
63}