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