2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2021-05-20 23:08:51 +00:00
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchPypi
|
|
|
|
, buildPythonPackage
|
|
|
|
, Mako
|
|
|
|
, pytest
|
|
|
|
, numpy
|
|
|
|
, cffi
|
|
|
|
, pytools
|
|
|
|
, decorator
|
|
|
|
, appdirs
|
|
|
|
, six
|
|
|
|
, opencl-headers
|
|
|
|
, ocl-icd
|
|
|
|
, pybind11
|
2021-05-20 23:08:51 +00:00
|
|
|
, mesa_drivers
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
let
|
|
|
|
os-specific-buildInputs =
|
|
|
|
if stdenv.isDarwin then [ mesa_drivers.dev ] else [ ocl-icd ];
|
|
|
|
in buildPythonPackage rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "pyopencl";
|
2021-08-25 08:27:29 +00:00
|
|
|
version = "2021.2.6";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
checkInputs = [ pytest ];
|
2021-05-20 23:08:51 +00:00
|
|
|
buildInputs = [ opencl-headers pybind11 ] ++ os-specific-buildInputs;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [ numpy cffi pytools decorator appdirs six Mako ];
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-08-25 08:27:29 +00:00
|
|
|
sha256 = "df208546d28a3274ba7b554d50643ed1e393b8f3f75a43b24b83d3ee76597587";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# py.test is not needed during runtime, so remove it from `install_requires`
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py --replace "pytest>=2" ""
|
|
|
|
'';
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
'';
|
|
|
|
|
|
|
|
# gcc: error: pygpu_language_opencl.cpp: No such file or directory
|
|
|
|
doCheck = false;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Python wrapper for OpenCL";
|
|
|
|
homepage = "https://github.com/pyopencl/pyopencl";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ maintainers.fridh ];
|
|
|
|
};
|
|
|
|
}
|