[staging-next] python312Packages.imgsize: fix build, misc. cleanup (#378665)

This commit is contained in:
Sandro 2025-02-04 22:21:12 +01:00 committed by GitHub
commit f56aaaac0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,24 +2,50 @@
lib,
buildPythonPackage,
fetchFromGitHub,
pytestCheckHook,
pythonOlder,
rustPlatform,
}:
buildPythonPackage rec {
pname = "imgsize";
version = "3.0.1";
format = "setuptools";
pyproject = true;
disabled = pythonOlder "3.10";
src = fetchFromGitHub {
owner = "ojii";
repo = pname;
repo = "imgsize";
tag = version;
sha256 = "sha256-i0YCt5jTnDAxnaxKSTloWrQn27yLAvZnghZlCgwZh0Q=";
};
meta = with lib; {
cargoDeps = rustPlatform.fetchCargoVendor {
inherit pname version src;
hash = "sha256-V/24lqMVTCw+9YMZQ7ABXnA0tzX8IQNxHtmNkHRbXbU=";
};
nativeBuildInputs = [
rustPlatform.cargoSetupHook
rustPlatform.maturinBuildHook
];
nativeCheckInputs = [
pytestCheckHook
];
# remove useless dev setup in conftest.py
preCheck = ''
substituteInPlace python-tests/conftest.py \
--replace-fail 'assert sys.prefix != sys.base_prefix, "must be in virtualenv"' "" \
--replace-fail 'check_call(' "# "
'';
meta = {
description = "Pure Python image size library";
homepage = "https://github.com/ojii/imgsize";
license = with licenses; [ bsd3 ];
maintainers = with maintainers; [ twey ];
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ twey ];
};
}