Skip to content

Commit f56aaaa

Browse files
[staging-next] python312Packages.imgsize: fix build, misc. cleanup (NixOS#378665)
2 parents 3029205 + 2ced75b commit f56aaaa

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

pkgs/development/python-modules/imgsize/default.nix

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,50 @@
22
lib,
33
buildPythonPackage,
44
fetchFromGitHub,
5+
pytestCheckHook,
6+
pythonOlder,
7+
rustPlatform,
58
}:
69

710
buildPythonPackage rec {
811
pname = "imgsize";
912
version = "3.0.1";
10-
format = "setuptools";
13+
pyproject = true;
14+
15+
disabled = pythonOlder "3.10";
1116

1217
src = fetchFromGitHub {
1318
owner = "ojii";
14-
repo = pname;
19+
repo = "imgsize";
1520
tag = version;
1621
sha256 = "sha256-i0YCt5jTnDAxnaxKSTloWrQn27yLAvZnghZlCgwZh0Q=";
1722
};
1823

19-
meta = with lib; {
24+
cargoDeps = rustPlatform.fetchCargoVendor {
25+
inherit pname version src;
26+
hash = "sha256-V/24lqMVTCw+9YMZQ7ABXnA0tzX8IQNxHtmNkHRbXbU=";
27+
};
28+
29+
nativeBuildInputs = [
30+
rustPlatform.cargoSetupHook
31+
rustPlatform.maturinBuildHook
32+
];
33+
34+
nativeCheckInputs = [
35+
pytestCheckHook
36+
];
37+
38+
# remove useless dev setup in conftest.py
39+
preCheck = ''
40+
substituteInPlace python-tests/conftest.py \
41+
--replace-fail 'assert sys.prefix != sys.base_prefix, "must be in virtualenv"' "" \
42+
--replace-fail 'check_call(' "# "
43+
'';
44+
45+
meta = {
2046
description = "Pure Python image size library";
2147
homepage = "https://github.com/ojii/imgsize";
22-
license = with licenses; [ bsd3 ];
23-
maintainers = with maintainers; [ twey ];
48+
license = lib.licenses.bsd3;
49+
maintainers = with lib.maintainers; [ twey ];
2450
};
2551
}

0 commit comments

Comments
 (0)