From ec7162213f204241c7a4c8f40663877eb10c9c51 Mon Sep 17 00:00:00 2001 From: p-wysocki Date: Tue, 22 Oct 2024 17:11:15 +0200 Subject: [PATCH 1/3] Migrate wheel build to python -m build --- src/bindings/python/requirements.txt | 1 + src/bindings/python/wheel/CMakeLists.txt | 33 ++++++------------------ 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/src/bindings/python/requirements.txt b/src/bindings/python/requirements.txt index e311c6ed6438db..0a9d90f03c62e4 100644 --- a/src/bindings/python/requirements.txt +++ b/src/bindings/python/requirements.txt @@ -1,3 +1,4 @@ numpy>=1.16.6,<2.1.0 openvino-telemetry>=2023.2.1 +build<1.3 packaging diff --git a/src/bindings/python/wheel/CMakeLists.txt b/src/bindings/python/wheel/CMakeLists.txt index 7d8ebd5256a968..8922faaf4561c7 100644 --- a/src/bindings/python/wheel/CMakeLists.txt +++ b/src/bindings/python/wheel/CMakeLists.txt @@ -100,31 +100,14 @@ set(openvino_wheel_path "${openvino_wheels_output_dir}/${openvino_wheel_name}") # create target for openvino.wheel # -execute_process(COMMAND ${Python3_EXECUTABLE} -m pip --version - OUTPUT_VARIABLE pip_version OUTPUT_STRIP_TRAILING_WHITESPACE) - -string(REGEX MATCH "pip[ ]+([\\.0-9]*)" pip_version "${pip_version}") -set(pip_version ${CMAKE_MATCH_1}) - -if(pip_version VERSION_GREATER_EQUAL 22.0) - set(wheel_build_command - ${Python3_EXECUTABLE} -m pip wheel - --no-deps - --wheel-dir ${openvino_wheels_output_dir} - --verbose - --build-option --build-number=${WHEEL_BUILD} - --build-option --plat-name=${PLATFORM_TAG} - "${CMAKE_CURRENT_SOURCE_DIR}") -else() - set(wheel_build_command - ${Python3_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/setup.py" - --quiet - --no-user-cfg - bdist_wheel - --dist-dir ${openvino_wheels_output_dir} - --build-number=${WHEEL_BUILD} - --plat-name=${PLATFORM_TAG}) -endif() +# for --config-setting explanation see https://github.com/pypa/setuptools/issues/2491 +set(wheel_build_command + ${Python3_EXECUTABLE} -m build "${CMAKE_CURRENT_SOURCE_DIR}" + --outdir ${openvino_wheels_output_dir} + --config-setting=--build-option=--build-number=${WHEEL_BUILD} + --config-setting=--build-option=--plat-name=${PLATFORM_TAG} + --config-setting=--quiet + --wheel) add_custom_command(OUTPUT ${openvino_wheel_path} COMMAND ${setup_py_env} ${wheel_build_command} From f3e5ff79840d5f746e137d6911453601c8001b3b Mon Sep 17 00:00:00 2001 From: p-wysocki Date: Tue, 22 Oct 2024 17:23:30 +0200 Subject: [PATCH 2/3] Minor change --- src/bindings/python/wheel/CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bindings/python/wheel/CMakeLists.txt b/src/bindings/python/wheel/CMakeLists.txt index 8922faaf4561c7..72828a155dd865 100644 --- a/src/bindings/python/wheel/CMakeLists.txt +++ b/src/bindings/python/wheel/CMakeLists.txt @@ -102,12 +102,12 @@ set(openvino_wheel_path "${openvino_wheels_output_dir}/${openvino_wheel_name}") # for --config-setting explanation see https://github.com/pypa/setuptools/issues/2491 set(wheel_build_command - ${Python3_EXECUTABLE} -m build "${CMAKE_CURRENT_SOURCE_DIR}" - --outdir ${openvino_wheels_output_dir} - --config-setting=--build-option=--build-number=${WHEEL_BUILD} - --config-setting=--build-option=--plat-name=${PLATFORM_TAG} - --config-setting=--quiet - --wheel) + ${Python3_EXECUTABLE} -m build "${CMAKE_CURRENT_SOURCE_DIR}" + --outdir ${openvino_wheels_output_dir} + --config-setting=--build-option=--build-number=${WHEEL_BUILD} + --config-setting=--build-option=--plat-name=${PLATFORM_TAG} + --config-setting=--quiet + --wheel) add_custom_command(OUTPUT ${openvino_wheel_path} COMMAND ${setup_py_env} ${wheel_build_command} From fc5123df1d2c84b96a24ef66afbb308db650340f Mon Sep 17 00:00:00 2001 From: p-wysocki Date: Tue, 22 Oct 2024 17:27:44 +0200 Subject: [PATCH 3/3] Requirements update --- src/bindings/python/constraints.txt | 1 + src/bindings/python/requirements.txt | 1 - src/bindings/python/wheel/requirements-dev.txt | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bindings/python/constraints.txt b/src/bindings/python/constraints.txt index b3a8267e4c1f14..fccd6f7879882d 100644 --- a/src/bindings/python/constraints.txt +++ b/src/bindings/python/constraints.txt @@ -8,6 +8,7 @@ pytest-html==4.1.1 pytest-timeout==2.3.1 # Python bindings +build<1.3 py>=1.9.0 pygments>=2.8.1 setuptools>=65.6.1,<75.3.0 diff --git a/src/bindings/python/requirements.txt b/src/bindings/python/requirements.txt index 0a9d90f03c62e4..e311c6ed6438db 100644 --- a/src/bindings/python/requirements.txt +++ b/src/bindings/python/requirements.txt @@ -1,4 +1,3 @@ numpy>=1.16.6,<2.1.0 openvino-telemetry>=2023.2.1 -build<1.3 packaging diff --git a/src/bindings/python/wheel/requirements-dev.txt b/src/bindings/python/wheel/requirements-dev.txt index c88d91751ebbc9..a6c2dcbdf8fee1 100644 --- a/src/bindings/python/wheel/requirements-dev.txt +++ b/src/bindings/python/wheel/requirements-dev.txt @@ -1,4 +1,5 @@ -c ../constraints.txt setuptools wheel +build patchelf; sys_platform == 'linux' and platform_machine == 'x86_64'