1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5
6 # build-system
7 cython,
8 setuptools,
9
10 # dependencies
11 fontconfig,
12 freefont_ttf,
13 makeFontsConf,
14
15 # testing
16 dejavu_fonts,
17 python,
18}:
19
20let
21 fontsConf = makeFontsConf { fontDirectories = [ freefont_ttf ]; };
22in
23buildPythonPackage rec {
24 pname = "python-fontconfig";
25 version = "0.6.1";
26 pyproject = true;
27
28 src = fetchPypi {
29 pname = "python_fontconfig";
30 inherit version;
31 sha256 = "sha256-qka4KksXW9LPn+Grmyng3kyrhwIEG7UEpVDeKfX89zM=";
32 };
33
34 build-system = [
35 cython
36 setuptools
37 ];
38
39 buildInputs = [ fontconfig ];
40
41 preBuild = ''
42 ${python.pythonOnBuildForHost.interpreter} setup.py build_ext -i
43 '';
44
45 nativeCheckInputs = [ dejavu_fonts ];
46
47 preCheck = ''
48 export FONTCONFIG_FILE=${fontsConf};
49 export HOME=$TMPDIR
50 '';
51
52 checkPhase = ''
53 runHook preCheck
54 echo y | ${python.interpreter} test/test.py
55 runHook postCheck
56 '';
57
58 meta = {
59 homepage = "https://github.com/Vayn/python-fontconfig";
60 description = "Python binding for Fontconfig";
61 license = lib.licenses.gpl3;
62 platforms = lib.platforms.all;
63 maintainers = [ ];
64 };
65}