Skip to content

Commit 131eaff

Browse files
authored
[MERGE][PyAPI][CMAKE] Fixed pyversion detection (#32905) (#32938)
Ported #32905 ### Details: - Fixed detection of the free-threaded python version (Python3_SOABI is different then on Linux) - removed duplicated code ### Tickets: - *CVS-176831*
1 parent bfd48c3 commit 131eaff

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

cmake/developer_package/packaging/packaging.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function(ov_get_pyversion pyversion)
138138
find_package(Python3 QUIET COMPONENTS Interpreter Develoment.Module)
139139
if(Python3_Interpreter_FOUND)
140140
set(_pyversion "python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}")
141-
if(Python3_SOABI AND Python3_SOABI MATCHES "cpython-[0-9]+t-")
141+
if(Python3_SOABI AND (Python3_SOABI MATCHES "cpython-[0-9]+t-" OR Python3_SOABI MATCHES "cp[0-9]+t-"))
142142
set(_pyversion "${_pyversion}t")
143143
endif()
144144
set(${pyversion} "${_pyversion}" PARENT_SCOPE)

src/bindings/python/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,7 @@ add_subdirectory(src/pyopenvino)
214214

215215
macro(ov_define_setup_py_packaging_vars)
216216
# Python3_VERSION_MAJOR and Python3_VERSION_MINOR are defined inside pybind11
217-
set(pyversion python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR})
218-
if(Python3_SOABI AND Python3_SOABI MATCHES "cpython-[0-9]+t-")
219-
set(pyversion "${pyversion}t")
220-
endif()
217+
ov_get_pyversion(pyversion)
221218

222219
# define version (syncronize with tools/openvino_dev/CMakeLists.txt)
223220
if(DEFINED ENV{CI_BUILD_DEV_TAG} AND NOT "$ENV{CI_BUILD_DEV_TAG}" STREQUAL "")

src/bindings/python/src/pyopenvino/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@ if(NOT DEFINED OpenVINO_SOURCE_DIR)
77
find_package(OpenVINODeveloperPackage REQUIRED)
88
endif()
99

10-
# Python3_VERSION_MAJOR and Python3_VERSION_MINOR are defined by FindPython3
11-
set(pyversion python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR})
12-
if(Python3_SOABI AND Python3_SOABI MATCHES "cpython-[0-9]+t-")
13-
set(pyversion "${pyversion}t")
14-
endif()
10+
ov_get_pyversion(pyversion)
1511

1612
if(OV_GENERATOR_MULTI_CONFIG)
1713
set(PYTHON_BRIDGE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$<CONFIG>/python/openvino)

0 commit comments

Comments
 (0)