1{ version 2, sha256 3, dlopen_patch 4, disabled ? false 5, ... 6}@args: 7 8with args; 9 10buildPythonPackage rec { 11 pname = "cairocffi"; 12 inherit version disabled; 13 14 src = fetchPypi { 15 inherit pname version sha256; 16 }; 17 18 LC_ALL = "en_US.UTF-8"; 19 20 # checkPhase require at least one 'normal' font and one 'monospace', 21 # otherwise glyph tests fails 22 FONTCONFIG_FILE = makeFontsConf { 23 fontDirectories = [ freefont_ttf ]; 24 }; 25 26 propagatedBuildInputs = [ cairo cffi ] ++ lib.optional withXcffib xcffib; 27 propagatedNativeBuildInputs = [ cffi ]; 28 29 # pytestCheckHook does not work 30 checkInputs = [ numpy pytest glibcLocales ]; 31 32 postPatch = '' 33 substituteInPlace setup.cfg \ 34 --replace "pytest-runner" "" \ 35 --replace "pytest-cov" "" \ 36 --replace "pytest-flake8" "" \ 37 --replace "pytest-isort" "" \ 38 --replace "--flake8 --isort" "" 39 ''; 40 41 checkPhase = '' 42 py.test $out/${python.sitePackages} 43 ''; 44 45 patches = [ 46 # OSError: dlopen() failed to load a library: gdk-pixbuf-2.0 / gdk-pixbuf-2.0-0 47 (substituteAll { 48 src = dlopen_patch; 49 ext = stdenv.hostPlatform.extensions.sharedLibrary; 50 cairo = cairo.out; 51 glib = glib.out; 52 gdk_pixbuf = gdk-pixbuf.out; 53 }) 54 ./fix_test_scaled_font.patch 55 ]; 56 57 meta = with lib; { 58 homepage = "https://github.com/SimonSapin/cairocffi"; 59 license = licenses.bsd3; 60 maintainers = with maintainers; []; 61 description = "cffi-based cairo bindings for Python"; 62 }; 63}