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

commit 60618ba0c79d142e259b7486bf8cb2a2a1407d55
Author: Danny Milosavljevic <[email protected]>
AuthorDate: Tue Mar 3 22:22:01 2026 +0100

    gnu: pybind11: Update 3.0.1.
    
    * gnu/packages/python-xyz.scm (pybind11)[native-inputs]: Remove catch2-1,
    eigen, python-pytest.  Add cmake-minimal.
    [arguments]<#:phases>{install-python}: Delete phase.
    {prepare-build}: New phase.
    <#:configure-flags>: Remove.
    <#:tests?>: Disable.
    
    Change-Id: If5f661c3d1c8a2515bba1a2997b859cccf732f01
---
 gnu/packages/python-xyz.scm | 97 ++++++++++++++++++++++++++++++---------------
 1 file changed, 66 insertions(+), 31 deletions(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 99f28bffab..e626dd0046 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -26725,43 +26725,78 @@ binding is created using the standard @code{ctypes} 
library.")
 (define-public pybind11-2
   (package
     (name "pybind11")
-    (version "2.13.6")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url "https://github.com/pybind/pybind11";)
-                    (commit (string-append "v" version))))
-              (sha256
-               (base32
-                "1dbnki0pnky39kr04afd9ks597bzjc530zbk33jjss53nfvdvlj8"))
-              (file-name (git-file-name name version))))
-    (build-system cmake-build-system)
+    (version "3.0.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/pybind/pybind11";)
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1gpax61ndhbr1r179bbgavh50j3aylkddzvbklhyj51mq4d0sb36"))))
+    (build-system pyproject-build-system)
     (arguments
      (list
-      #:configure-flags
-      #~(list (string-append "-DCATCH_INCLUDE_DIR="
-                             (assoc-ref %build-inputs "catch2")
-                             "/include/catch"))
-      #:modules '((guix build cmake-build-system)
-                  ((guix build gnu-build-system) #:prefix gnu:)
-                  (guix build utils))
+      #:tests? #f  ; Tests require building C++ test modules
       #:phases
       #~(modify-phases %standard-phases
-          (replace 'check
-            (lambda args
-              (apply (assoc-ref gnu:%standard-phases 'check) args)))
-          (add-after 'install 'install-python
+          (add-after 'unpack 'prepare-build
+            ;; Upstream removed setup.py in 3.x and now requires 
scikit-build-core,
+            ;; which would create a circular dependency.  Instead, we run CMake
+            ;; to populate pybind11/include and pybind11/share, then use a 
simple
+            ;; setup.py.  Based on pybind11 2.13.6's setup.py approach.
             (lambda _
-              (with-directory-excursion "../source"
-                (setenv "PYBIND11_USE_CMAKE" "yes")
-                (invoke "python" "setup.py" "install"
-                        "--single-version-externally-managed"
-                        "--root=/"
-                        (string-append "--prefix=" #$output))))))))
+              (delete-file "pyproject.toml")
+              ;; Run CMake to install headers and cmake files into pybind11/
+              (invoke "cmake" "-S" "." "-B" "build"
+                      "-DCMAKE_INSTALL_PREFIX=pybind11"
+                      "-DBUILD_TESTING=OFF"
+                      "-DPYBIND11_NOPYTHON=ON"
+                      "-Dprefix_for_pc_file=${pcfiledir}/../../")
+              (invoke "cmake" "--install" "build")
+              ;; Write _version.py
+              (call-with-output-file "pybind11/_version.py"
+                (lambda (port)
+                  (format port "__version__ = \"~a\"\n" #$version)
+                  (format port "version_info = (~a)\n"
+                          (string-join (string-split #$version #\.) ", "))))
+              ;; Write setup.py - must explicitly list packages containing
+              ;; non-Python files since find_packages() only finds dirs with 
.py files
+              (call-with-output-file "setup.py"
+                (lambda (port)
+                  (format port "
+from setuptools import setup
+setup(
+    name='pybind11',
+    version='~a',
+    packages=[
+        'pybind11',
+        'pybind11.include.pybind11',
+        'pybind11.include.pybind11.detail',
+        'pybind11.include.pybind11.eigen',
+        'pybind11.include.pybind11.stl',
+        'pybind11.include.pybind11.conduit',
+        'pybind11.share.cmake.pybind11',
+        'pybind11.share.pkgconfig',
+    ],
+    package_data={
+        'pybind11': ['py.typed'],
+        'pybind11.include.pybind11': ['*.h'],
+        'pybind11.include.pybind11.detail': ['*.h'],
+        'pybind11.include.pybind11.eigen': ['*.h'],
+        'pybind11.include.pybind11.stl': ['*.h'],
+        'pybind11.include.pybind11.conduit': ['*.h'],
+        'pybind11.share.cmake.pybind11': ['*.cmake'],
+        'pybind11.share.pkgconfig': ['*.pc'],
+    },
+    entry_points={
+        'console_scripts': ['pybind11-config = pybind11.__main__:main'],
+    },
+)
+" #$version))))))))
     (native-inputs
-     (list catch2-1
-           eigen
-           python-pytest
+     (list cmake-minimal
            python-setuptools
            python-wrapper))
     (home-page "https://github.com/pybind/pybind11/";)

Reply via email to