diff --git a/cmake/developer_package/packaging/packaging.cmake b/cmake/developer_package/packaging/packaging.cmake index 0575b11ecd9307..e695349c1e9832 100644 --- a/cmake/developer_package/packaging/packaging.cmake +++ b/cmake/developer_package/packaging/packaging.cmake @@ -137,7 +137,11 @@ endfunction() function(ov_get_pyversion pyversion) find_package(Python3 QUIET COMPONENTS Interpreter Develoment.Module) if(Python3_Interpreter_FOUND) - set(${pyversion} "python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}" PARENT_SCOPE) + set(_pyversion "python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}") + if(Python3_SOABI AND Python3_SOABI MATCHES "cpython-[0-9]+t-") + set(_pyversion "${_pyversion}t") + endif() + set(${pyversion} "${_pyversion}" PARENT_SCOPE) else() set(${pyversion} "NOT-FOUND" PARENT_SCOPE) endif() diff --git a/setup.py b/setup.py index 65af07cd9abb0f..a06d424d19ef78 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,9 @@ WHEEL_PACKAGE_DIR = "openvino" WHEEL_LIBS_INSTALL_DIR = f"{WHEEL_PACKAGE_DIR}/libs" WHEEL_LIBS_PACKAGE = "openvino.libs" -PYTHON_VERSION = f"python{sys.version_info.major}.{sys.version_info.minor}" + +suffix = 't' if hasattr(sys, '_is_gil_enabled') and not sys._is_gil_enabled() else '' +PYTHON_VERSION = f"python{sys.version_info.major}.{sys.version_info.minor}{suffix}" LIBS_DIR = "bin" if platform.system() == "Windows" else "lib" diff --git a/src/bindings/python/CMakeLists.txt b/src/bindings/python/CMakeLists.txt index 846620d325f9b7..830df464d48bcc 100644 --- a/src/bindings/python/CMakeLists.txt +++ b/src/bindings/python/CMakeLists.txt @@ -215,6 +215,9 @@ add_subdirectory(src/pyopenvino) macro(ov_define_setup_py_packaging_vars) # Python3_VERSION_MAJOR and Python3_VERSION_MINOR are defined inside pybind11 set(pyversion python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}) + if(Python3_SOABI AND Python3_SOABI MATCHES "cpython-[0-9]+t-") + set(pyversion "${pyversion}t") + endif() # define version (syncronize with tools/openvino_dev/CMakeLists.txt) if(DEFINED ENV{CI_BUILD_DEV_TAG} AND NOT "$ENV{CI_BUILD_DEV_TAG}" STREQUAL "") diff --git a/src/bindings/python/src/pyopenvino/CMakeLists.txt b/src/bindings/python/src/pyopenvino/CMakeLists.txt index 6c69a811504d69..28c3659a5b3a1a 100644 --- a/src/bindings/python/src/pyopenvino/CMakeLists.txt +++ b/src/bindings/python/src/pyopenvino/CMakeLists.txt @@ -9,6 +9,9 @@ endif() # Python3_VERSION_MAJOR and Python3_VERSION_MINOR are defined by FindPython3 set(pyversion python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}) +if(Python3_SOABI AND Python3_SOABI MATCHES "cpython-[0-9]+t-") + set(pyversion "${pyversion}t") +endif() if(OV_GENERATOR_MULTI_CONFIG) set(PYTHON_BRIDGE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$/python/openvino)