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