diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2018-02-21 03:25:23 +0100 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2018-02-27 19:29:56 +0100 |
commit | cd35a39b1176fc9b80c1ab72b2edc1c2b88a285a (patch) | |
tree | cb0eb01113aa4f42cbf8e40e48b33c84e77cb845 /pkgs/development/python-modules | |
parent | 795e49bc4f2fd4075d32fb20f775be46631243ed (diff) |
pythonPackages.cairocffi: move out of python-modules.nix
Diffstat (limited to 'pkgs/development/python-modules')
-rw-r--r-- | pkgs/development/python-modules/cairocffi/default.nix | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/cairocffi/default.nix b/pkgs/development/python-modules/cairocffi/default.nix new file mode 100644 index 0000000000000..e541d5b3aecc9 --- /dev/null +++ b/pkgs/development/python-modules/cairocffi/default.nix @@ -0,0 +1,65 @@ +{ buildPythonPackage +, fetchurl +, makeFontsConf +, freefont_ttf +, pytest +, glibcLocales +, cairo +, cffi +, withXcffib ? false, xcffib +, python +, fetchpatch +, glib +, gdk_pixbuf }: + +buildPythonPackage rec { + name = "cairocffi-0.7.2"; + + src = fetchurl { + url = "mirror://pypi/c/cairocffi/${name}.tar.gz"; + sha256 = "e42b4256d27bd960cbf3b91a6c55d602defcdbc2a73f7317849c80279feeb975"; + }; + + 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 glibcLocales ]; + propagatedBuildInputs = [ cairo cffi ] ++ lib.optional withXcffib xcffib; + + checkPhase = '' + py.test $out/${python.sitePackages} + ''; + + # FIXME: make gdk_pixbuf dependency optional + # Happens with 0.7.1 and 0.7.2 + # OSError: dlopen() failed to load a library: gdk_pixbuf-2.0 / gdk_pixbuf-2.0-0 + + patches = [ + # This patch from PR substituted upstream + (fetchpatch { + url = "https://github.com/avnik/cairocffi/commit/2266882e263c5efc87350cf016d117b2ec6a1d59.patch"; + sha256 = "0gb570z3ivf1b0ixsk526n3h29m8c5rhjsiyam7rr3x80dp65cdl"; + }) + + ./dlopen-paths.patch + ./fix_test_scaled_font.patch + ]; + + postPatch = '' + # Hardcode cairo library path + substituteInPlace cairocffi/__init__.py --subst-var-by cairo ${cairo.out} + substituteInPlace cairocffi/__init__.py --subst-var-by glib ${glib.out} + substituteInPlace cairocffi/__init__.py --subst-var-by gdk_pixbuf ${gdk_pixbuf.out} + ''; + + meta = { + homepage = https://github.com/SimonSapin/cairocffi; + license = "bsd"; + description = "cffi-based cairo bindings for Python"; + }; +} |