Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

Don't call paddle module if it's not found (#26286)

Ilya Lavrenov44caa9353203
diff --git a/src/frontends/paddle/tests/CMakeLists.txt b/src/frontends/paddle/tests/CMakeLists.txt
index 1cdcfa0c379..6f198debbaf 100644
--- a/src/frontends/paddle/tests/CMakeLists.txt
+++ b/src/frontends/paddle/tests/CMakeLists.txt
@@ -47,30 +47,31 @@ ov_add_test_target(
set(TEST_PADDLE_MODELS_DIRNAME ${TEST_MODEL_ZOO}/paddle_test_models)
target_compile_definitions(${TARGET_NAME} PRIVATE -D TEST_PADDLE_MODELS_DIRNAME=\"${TEST_PADDLE_MODELS_DIRNAME}/\")
-execute_process(
- COMMAND ${Python3_EXECUTABLE} -c "import paddle; print(paddle.__version__)"
- OUTPUT_VARIABLE PADDLE_VERSION
- OUTPUT_STRIP_TRAILING_WHITESPACE
-)
-message(STATUS "PaddlePaddle version: ${PADDLE_VERSION}")
-
-if(PADDLE_VERSION VERSION_GREATER_EQUAL "2.6.0" OR PADDLE_VERSION VERSION_EQUAL "0.0.0")
- set(PADDLEDET_OPS_URL "https://raw.githubusercontent.com/PaddlePaddle/PaddleDetection/release/2.5/ppdet/modeling/ops.py")
- set(PADDLEDET_OPS_SHA256 "e3da816421698ee97bb272c4410a03c300ab92045b7c87cccb9e52a8c18bc088")
- set(PADDLEDET_DIRNAME ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/PaddleDetection/release25/ppdet/modeling/)
-else()
- set(PADDLEDET_OPS_URL "https://raw.githubusercontent.com/PaddlePaddle/PaddleDetection/release/2.1/ppdet/modeling/ops.py")
- set(PADDLEDET_OPS_SHA256 "5cc079eda295ed78b58fba8223c51d85a931a7069ecad51c6af5c2fd26b7a8cb")
- set(PADDLEDET_DIRNAME ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/PaddleDetection/release21/ppdet/modeling/)
+if(paddlepaddle_FOUND)
+ execute_process(
+ COMMAND ${Python3_EXECUTABLE} -c "import paddle; print(paddle.__version__)"
+ OUTPUT_VARIABLE PADDLE_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ message(STATUS "PaddlePaddle version: ${PADDLE_VERSION}")
+
+ if(PADDLE_VERSION VERSION_GREATER_EQUAL "2.6.0" OR PADDLE_VERSION VERSION_EQUAL "0.0.0")
+ set(PADDLEDET_OPS_URL "https://raw.githubusercontent.com/PaddlePaddle/PaddleDetection/release/2.5/ppdet/modeling/ops.py")
+ set(PADDLEDET_OPS_SHA256 "e3da816421698ee97bb272c4410a03c300ab92045b7c87cccb9e52a8c18bc088")
+ set(PADDLEDET_DIRNAME ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/PaddleDetection/release25/ppdet/modeling/)
+ else()
+ set(PADDLEDET_OPS_URL "https://raw.githubusercontent.com/PaddlePaddle/PaddleDetection/release/2.1/ppdet/modeling/ops.py")
+ set(PADDLEDET_OPS_SHA256 "5cc079eda295ed78b58fba8223c51d85a931a7069ecad51c6af5c2fd26b7a8cb")
+ set(PADDLEDET_DIRNAME ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/PaddleDetection/release21/ppdet/modeling/)
+ endif()
+
+ DownloadAndCheck(${PADDLEDET_OPS_URL} ${PADDLEDET_DIRNAME}/ops.py PADDLEDET_FATAL PADDLEDET_RESULT ${PADDLEDET_OPS_SHA256})
endif()
-DownloadAndCheck(${PADDLEDET_OPS_URL} ${PADDLEDET_DIRNAME}/ops.py PADDLEDET_FATAL PADDLEDET_RESULT ${PADDLEDET_OPS_SHA256})
-
-# If 'paddlepaddle' is not found, code will still be compiled
-# but models will not be generated and tests will fail
+# If 'paddlepaddle' is not found, code will still be compiled, but models will not be generated and tests will fail
# This is done this way for 'code style' and check cases - cmake shall pass, but CI machine doesn't need to have
# 'paddlepaddle' installed to check code style
-if(paddlepaddle_FOUND AND PADDLEDET_RESULT)
+if(PADDLEDET_RESULT)
set(TEST_PADDLE_MODELS ${TEST_MODEL_ZOO_OUTPUT_DIR}/paddle_test_models/)
file(GLOB_RECURSE PADDLE_ALL_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/*.py)