2022-05-18 14:49:53 +00:00
|
|
|
{ stdenv
|
|
|
|
, buildPythonPackage
|
2023-11-16 04:20:00 +00:00
|
|
|
, pythonOlder
|
2022-05-18 14:49:53 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, pytestCheckHook
|
|
|
|
, glib
|
|
|
|
, vips
|
|
|
|
, cffi
|
|
|
|
, pkgconfig # from pythonPackages
|
|
|
|
, pkg-config # from pkgs
|
|
|
|
, lib }:
|
2020-10-07 09:15:18 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pyvips";
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "2.2.1";
|
2024-01-02 11:29:13 +00:00
|
|
|
format = "setuptools";
|
2020-10-07 09:15:18 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "libvips";
|
|
|
|
repo = "pyvips";
|
|
|
|
rev = "v${version}";
|
2023-03-15 16:39:30 +00:00
|
|
|
hash = "sha256-9S7h3bkm+QP78cpemYS7l3c8t+wXsJ5MUAP2T50R/Mc=";
|
2020-10-07 09:15:18 +00:00
|
|
|
};
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig pkg-config ];
|
2020-10-07 09:15:18 +00:00
|
|
|
|
|
|
|
buildInputs = [ glib vips ];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [ cffi ];
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
env = lib.optionalAttrs stdenv.cc.isClang {
|
|
|
|
NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-function-pointer-types";
|
|
|
|
};
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2020-10-07 09:15:18 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyvips/__init__.py \
|
|
|
|
--replace 'libvips.so.42' '${lib.getLib vips}/lib/libvips${stdenv.hostPlatform.extensions.sharedLibrary}' \
|
|
|
|
--replace 'libvips.42.dylib' '${lib.getLib vips}/lib/libvips${stdenv.hostPlatform.extensions.sharedLibrary}' \
|
|
|
|
--replace 'libgobject-2.0.so.0' '${glib.out}/lib/libgobject-2.0${stdenv.hostPlatform.extensions.sharedLibrary}' \
|
|
|
|
--replace 'libgobject-2.0.dylib' '${glib.out}/lib/libgobject-2.0${stdenv.hostPlatform.extensions.sharedLibrary}' \
|
|
|
|
'';
|
|
|
|
|
2020-10-07 09:15:18 +00:00
|
|
|
pythonImportsCheck = [ "pyvips" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A python wrapper for libvips";
|
|
|
|
homepage = "https://github.com/libvips/pyvips";
|
2023-11-16 04:20:00 +00:00
|
|
|
changelog = "https://github.com/libvips/pyvips/blob/v${version}/CHANGELOG.rst";
|
2020-10-07 09:15:18 +00:00
|
|
|
license = licenses.mit;
|
2022-08-12 12:06:08 +00:00
|
|
|
maintainers = with maintainers; [ ccellado anthonyroussel ];
|
2020-10-07 09:15:18 +00:00
|
|
|
};
|
|
|
|
}
|