1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 fonttools,
6 pytestCheckHook,
7 rustPlatform,
8}:
9
10buildPythonPackage rec {
11 pname = "kurbopy";
12 version = "0.11.1";
13 format = "setuptools";
14
15 src = fetchPypi {
16 inherit pname version;
17 hash = "sha256-05ezUpcHxCxo/4oyPKogq4/vdfpNnEBhtv+lYBjKdvg=";
18 };
19
20 propagatedBuildInputs = [ fonttools ];
21 nativeBuildInputs = [
22 rustPlatform.cargoSetupHook
23 rustPlatform.maturinBuildHook
24 ];
25
26 cargoDeps = rustPlatform.fetchCargoVendor {
27 inherit src;
28 name = "${pname}-${version}";
29 hash = "sha256-51qJAcJvolYCW3XWeymc2xd2QHiKLd7MdRdDedEH8QY=";
30 };
31
32 nativeCheckInputs = [ pytestCheckHook ];
33 preCheck = ''
34 # pytestCheckHook puts . at the front of Python's sys.path, due to:
35 # https://github.com/NixOS/nixpkgs/issues/255262
36 # So we need to prevent pytest from trying to import kurbopy from
37 # ./kurbopy, which contains the sources but not the newly built module.
38 # We want it to import kurbopy from the nix store via $PYTHONPATH instead.
39 rm -r kurbopy
40 '';
41
42 meta = with lib; {
43 description = "Python wrapper around the Rust kurbo library for 2D curve manipulation";
44 homepage = "https://github.com/simoncozens/kurbopy";
45 license = licenses.asl20;
46 maintainers = with maintainers; [ danc86 ];
47 };
48}