depot/third_party/nixpkgs/pkgs/development/python-modules/pyopencl/default.nix
Default email 24fdeddc0a Project import generated by Copybara.
GitOrigin-RevId: 2768c7d042a37de65bb1b5b3268fc987e534c49d
2024-10-23 09:41:50 +03:00

97 lines
1.8 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
buildPythonPackage,
# build-system
cmake,
nanobind,
ninja,
numpy,
scikit-build-core,
# buildInputs
opencl-headers,
pybind11,
darwin,
ocl-icd,
# dependencies
platformdirs,
pytools,
# tests
pytestCheckHook,
}:
let
os-specific-buildInputs =
if stdenv.hostPlatform.isDarwin then [ darwin.apple_sdk.frameworks.OpenCL ] else [ ocl-icd ];
in
buildPythonPackage rec {
pname = "pyopencl";
version = "2024.3";
pyproject = true;
src = fetchFromGitHub {
owner = "inducer";
repo = "pyopencl";
rev = "refs/tags/v${version}";
fetchSubmodules = true;
hash = "sha256-HE7dARgKnZxqjAXX4iI1ml0N2BalyTo+ZAzjC2ThEN8=";
};
build-system = [
cmake
nanobind
ninja
numpy
scikit-build-core
];
dontUseCmakeConfigure = true;
buildInputs = [
opencl-headers
pybind11
] ++ os-specific-buildInputs;
dependencies = [
numpy
platformdirs
pytools
];
nativeCheckInputs = [ pytestCheckHook ];
preCheck = ''
export HOME=$(mktemp -d)
# https://github.com/NixOS/nixpkgs/issues/255262
cd $out
'';
# https://github.com/inducer/pyopencl/issues/784 Note that these failing
# tests are all the tests that are available.
doCheck = false;
pythonImportsCheck = [
"pyopencl"
"pyopencl.array"
"pyopencl.cltypes"
"pyopencl.compyte"
"pyopencl.elementwise"
"pyopencl.tools"
];
meta = {
description = "Python wrapper for OpenCL";
homepage = "https://github.com/pyopencl/pyopencl";
changelog = "https://github.com/inducer/pyopencl/releases/tag/v${version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ GaetanLepage ];
# ld: symbol(s) not found for architecture arm64
broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64;
};
}