1{
2 lib,
3 fetchFromGitHub,
4 fetchpatch,
5 buildPythonPackage,
6 embree2,
7 cython,
8 numpy,
9 setuptools,
10 pytestCheckHook,
11}:
12
13buildPythonPackage rec {
14 pname = "embreex";
15 version = "2.17.7.post6";
16 pyproject = true;
17
18 src = fetchFromGitHub {
19 owner = "trimesh";
20 repo = "embreex";
21 tag = version;
22 hash = "sha256-iLIfhngorSFOdkOvlCAJQXGQrVuRfBSDGzvjXOlQuHk=";
23 };
24
25 patches = [
26 # https://github.com/trimesh/embreex/pull/7
27 (fetchpatch {
28 name = "fix-use-after-free.patch";
29 url = "https://github.com/trimesh/embreex/commit/c6b047285419f8986fae962e2734a01522be7ef7.patch";
30 hash = "sha256-s8x2vsqbsIR3aoNUDrYs2vQttuNY8lLJ6TC7H8FMRyQ=";
31 })
32 ];
33
34 build-system = [
35 setuptools
36 numpy
37 cython
38 ];
39
40 dependencies = [
41 numpy
42 ];
43
44 buildInputs = [
45 embree2
46 embree2.tbb
47 ];
48
49 pythonImportsCheck = [
50 "embreex"
51 "embreex.mesh_construction"
52 "embreex.rtcore"
53 "embreex.rtcore_scene"
54 "embreex.triangles"
55 ];
56
57 preCheck = ''
58 # conflicts with $out
59 rm -rf embreex/
60 '';
61
62 nativeCheckInputs = [ pytestCheckHook ];
63
64 meta = {
65 description = "Maintained PyEmbree fork, wrapper for Embree v2";
66 homepage = "https://github.com/trimesh/embreex";
67 changelog = "https://github.com/trimesh/embreex/releases/tag/${src.tag}";
68 license = lib.licenses.bsd2;
69 maintainers = with lib.maintainers; [ pbsds ];
70 inherit (embree2.meta) platforms;
71 };
72}