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