depot/third_party/nixpkgs/pkgs/development/python-modules/pyopencl/default.nix
Default email f34ce41345 Project import generated by Copybara.
GitOrigin-RevId: b73c2221a46c13557b1b3be9c2070cc42cf01eb3
2024-07-27 08:49:29 +02:00

91 lines
1.5 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
buildPythonPackage,
# build-system
cmake,
scikit-build-core,
pathspec,
ninja,
nanobind,
# dependencies
appdirs,
cffi,
darwin,
decorator,
mako,
numpy,
ocl-icd,
oldest-supported-numpy,
opencl-headers,
platformdirs,
pybind11,
pytestCheckHook,
pytools,
six,
}:
let
os-specific-buildInputs = if stdenv.isDarwin then [ darwin.apple_sdk.frameworks.OpenCL ] else [ ocl-icd ];
in
buildPythonPackage rec {
pname = "pyopencl";
version = "2024.2.6";
format = "pyproject";
src = fetchFromGitHub {
owner = "inducer";
repo = "pyopencl";
rev = "refs/tags/v${version}";
hash = "sha256-nP7ZAGeRXrjqDRWlc2SDP1hk1fseGeu9Zx0lOp9Pchs=";
};
nativeBuildInputs = [
cmake
nanobind
ninja
numpy
oldest-supported-numpy
pathspec
scikit-build-core
];
dontUseCmakeConfigure = true;
buildInputs = [
opencl-headers
pybind11
] ++ os-specific-buildInputs;
propagatedBuildInputs = [
appdirs
cffi
decorator
mako
numpy
platformdirs
pytools
six
];
nativeCheckInputs = [ pytestCheckHook ];
preBuild = ''
export HOME=$(mktemp -d)
rm -rf pyopencl
'';
# gcc: error: pygpu_language_opencl.cpp: No such file or directory
doCheck = false;
pythonImportsCheck = [ "pyopencl" ];
meta = with lib; {
description = "Python wrapper for OpenCL";
homepage = "https://github.com/pyopencl/pyopencl";
license = licenses.mit;
};
}