From c702c5a8849f9bda8203bc7d39e665c0b72b50ee Mon Sep 17 00:00:00 2001 From: lixiaoyong1 Date: Thu, 9 May 2024 17:04:04 +0800 Subject: [PATCH] fix(cmake): skip empty PYBIND11_PYTHON_EXECUTABLE_LAST for the first cmake run (cherry picked from commit 7c7c7018d4f77a18ecb6523d67c9ff1b93608fcc) --- ...mpty-PYBIND11_PYTHON_EXECUTABLE_LAST.patch | 52 +++++++++++++++++++ pybind11.spec | 6 ++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 0001-fix-cmake-skip-empty-PYBIND11_PYTHON_EXECUTABLE_LAST.patch diff --git a/0001-fix-cmake-skip-empty-PYBIND11_PYTHON_EXECUTABLE_LAST.patch b/0001-fix-cmake-skip-empty-PYBIND11_PYTHON_EXECUTABLE_LAST.patch new file mode 100644 index 0000000..5776112 --- /dev/null +++ b/0001-fix-cmake-skip-empty-PYBIND11_PYTHON_EXECUTABLE_LAST.patch @@ -0,0 +1,52 @@ +From aec6cc5406edb076f5a489c2d7f84bb07052c4a3 Mon Sep 17 00:00:00 2001 +From: Ilya Lavrenov +Date: Mon, 8 Jan 2024 17:40:41 +0400 +Subject: [PATCH] fix(cmake): skip empty PYBIND11_PYTHON_EXECUTABLE_LAST + for the first cmake run (#4856) + +* fix(cmake): skip empty PYBIND11_PYTHON_EXECUTABLE_LAST for the first cmake run + +* style: pre-commit fixes + +* Update pybind11NewTools.cmake + +* style: pre-commit fixes + +Reference: https://github.com/pybind/pybind11/commit/aec6cc5406edb076f5a489c2d7f84bb07052c4a3 +--------- + +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Co-authored-by: Henry Schreiner +--- + tools/pybind11NewTools.cmake | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/tools/pybind11NewTools.cmake b/tools/pybind11NewTools.cmake +index cd88a645..9fe2eb08 100644 +--- a/tools/pybind11NewTools.cmake ++++ b/tools/pybind11NewTools.cmake +@@ -110,15 +110,17 @@ if(NOT DEFINED ${_Python}_EXECUTABLE) + + endif() + +-if(NOT ${_Python}_EXECUTABLE STREQUAL PYBIND11_PYTHON_EXECUTABLE_LAST) ++if(DEFINED PYBIND11_PYTHON_EXECUTABLE_LAST AND NOT ${_Python}_EXECUTABLE STREQUAL ++ PYBIND11_PYTHON_EXECUTABLE_LAST) + # Detect changes to the Python version/binary in subsequent CMake runs, and refresh config if needed + unset(PYTHON_IS_DEBUG CACHE) + unset(PYTHON_MODULE_EXTENSION CACHE) +- set(PYBIND11_PYTHON_EXECUTABLE_LAST +- "${${_Python}_EXECUTABLE}" +- CACHE INTERNAL "Python executable during the last CMake run") + endif() + ++set(PYBIND11_PYTHON_EXECUTABLE_LAST ++ "${${_Python}_EXECUTABLE}" ++ CACHE INTERNAL "Python executable during the last CMake run") ++ + if(NOT DEFINED PYTHON_IS_DEBUG) + # Debug check - see https://stackoverflow.com/questions/646518/python-how-to-detect-debug-Interpreter + execute_process( +-- +2.18.2 + diff --git a/pybind11.spec b/pybind11.spec index ee28cda..8246060 100644 --- a/pybind11.spec +++ b/pybind11.spec @@ -2,12 +2,13 @@ %bcond_without tests Name: pybind11 Version: 2.11.1 -Release: 1 +Release: 2 Summary: Seamless operability between C++11 and Python License: BSD URL: https://github.com/pybind/pybind11 Source0: https://github.com/pybind/pybind11/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Patch0001: 0001-fix-cmake-skip-empty-PYBIND11_PYTHON_EXECUTABLE_LAST.patch BuildRequires: make cmake eigen3-devel gcc-c++ BuildRequires: python3-devel python3-setuptools @@ -76,6 +77,9 @@ PYBIND11_USE_CMAKE=true %py3_install "--install-purelib" "%{python3_sitearch}" %changelog +* Thu May 09 2024 lixiaoyong - 2.11.1-2 +- fix(cmake): skip empty PYBIND11_PYTHON_EXECUTABLE_LAST for the first cmake run + * Mon Jul 31 2023 zhangchenglin - 2.11.1-1 - Update package to version 2.11.1 -- Gitee