diff --git a/pkgs/development/python-modules/piqp/default.nix b/pkgs/development/python-modules/piqp/default.nix index 63c7bd058b37..efdb378f7130 100644 --- a/pkgs/development/python-modules/piqp/default.nix +++ b/pkgs/development/python-modules/piqp/default.nix @@ -1,86 +1,71 @@ { lib, - fetchFromGitHub, buildPythonPackage, - pytestCheckHook, - stdenv, - pythonOlder, - setuptools, + fetchFromGitHub, + replaceVars, + cpu_features, + + # build-system cmake, ninja, - wheel, - matio, + pybind11, + scikit-build-core, + + # buildInputs eigen, gtest, - cpu_features, - pybind11, - python, + matio, + + # tests numpy, scipy, + pytestCheckHook, }: buildPythonPackage rec { pname = "piqp"; - version = "0.6.0"; + version = "0.6.2"; pyproject = true; - disabled = pythonOlder "3.7"; - src = fetchFromGitHub { owner = "PREDICT-EPFL"; repo = "piqp"; tag = "v${version}"; - hash = "sha256-hVUeDV2GrBAOIgaWhg+RV+8CFRIm8Kv6/wCs5bXs2aY="; + hash = "sha256-W9t7d+wV5WcphL54e6tpnKxiWFay9UrFmIRKsGk2yMM="; }; - postPatch = - let - # E.g. 3.11.2 -> "311" - pythonVersionMajorMinor = - with lib.versions; - "${major python.pythonVersion}${minor python.pythonVersion}"; - - # E.g. "linux-aarch64" - platform = - with stdenv.hostPlatform; - (lib.optionalString (!isDarwin) "${parsed.kernel.name}-${parsed.cpu.name}") - + (lib.optionalString isDarwin "macosx-${darwinMinVersion}-${darwinArch}"); - in - '' - build="build/temp.${platform}-cpython-${pythonVersionMajorMinor}/${pname}.${pname}" - mkdir -p $build/_deps - ln -s ${cpu_features.src} $build/_deps/cpu_features-src - ''; - - patches = [ ./use-nix-packages.patch ]; + patches = [ + (replaceVars ./use-nix-packages.patch { + cpu_features_src = cpu_features.src; + }) + ]; build-system = [ - setuptools cmake ninja - wheel + pybind11 + scikit-build-core ]; + dontUseCmakeConfigure = true; buildInputs = [ - matio eigen gtest - pybind11 + matio ]; - dontUseCmakeConfigure = true; - pythonImportsCheck = [ "piqp" ]; nativeCheckInputs = [ - pytestCheckHook numpy + pytestCheckHook scipy ]; - meta = with lib; { + meta = { description = "Proximal Interior Point Quadratic Programming solver"; homepage = "https://github.com/PREDICT-EPFL/piqp"; - license = licenses.bsd2; - maintainers = with maintainers; [ renesat ]; + changelog = "https://github.com/PREDICT-EPFL/piqp/releases/tag/v${version}"; + license = lib.licenses.bsd2; + maintainers = with lib.maintainers; [ renesat ]; }; } diff --git a/pkgs/development/python-modules/piqp/use-nix-packages.patch b/pkgs/development/python-modules/piqp/use-nix-packages.patch index 27a61b165e54..ac4a5d87df50 100644 --- a/pkgs/development/python-modules/piqp/use-nix-packages.patch +++ b/pkgs/development/python-modules/piqp/use-nix-packages.patch @@ -1,21 +1,21 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index ea1da5e..0a6f096 100644 +index 8e0eb68..0131d4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -100,7 +100,7 @@ if (BUILD_PYTHON_INTERFACE OR BUILD_MATLAB_INTERFACE) +@@ -109,7 +109,7 @@ if (BUILD_PYTHON_INTERFACE OR BUILD_MATLAB_INTERFACE) include(FetchContent) FetchContent_Declare( cpu_features -- URL https://github.com/google/cpu_features/archive/refs/tags/v0.9.0.zip -+ DOWNLOAD_COMMAND true +- URL https://github.com/google/cpu_features/archive/refs/tags/v0.10.1.zip ++ URL @cpu_features_src@ ) set(BUILD_SHARED_LIBS_COPY ${BUILD_SHARED_LIBS}) set(BUILD_SHARED_LIBS OFF) diff --git a/interfaces/c/tests/CMakeLists.txt b/interfaces/c/tests/CMakeLists.txt -index 010f038..c8f9ec4 100644 +index 5919593..bf504c5 100644 --- a/interfaces/c/tests/CMakeLists.txt +++ b/interfaces/c/tests/CMakeLists.txt -@@ -13,18 +13,8 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") +@@ -17,18 +17,8 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.30.0") endif() # Google Test @@ -37,19 +37,16 @@ index 010f038..c8f9ec4 100644 enable_testing() diff --git a/interfaces/python/CMakeLists.txt b/interfaces/python/CMakeLists.txt -index f7415dc..885aeff 100644 +index b2e3cef..3d9cf65 100644 --- a/interfaces/python/CMakeLists.txt +++ b/interfaces/python/CMakeLists.txt -@@ -14,19 +14,7 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") +@@ -13,16 +13,7 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") + cmake_policy(SET CMP0135 OLD) endif() - # Find pybind11 --include(FetchContent) --FetchContent_Declare( -- pybind11 -- URL https://github.com/pybind/pybind11/archive/refs/tags/v2.12.0.zip --) --FetchContent_MakeAvailable(pybind11) +-# Find pybind11 +-set(PYBIND11_FINDPYTHON ON) +-find_package(pybind11 CONFIG REQUIRED) - -# detect arm64 cross compilation on macOS -if(DEFINED ENV{_PYTHON_HOST_PLATFORM}) @@ -62,7 +59,7 @@ index f7415dc..885aeff 100644 # add instruction set detection on x86/amd64 pybind11_add_module(instruction_set src/instruction_set.cpp) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt -index d11bd37..2275a62 100644 +index fded71a..cb568a7 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -14,18 +14,8 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")