Your message dated Tue, 15 Mar 2022 22:52:39 +0000
with message-id <e1nug1v-0008in...@fasolo.debian.org>
and subject line Bug#1006615: fixed in pybind11 2.9.1-2
has caused the Debian Bug report #1006615,
regarding python3-pybind11: Handle Python 3.10's default sysconfig paths
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
1006615: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1006615
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: python3-pybind11
Version: 2.9.1-1
Severity: normal
Tags: patch
Forwarded: https://github.com/pybind/pybind11/pull/3764

Until recently, the Python sysconfig module didn't know about Debian's
deb_system and posix_local schemes that were patched into
distutils.sysconfig. This changed in 3.10.2-3, to allow the deprecation
of distutils, upstream.

See https://bugs.launchpad.net/ubuntu/+source/python3.10/+bug/1960608
for some of the back-story here.

The effective change here is that with Python 3.10 as default, packages
using pybind11 are FTBFS because they can't find Python.h. e.g.
https://launchpad.net/ubuntu/+source/avogadrolibs/1.95.1-8

> CMake Error in python/CMakeLists.txt:
>   Imported target "pybind11::module" includes non-existent path
> 
>     "/usr/local/include/python3.10"
> 
>   in its INTERFACE_INCLUDE_DIRECTORIES.

I'm pointing to Ubuntu bugs here, because we're hitting these issues in
Ubuntu first, where Python 3.10 is the default Python 3. Debian hasn't
got there, yet.

The solutions here are two-fold:
1. Migrate from distutils.sysconfig to sysconfig. This needs to happen,
   upstream, before distutils is gone from stdlib.
2. Explicitly select the correct system scheme when looking for
   Python3's headers, rather than the default install-to-/usr/local
   scheme.

Attached are a pair of patches to address the issue. I've forwarded them
upstream in https://github.com/pybind/pybind11/pull/3764

SR
From 5262ff794498b45c12f23f64e9adef30d51e667f Mon Sep 17 00:00:00 2001
From: Stefano Rivera <stef...@rivera.za.net>
Date: Mon, 28 Feb 2022 12:49:51 -0400
Subject: [PATCH 1/2] Use sysconfig in Python >= 3.10

Rely on sysconfig for installation paths for Python >= 3.10. distutils
has been deprecated and will be removed.

Fixes: #3677
---
 tools/FindPythonLibsNew.cmake | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/tools/FindPythonLibsNew.cmake b/tools/FindPythonLibsNew.cmake
