about summary refs log tree commit diff
path: root/pkgs/development/python-modules/cairocffi/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/cairocffi/default.nix')
-rw-r--r--pkgs/development/python-modules/cairocffi/default.nix67
1 files changed, 59 insertions, 8 deletions
diff --git a/pkgs/development/python-modules/cairocffi/default.nix b/pkgs/development/python-modules/cairocffi/default.nix
index 8e26517ba2185..cc4e19d6beb7f 100644
--- a/pkgs/development/python-modules/cairocffi/default.nix
+++ b/pkgs/development/python-modules/cairocffi/default.nix
@@ -12,16 +12,67 @@
 , cairo
 , cffi
 , numpy
-, withXcffib ? false, xcffib
+, withXcffib ? false
+, xcffib
 , python
 , glib
 , gdk-pixbuf
-}@args:
+}:
+
+buildPythonPackage rec {
+  pname = "cairocffi";
+  version = "1.3.0";
 
-import ./generic.nix ({
-  version = "1.2.0";
-  sha256 = "sha256-mpebUAxkyBef7ChvM36P5kTsovLNBYYM4LYtJfIuoUA=";
-  dlopen_patch = ./dlopen-paths.patch;
   disabled = pythonOlder "3.5";
-  inherit withXcffib;
-} // args)
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "sha256-EIo6fLCeIDvdhQHZuq2R14bSBFYb1x6TZOizSJfEe5E=";
+  };
+
+  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 ];
+  };
+
+  propagatedBuildInputs = [ cairo cffi ] ++ lib.optional withXcffib xcffib;
+  propagatedNativeBuildInputs = [ cffi ];
+
+  # pytestCheckHook does not work
+  checkInputs = [ numpy pytest glibcLocales ];
+
+  postPatch = ''
+    substituteInPlace setup.cfg \
+      --replace "pytest-runner" "" \
+      --replace "pytest-cov" "" \
+      --replace "pytest-flake8" "" \
+      --replace "pytest-isort" "" \
+      --replace "--flake8 --isort" ""
+  '';
+
+  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-paths.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; [ SuperSandro2000 ];
+    description = "cffi-based cairo bindings for Python";
+  };
+}