about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pyopencl/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/pyopencl/default.nix')
-rw-r--r--pkgs/development/python-modules/pyopencl/default.nix90
1 files changed, 56 insertions, 34 deletions
diff --git a/pkgs/development/python-modules/pyopencl/default.nix b/pkgs/development/python-modules/pyopencl/default.nix
index ffce3a97b0c65..edf4a4bfe7a25 100644
--- a/pkgs/development/python-modules/pyopencl/default.nix
+++ b/pkgs/development/python-modules/pyopencl/default.nix
@@ -1,75 +1,97 @@
 {
   lib,
   stdenv,
-  fetchPypi,
+  fetchFromGitHub,
   buildPythonPackage,
-  appdirs,
-  cffi,
-  decorator,
-  mako,
-  mesa_drivers,
+
+  # build-system
+  cmake,
+  nanobind,
+  ninja,
   numpy,
-  ocl-icd,
-  oldest-supported-numpy,
+  scikit-build-core,
+
+  # buildInputs
   opencl-headers,
-  platformdirs,
   pybind11,
-  pytestCheckHook,
+  darwin,
+  ocl-icd,
+
+  # dependencies
+  platformdirs,
   pytools,
-  setuptools,
-  six,
-  wheel,
+
+  # tests
+  pytestCheckHook,
 }:
 
 let
-  os-specific-buildInputs = if stdenv.isDarwin then [ mesa_drivers.dev ] else [ ocl-icd ];
+  os-specific-buildInputs =
+    if stdenv.hostPlatform.isDarwin then [ darwin.apple_sdk.frameworks.OpenCL ] else [ ocl-icd ];
 in
 buildPythonPackage rec {
   pname = "pyopencl";
-  version = "2024.1";
-  format = "pyproject";
+  version = "2024.2.7";
+  pyproject = true;
 
-  src = fetchPypi {
-    inherit pname version;
-    hash = "sha256-7NVy7pQK2L2hY5w6e+tog0/JqYrX6z9uAarE99nUusE=";
+  src = fetchFromGitHub {
+    owner = "inducer";
+    repo = "pyopencl";
+    rev = "refs/tags/v${version}";
+    fetchSubmodules = true;
+    hash = "sha256-VeaEDYnGfMYf9/WqMIZ9g4KounD48eWF3Romt79RMEQ=";
   };
 
-  nativeBuildInputs = [
-    oldest-supported-numpy
-    setuptools
-    wheel
+  build-system = [
+    cmake
+    nanobind
+    ninja
+    numpy
+    scikit-build-core
   ];
 
+  dontUseCmakeConfigure = true;
+
   buildInputs = [
     opencl-headers
     pybind11
   ] ++ os-specific-buildInputs;
 
-  propagatedBuildInputs = [
-    appdirs
-    cffi
-    decorator
-    mako
+  dependencies = [
     numpy
     platformdirs
     pytools
-    six
   ];
 
   nativeCheckInputs = [ pytestCheckHook ];
 
-  preBuild = ''
+  preCheck = ''
     export HOME=$(mktemp -d)
+
+    # https://github.com/NixOS/nixpkgs/issues/255262
+    cd $out
   '';
 
-  # gcc: error: pygpu_language_opencl.cpp: No such file or directory
+  # https://github.com/inducer/pyopencl/issues/784 Note that these failing
+  # tests are all the tests that are available.
   doCheck = false;
 
-  pythonImportsCheck = [ "pyopencl" ];
+  pythonImportsCheck = [
+    "pyopencl"
+    "pyopencl.array"
+    "pyopencl.cltypes"
+    "pyopencl.compyte"
+    "pyopencl.elementwise"
+    "pyopencl.tools"
+  ];
 
-  meta = with lib; {
+  meta = {
     description = "Python wrapper for OpenCL";
     homepage = "https://github.com/pyopencl/pyopencl";
-    license = licenses.mit;
+    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;
   };
 }