about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/cairocffi/generic.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/cairocffi/generic.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/cairocffi/generic.nix51
1 files changed, 51 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/cairocffi/generic.nix b/nixpkgs/pkgs/development/python-modules/cairocffi/generic.nix
new file mode 100644
index 000000000000..4fa5cc466c31
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/cairocffi/generic.nix
@@ -0,0 +1,51 @@
+{ version
+, sha256
+, dlopen_patch
+, disabled ? false
+, ...
+}@args:
+
+with args;
+
+buildPythonPackage rec {
+  pname = "cairocffi";
+  inherit version disabled;
+
+  src = fetchPypi {
+    inherit pname version sha256;
+  };
+
+  LC_ALL = "en_US.UTF-8";
+
+  # checkPhase require at least one 'normal' font and one 'monospace',
+  # otherwise glyph tests fails
+  FONTCONFIG_FILE = makeFontsConf {
+    fontDirectories = [ freefont_ttf ];
+  };
+
+  checkInputs = [ pytest pytestrunner glibcLocales ];
+  propagatedBuildInputs = [ cairo cffi ] ++ lib.optional withXcffib xcffib;
+
+  checkPhase = ''
+    py.test $out/${python.sitePackages}
+  '';
+
+  patches = [
+    # OSError: dlopen() failed to load a library: gdk_pixbuf-2.0 / gdk_pixbuf-2.0-0
+    (substituteAll {
+      src = dlopen_patch;
+      ext = stdenv.hostPlatform.extensions.sharedLibrary;
+      cairo = cairo.out;
+      glib = glib.out;
+      gdk_pixbuf = gdk_pixbuf.out;
+    })
+    ./fix_test_scaled_font.patch
+  ];
+
+  meta = with lib; {
+    homepage = https://github.com/SimonSapin/cairocffi;
+    license = licenses.bsd3;
+    maintainers = with maintainers; [];
+    description = "cffi-based cairo bindings for Python";
+  };
+}