58 lines
2.4 KiB
Diff
58 lines
2.4 KiB
Diff
From a13d33c47c0e713429f7cfbd6106a497838f6396 Mon Sep 17 00:00:00 2001
|
|
From: wangzengliang <wangzengliang1@huawei.com>
|
|
Date: Fri, 8 Apr 2022 11:35:38 +0800
|
|
Subject: [PATCH] cmake: add support python 3.10
|
|
|
|
---
|
|
cmake/modules/BuildBoost.cmake | 2 +-
|
|
cmake/modules/FindPython/Support.cmake | 2 +-
|
|
src/boost/libs/python/src/exec.cpp | 4 ++--
|
|
3 files changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/cmake/modules/BuildBoost.cmake b/cmake/modules/BuildBoost.cmake
|
|
index 468ae419c..320c2dcd5 100644
|
|
--- a/cmake/modules/BuildBoost.cmake
|
|
+++ b/cmake/modules/BuildBoost.cmake
|
|
@@ -70,7 +70,7 @@ function(do_build_boost version)
|
|
if(c MATCHES "^python([0-9])\$")
|
|
set(with_python_version "${CMAKE_MATCH_1}")
|
|
list(APPEND boost_with_libs "python")
|
|
- elseif(c MATCHES "^python([0-9])\\.?([0-9])\$")
|
|
+ elseif(c MATCHES "^python([0-9])\\.?([0-9]+)\$")
|
|
set(with_python_version "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}")
|
|
list(APPEND boost_with_libs "python")
|
|
else()
|
|
diff --git a/cmake/modules/FindPython/Support.cmake b/cmake/modules/FindPython/Support.cmake
|
|
index c05bbe330..fb362bfe2 100644
|
|
--- a/cmake/modules/FindPython/Support.cmake
|
|
+++ b/cmake/modules/FindPython/Support.cmake
|
|
@@ -17,7 +17,7 @@ if (NOT DEFINED _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
|
|
message (FATAL_ERROR "FindPython: INTERNAL ERROR")
|
|
endif()
|
|
if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL 3)
|
|
- set(_${_PYTHON_PREFIX}_VERSIONS 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
|
+ set(_${_PYTHON_PREFIX}_VERSIONS 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
|
elseif (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL 2)
|
|
set(_${_PYTHON_PREFIX}_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
|
|
else()
|
|
diff --git a/src/boost/libs/python/src/exec.cpp b/src/boost/libs/python/src/exec.cpp
|
|
index 171c6f418..caa7d0864 100644
|
|
--- a/src/boost/libs/python/src/exec.cpp
|
|
+++ b/src/boost/libs/python/src/exec.cpp
|
|
@@ -106,10 +106,10 @@ object BOOST_PYTHON_DECL exec_file(char const *filename, object global, object l
|
|
char *f = const_cast<char *>(filename);
|
|
// Let python open the file to avoid potential binary incompatibilities.
|
|
#if PY_VERSION_HEX >= 0x03040000
|
|
- FILE *fs = _Py_fopen(f, "r");
|
|
+ FILE *fs = fopen(f, "r");
|
|
#elif PY_VERSION_HEX >= 0x03000000
|
|
PyObject *fo = Py_BuildValue("s", f);
|
|
- FILE *fs = _Py_fopen(fo, "r");
|
|
+ FILE *fs = fopen(fo, "r");
|
|
Py_DECREF(fo);
|
|
#else
|
|
PyObject *pyfile = PyFile_FromString(f, const_cast<char*>("r"));
|
|
--
|
|
2.30.0
|
|
|