Merge pull request #307098 from r-ryantm/auto-update/cilium-cli
[NixPkgs.git] / pkgs / development / python-modules / pyvips / default.nix
bloba3872cdb858ba379b349ce75eec4f81bbcb618ca
1 { stdenv
2 , buildPythonPackage
3 , pythonOlder
4 , fetchFromGitHub
5 , pytestCheckHook
6 , glib
7 , vips
8 , cffi
9 , pkgconfig  # from pythonPackages
10 , pkg-config  # from pkgs
11 , lib }:
13 buildPythonPackage rec {
14   pname = "pyvips";
15   version = "2.2.1";
16   format = "setuptools";
18   disabled = pythonOlder "3.7";
20   src = fetchFromGitHub {
21     owner = "libvips";
22     repo = "pyvips";
23     rev = "v${version}";
24     hash = "sha256-9S7h3bkm+QP78cpemYS7l3c8t+wXsJ5MUAP2T50R/Mc=";
25   };
27   nativeBuildInputs = [ pkgconfig pkg-config ];
29   buildInputs = [ glib vips ];
31   propagatedBuildInputs = [ cffi ];
33   env = lib.optionalAttrs stdenv.cc.isClang {
34     NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-function-pointer-types";
35   };
37   nativeCheckInputs = [ pytestCheckHook ];
39   postPatch = ''
40     substituteInPlace pyvips/__init__.py \
41       --replace 'libvips.so.42' '${lib.getLib vips}/lib/libvips${stdenv.hostPlatform.extensions.sharedLibrary}' \
42       --replace 'libvips.42.dylib' '${lib.getLib vips}/lib/libvips${stdenv.hostPlatform.extensions.sharedLibrary}' \
43       --replace 'libgobject-2.0.so.0' '${glib.out}/lib/libgobject-2.0${stdenv.hostPlatform.extensions.sharedLibrary}' \
44       --replace 'libgobject-2.0.dylib' '${glib.out}/lib/libgobject-2.0${stdenv.hostPlatform.extensions.sharedLibrary}' \
45   '';
47   pythonImportsCheck = [ "pyvips" ];
49   meta = with lib; {
50     description = "A python wrapper for libvips";
51     homepage = "https://github.com/libvips/pyvips";
52     changelog = "https://github.com/libvips/pyvips/blob/v${version}/CHANGELOG.rst";
53     license = licenses.mit;
54     maintainers = with maintainers; [ ccellado anthonyroussel ];
55   };