2020-04-24 23:36:52 +00:00
|
|
|
# FIXME: make gdk-pixbuf dependency optional
|
|
|
|
{ stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, pythonOlder
|
|
|
|
, fetchPypi
|
|
|
|
, lib
|
|
|
|
, substituteAll
|
|
|
|
, makeFontsConf
|
|
|
|
, freefont_ttf
|
2022-11-04 12:27:35 +00:00
|
|
|
, pikepdf
|
2020-04-24 23:36:52 +00:00
|
|
|
, pytest
|
|
|
|
, glibcLocales
|
|
|
|
, cairo
|
|
|
|
, cffi
|
2021-04-08 16:26:57 +00:00
|
|
|
, numpy
|
2022-01-19 23:45:15 +00:00
|
|
|
, withXcffib ? false
|
|
|
|
, xcffib
|
2020-04-24 23:36:52 +00:00
|
|
|
, python
|
|
|
|
, glib
|
|
|
|
, gdk-pixbuf
|
2022-01-19 23:45:15 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cairocffi";
|
2022-11-04 12:27:35 +00:00
|
|
|
version = "1.4.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.5";
|
2022-01-19 23:45:15 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2022-11-04 12:27:35 +00:00
|
|
|
sha256 = "sha256-UJM5syzNjXsAwiBMMnNs3njbU6MuahYtMSR40lYmzZo=";
|
2022-01-19 23:45:15 +00:00
|
|
|
};
|
|
|
|
|
2022-11-04 12:27:35 +00:00
|
|
|
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
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.cfg \
|
|
|
|
--replace "pytest-runner" "" \
|
|
|
|
--replace "pytest-cov" "" \
|
|
|
|
--replace "pytest-flake8" "" \
|
|
|
|
--replace "pytest-isort" "" \
|
|
|
|
--replace "--flake8 --isort" ""
|
|
|
|
'';
|
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
|
|
|
|
propagatedNativeBuildInputs = [ cffi ];
|
|
|
|
|
2022-11-04 12:27:35 +00:00
|
|
|
propagatedBuildInputs = [ cairo cffi ]
|
|
|
|
++ lib.optional withXcffib xcffib;
|
2022-01-19 23:45:15 +00:00
|
|
|
|
2022-11-04 12:27:35 +00:00
|
|
|
# pytestCheckHook does not work
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ numpy pikepdf pytest glibcLocales ];
|
2022-01-19 23:45:15 +00:00
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
py.test $out/${python.sitePackages}
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/SimonSapin/cairocffi";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ SuperSandro2000 ];
|
|
|
|
description = "cffi-based cairo bindings for Python";
|
|
|
|
};
|
|
|
|
}
|