[BUG]: Distutils is going to be deprecated with Python3.12
envgap__pybind__pybind11-3677
01 / FAILURE SIGNATURE
As reported upstream
No identifying execution failure has been captured.
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
f495dfc4339df1454620ac2e7c0f5561959e86af- Manifest
CMakeLists.txt- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
pybind/pybind11 #3677 · read the original issue
### Required prerequisites
- [X] Make sure you've read the [documentation](https://pybind11.readthedocs.io). Your issue may be addressed there.
- [X] Search the [issue tracker](https://github.com/pybind/pybind11/issues) and [Discussions](https:/pybind/pybind11/discussions) to verify that this hasn't already been reported. +1 or comment there if it has.
- [X] Consider asking first in the [Gitter chat room](https://gitter.im/pybind/Lobby) or in a [Discussion](https:/pybind/pybind11/discussions/new).
### Problem description
In Python 3.12 distutils is going to be removed and with 3.10 it's marked as deprecated. Currently `tools/FindPythonLibsNew.cmake` is still using
["${PYTHON_EXECUTABLE}" "-c" "from distutils import sysconfig as s;import sys;import struct;](https://github.com/pybind/pybind11/blob/ce18721d830a9deb8cf1883b513bcb8f98090c35/tools/FindPythonLibsNew.cmake#L115)
It might be replaceable by a simple `import sysconfig as s;`
See [[0]](https://docs.python.org/3/whatsnew/3.10.html#distutils-deprecated) and [[1]](https://docs.python.org/3/library/distutils.html)
Kind regards,
Arno
### Reproducible example code
_No response_04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]