guix_mirror_bot pushed a commit to branch python-team
in repository guix.

commit a6879a53e0ecb62d65e7d740a5310d7de492d447
Author: Nicolas Graves <[email protected]>
AuthorDate: Wed Jan 28 11:35:11 2026 +0100

    gnu: optizelle: Improve style and switch to pyproject.
    
    * gnu/packages/maths.scm (optizelle):
    [source]<snippet>: Improve style.
    [arguments]<#:imported-modules, #:modules>: Switch to
    pyproject-build-system.
    <#:phases>: Rewrite phase 'set-numpy-path using the site-packages
    procedure.
    [inputs, native-inputs]: Drop labels.
    
    Change-Id: I76db3d0353cf95e411cfd11a81b34cf6cd851d05
    Signed-off-by: Sharlatan Hellseher <[email protected]>
---
 gnu/packages/maths.scm | 77 +++++++++++++++++++++++---------------------------
 1 file changed, 36 insertions(+), 41 deletions(-)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index c954581dfa..4eafd3e458 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -10836,55 +10836,50 @@ half-precision floating point formats.")
                         (("file.*package.*$" all)
                          (string-append "# " all))
                         ((".*[^l].[.]txt\\)\n") "")
-                        (("add_license.*\"\n") ""))
-           #t))))
+                        (("add_license.*\"\n") ""))))))
     (build-system cmake-build-system)
     (arguments
-     `(#:imported-modules ((guix build python-build-system)
-                           ,@%cmake-build-system-modules)
-       #:modules (((guix build python-build-system) #:select
-                   (python-version))
+     (list
+      #:imported-modules (append %cmake-build-system-modules
+                                 %pyproject-build-system-modules)
+      #:modules `(((guix build pyproject-build-system) #:prefix py:)
                   (guix build cmake-build-system)
                   (guix build utils))
-       #:configure-flags `("-DCMAKE_CXX_FLAGS:STRING=-pthread"
-                           "-DENABLE_CPP_UNIT:BOOL=ON"
-                           "-DENABLE_CPP_EXAMPLES:BOOL=ON"
-                           "-DENABLE_PYTHON:BOOL=ON"
-                           "-DENABLE_PYTHON_UNIT:BOOL=ON"
-                           "-DENABLE_PYTHON_EXAMPLES:BOOL=ON"
-                           ,(string-append "-DBLAS_LIBRARY:FILEPATH="
-                                           (assoc-ref %build-inputs
-                                                      "blas/lapack")
-                                           "/lib/libopenblas.so")
-                           ,(string-append "-DLAPACK_LIBRARY:FILEPATH="
-                                           (assoc-ref %build-inputs
-                                                      "fortran:lib")
-                                           "/lib/libgfortran.so;"
-                                           (assoc-ref %build-inputs
-                                                      "fortran:lib")
-                                           "/lib/libquadmath.so"))
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'set-numpy-path ; Needed for the unit tests.
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let* ((pyver (python-version (assoc-ref inputs "python")))
-                    (npdir (string-append (assoc-ref inputs "numpy")
-                                          "/lib/python" pyver
-                                          "/site-packages")))
+      #:configure-flags
+      #~(list "-DCMAKE_CXX_FLAGS:STRING=-pthread"
+              "-DENABLE_CPP_UNIT:BOOL=ON"
+              "-DENABLE_CPP_EXAMPLES:BOOL=ON"
+              "-DENABLE_PYTHON:BOOL=ON"
+              "-DENABLE_PYTHON_UNIT:BOOL=ON"
+              "-DENABLE_PYTHON_EXAMPLES:BOOL=ON"
+              (string-append "-DBLAS_LIBRARY:FILEPATH="
+                             (search-input-file %build-inputs
+                                                "/lib/libopenblas.so"))
+              (string-append "-DLAPACK_LIBRARY:FILEPATH="
+                             (search-input-file %build-inputs
+                                                "/lib/libgfortran.so")
+                             ";" (search-input-file %build-inputs
+                                                    "/lib/libquadmath.so")))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'set-numpy-path ; Needed for the unit tests.
+            (lambda* (#:key inputs #:allow-other-keys)
+              (let* ((numpy-out (dirname (dirname (which "numpy-config"))))
+                     (outputs (list (cons "out" numpy-out))))
                 (substitute* "src/cmake/Modules/Optizelle.cmake"
                   (("PYTHONPATH=")
-                   (string-append "LD_LIBRARY_PATH=$ENV{LIBRARY_PATH};"
-                                  "PYTHONPATH=" npdir ":"))))))
-         (delete 'install-license-files)))) ; LICENSE.txt is installed.
+                   (string-append
+                    "LD_LIBRARY_PATH=$ENV{LIBRARY_PATH};"
+                    "PYTHONPATH=" (py:site-packages inputs outputs) ":"))))))
+          (delete 'install-license-files)))) ; LICENSE.txt is installed.
     (inputs
-     `(("blas/lapack" ,openblas)
-       ("fortran:lib" ,gfortran "lib")
-       ("jsoncpp" ,jsoncpp)
-       ("numpy" ,python-numpy)
-       ("python" ,python)))
+     (list openblas
+           (list gfortran "lib")
+           jsoncpp
+           python-numpy
+           python))
     (native-inputs
-     `(("fortran" ,gfortran)
-       ("pkg-config" ,pkg-config)))
+     (list gfortran pkg-config))
     (home-page "https://www.optimojoe.com/products/optizelle/";)
     (synopsis "Mathematical optimization library")
     (description "@code{optizelle} is a software library designed to

Reply via email to