python312Packages.imgsize: fix build, misc. cleanup

This commit is contained in:
FliegendeWurst 2025-02-01 09:19:00 +01:00
parent 815c84119d
commit 2ced75bec1

View File

@ -2,24 +2,50 @@
lib, lib,
buildPythonPackage, buildPythonPackage,
fetchFromGitHub, fetchFromGitHub,
pytestCheckHook,
pythonOlder,
rustPlatform,
}: }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "imgsize"; pname = "imgsize";
version = "3.0.1"; version = "3.0.1";
format = "setuptools"; pyproject = true;
disabled = pythonOlder "3.10";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "ojii"; owner = "ojii";
repo = pname; repo = "imgsize";
tag = version; tag = version;
sha256 = "sha256-i0YCt5jTnDAxnaxKSTloWrQn27yLAvZnghZlCgwZh0Q="; 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"; description = "Pure Python image size library";
homepage = "https://github.com/ojii/imgsize"; homepage = "https://github.com/ojii/imgsize";
license = with licenses; [ bsd3 ]; license = lib.licenses.bsd3;
maintainers = with maintainers; [ twey ]; maintainers = with lib.maintainers; [ twey ];
}; };
} }