index 7aeffa44..31eeffa0 100644
--- a/tools/FindPythonLibsNew.cmake
+++ b/tools/FindPythonLibsNew.cmake
@@ -112,11 +112,20 @@ endif()
 # VERSION. VERSION will typically be like "2.7" on unix, and "27" on windows.
 execute_process(
   COMMAND
-    "${PYTHON_EXECUTABLE}" "-c" "from distutils import sysconfig as s;import sys;import struct;
+    "${PYTHON_EXECUTABLE}" "-c" "
+import sys;import struct;
+import sysconfig as s
+USE_SYSCONFIG = sys.version_info >= (3, 10)
+if not USE_SYSCONFIG:
+    from distutils import sysconfig as ds
 print('.'.join(str(v) for v in sys.version_info));
 print(sys.prefix);
-print(s.get_python_inc(plat_specific=True));
-print(s.get_python_lib(plat_specific=True));
+if USE_SYSCONFIG:
+    print(s.get_path('platinclude'))
+    print(s.get_path('platlib'))
+else:
+    print(ds.get_python_inc(plat_specific=True));
+    print(ds.get_python_lib(plat_specific=True));
 print(s.get_config_var('EXT_SUFFIX') or s.get_config_var('SO'));
 print(hasattr(sys, 'gettotalrefcount')+0);
 print(struct.calcsize('@P'));
-- 
2.34.1

From 697e8e1fca67bb48e477a61a9bbfa049c653ecd2 Mon Sep 17 00:00:00 2001
From: Stefano Rivera <stef...@rivera.za.net>
Date: Mon, 28 Feb 2022 13:11:45 -0400
Subject: [PATCH 2/2] Explicitly select the posix_prefix scheme for platinclude
 on Debian

Debian's default scheme is posix_local, for installing locally-built
packages to /usr/local/.  We want to find the Python headers in /usr/,
so search posix_prefix.
---
 tools/FindPythonLibsNew.cmake | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/FindPythonLibsNew.cmake b/tools/FindPythonLibsNew.cmake
index 31eeffa0..6ad5fe15 100644
--- a/tools/FindPythonLibsNew.cmake
+++ b/tools/FindPythonLibsNew.cmake
@@ -121,7 +121,11 @@ if not USE_SYSCONFIG:
 print('.'.join(str(v) for v in sys.version_info));
 print(sys.prefix);
 if USE_SYSCONFIG:
-    print(s.get_path('platinclude'))
+    scheme = s.get_default_scheme()
+    if scheme == 'posix_local':
+        # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/
+        scheme = 'posix_prefix'
+    print(s.get_path('platinclude', scheme))
     print(s.get_path('platlib'))
 else:
     print(ds.get_python_inc(plat_specific=True));
-- 
2.34.1


--- End Message ---
--- Begin Message ---
Source: pybind11
Source-Version: 2.9.1-2
Done: Drew Parsons <dpars...@debian.org>

We believe that the bug you reported is fixed in the latest version of
pybind11, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1006...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Drew Parsons <dpars...@debian.org> (supplier of updated pybind11 package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmas...@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Tue, 15 Mar 2022 20:54:33 +0100
Source: pybind11
Architecture: source
Version: 2.9.1-2
Distribution: unstable
Urgency: medium
Maintainer: Debian Science Maintainers 
<debian-science-maintain...@lists.alioth.debian.org>
Changed-By: Drew Parsons <dpars...@debian.org>
Closes: 1006615
Changes:
 pybind11 (2.9.1-2) unstable; urgency=medium
 .
   * Team upload.
   * debian patch python_paths_PR3764.patch applies upstream PR#3764
     to fix python path used by cmake. Closes: #1006615.
Checksums-Sha1:
 6352ab379458ce70232a1d4c7a85278626e8a478 2629 pybind11_2.9.1-2.dsc
 110fa647661203c53d221849aa5bb52424074671 68800 pybind11_2.9.1-2.debian.tar.xz
Checksums-Sha256:
 1bd296eeddb4790dbf56d049e93d9575458dd3195e16576828b9fca35ca7f123 2629 
pybind11_2.9.1-2.dsc
 4515468a1500aa6548f8c4a70577b272c1724f194927a4281674dd0e7a7e1856 68800 
pybind11_2.9.1-2.debian.tar.xz
Files:
 ef01b880cc9dae8faa4477836ebf7328 2629 libs optional pybind11_2.9.1-2.dsc
 58aa6eb3ea37706f9f5caf945d198e92 68800 libs optional 
pybind11_2.9.1-2.debian.tar.xz

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEI8mpPlhYGekSbQo2Vz7x5L1aAfoFAmIxE0cACgkQVz7x5L1a
AfrE3g/+NlprF/vra9zZsvdJSs1ezCRXxxdI1Eki80r2J1NExZ58hOr8Rd+1i3xx
UkMmgmsfZQXdUI9ApbAtkkMBNSKPiSvQRpvxuDQiTFPefrSoBas/9k4P6NKFp4HK
PqN2QQ+trRUDxeV+fXzKGWII7Uic/Cmdi3hLhSWvnHAlfsDQzCNTVl3g7kB0svS/
NSGeK12bZX0rnwicwD7Zt2VpKQ9EGWUSv2hpv/D6QbjbQFJusy6OvuYyns0ij9XC
u729rhK6QBNDO8Bqhzn+691eMwyJOKNk3BmOcDMFR/Qx9LeUIle+dk0zjlcLaquP
vgzK+bi9Yf5mRtYCxd0tJoXpSTWNDFCvC+8FfJXOjahFq72hNvNt4K1jhawfu79o
uJAnGnF1f2yb4YK07cs2eb4J8xDqBB4GmlTjEBW5+RJE+1T4GUm7DscWpsewvApV
2Yg7MV0nNLHVvUT4D5kziIJjozhBS3UtF+KqUtHaUNDwwhgeu0+LZLq49R5XjnvI
234/3vLK4e7T1tdL3aRgH2mw5WL1W4bdZtvPImEsI7QAhayTOVwMVMEu3R+Mm3Su
osIpfRDTFM7fGgf4DSG0JenbQ3Wmy968sulUKeco2lW1EKYue1TIM0YmJEAUFkVq
3JWmiLGXCVQPKV3Imqeh4VPd9Vtp62hH4FLzTpCeW6xQLFraku8=
=HoC8
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to