1{ lib
2, stdenv
3, fetchPypi
4, buildPythonPackage
5, appdirs
6, cffi
7, decorator
8, Mako
9, mesa_drivers
10, numpy
11, ocl-icd
12, opencl-headers
13, platformdirs
14, pybind11
15, pytest
16, pytools
17, six
18}:
19
20let
21 os-specific-buildInputs =
22 if stdenv.isDarwin then [ mesa_drivers.dev ] else [ ocl-icd ];
23in buildPythonPackage rec {
24 pname = "pyopencl";
25 version = "2022.2.4";
26
27 checkInputs = [ pytest ];
28 buildInputs = [ opencl-headers pybind11 ] ++ os-specific-buildInputs;
29
30 propagatedBuildInputs = [
31 appdirs
32 cffi
33 decorator
34 Mako
35 numpy
36 platformdirs
37 pytools
38 six
39 ];
40
41 src = fetchPypi {
42 inherit pname version;
43 sha256 = "sha256-tXye+L2ObbB+iRBvMJG6I2sk+Vo4/UDfsX0u1/9r5K0=";
44 };
45
46 # py.test is not needed during runtime, so remove it from `install_requires`
47 postPatch = ''
48 substituteInPlace setup.py --replace "pytest>=2" ""
49 '';
50
51 preBuild = ''
52 export HOME=$(mktemp -d)
53 '';
54
55 # gcc: error: pygpu_language_opencl.cpp: No such file or directory
56 doCheck = false;
57
58 meta = with lib; {
59 description = "Python wrapper for OpenCL";
60 homepage = "https://github.com/pyopencl/pyopencl";
61 license = licenses.mit;
62 maintainers = [ maintainers.fridh ];
63 };
64}