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 pname version src;
28 hash = "sha256-51qJAcJvolYCW3XWeymc2xd2QHiKLd7MdRdDedEH8QY=";
29 };
30
31 nativeCheckInputs = [ pytestCheckHook ];
32 preCheck = ''
33 # pytestCheckHook puts . at the front of Python's sys.path, due to:
34 # https://github.com/NixOS/nixpkgs/issues/255262
35 # So we need to prevent pytest from trying to import kurbopy from
36 # ./kurbopy, which contains the sources but not the newly built module.
37 # We want it to import kurbopy from the nix store via $PYTHONPATH instead.
38 rm -r kurbopy
39 '';
40
41 meta = with lib; {
42 description = "Python wrapper around the Rust kurbo library for 2D curve manipulation";
43 homepage = "https://github.com/simoncozens/kurbopy";
44 license = licenses.asl20;
45 maintainers = with maintainers; [ danc86 ];
46 };
47}