From b54ade76abf2f1be40b14cf3d823488eb74d4ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 18 May 2021 08:17:21 +0200 Subject: [PATCH] Python3 dependency is not obligatory Some of the CI-Linux-Distros jobs failed because of this. Python3 is not available by default on Debian:9 nor in Centos:8. Since we are not currently running the tests in those platforms, and python3 is just used for testing, we do not want to enforce this project dependency. --- CMakeLists.txt | 28 +++++++++++++++------------- cmake/findDependencies.cmake | 2 +- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e3c91f0f..410dad4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,21 +91,23 @@ if( EXIV2_BUILD_UNIT_TESTS ) endif() if( EXIV2_BUILD_SAMPLES ) - add_test(NAME bashTests - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests - COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py bash_tests/testcases.py --verbose - ) - add_test(NAME versionTests - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests - COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py bash_tests/version_test.py - ) - add_test(NAME pythonTests - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests - COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py - ) - add_subdirectory( samples ) get_directory_property(SAMPLES DIRECTORY samples DEFINITION APPLICATIONS) + + if (Python3_Interpreter_FOUND) + add_test(NAME bashTests + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests + COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py bash_tests/testcases.py --verbose + ) + add_test(NAME versionTests + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests + COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py bash_tests/version_test.py + ) + add_test(NAME pythonTests + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests + COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py + ) + endif() endif() if( EXIV2_ENABLE_NLS ) diff --git a/cmake/findDependencies.cmake b/cmake/findDependencies.cmake index 94235c94..55e0f140 100644 --- a/cmake/findDependencies.cmake +++ b/cmake/findDependencies.cmake @@ -11,7 +11,7 @@ else() list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}) endif() -find_package (Python3 COMPONENTS Interpreter REQUIRED) +find_package (Python3 COMPONENTS Interpreter) # don't use Frameworks on the Mac (#966) if (APPLE)