From 83ec3e48c34a39fa0273190ca23cea98926b0f4c Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Wed, 9 Oct 2024 17:44:39 -0400 Subject: [PATCH] Fix check for Python3 (#610) When changing to find_package(Python3) (see #610), the variable PYTHON_VERSION_MAJOR no longer gets set. That caused HAS_PYTHON3 to get set to FALSE and for the test TriBITS_sphinx_rst_generator_UnitTests to not get enabled (but is actually disabled using property DISABLED). NOTE: The CDash feature that reports when tests go missing caught this problem! (I never noticed that when doing local testing). Here is what that CDash email looked like: ---- Summary: [tribits-checkins] FAILED (m=1): TriBITS/TriBITS - tribits_cmake-3.25.2_makefiles_python-3.8_g++-11 - Continuous A submission to CDash for the project TriBITS has missing tests. You have been identified as one of the authors who have checked in changes that are part of this submission or you are listed in the default contact list. Details on the submission can be found at https://my.cdash.org/build/2685504. Project: TriBITS SubProject: TriBITS Site: ubuntu-latest Build Name: tribits_cmake-3.25.2_makefiles_python-3.8_g++-11 Build Time: 2024-10-09 16:55:55 Type: Continuous Total Missing Tests: 1 *Missing Tests* TriBITS_sphinx_rst_generator_UnitTests (https://my.cdash.org/viewTest.php?buildid=2685505) -CDash ---- That is such a nice feature! --- test/doc/CMakeLists.txt | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/test/doc/CMakeLists.txt b/test/doc/CMakeLists.txt index 6cc978641..26c550c0c 100644 --- a/test/doc/CMakeLists.txt +++ b/test/doc/CMakeLists.txt @@ -1,10 +1,3 @@ -if (PYTHON_VERSION_MAJOR GREATER_EQUAL 3) - set(HAS_PYTHON3 TRUE) -else() - set(HAS_PYTHON3 FALSE) -endif() - - advanced_set( ${PROJECT_NAME}_ENABLE_DOC_GENERATION_TESTS OFF CACHE BOOL "Enable testing for the build of the documentation, including using Sphinx. Requires docutils, sphinx, and sphinx-rd-theme and will blow away and rebuild the existing documentation in the source tree since the documentation builds in place. Therefore, one must be careful to not blow away non-tracked files." ) @@ -13,7 +6,7 @@ advanced_set( ${PROJECT_NAME}_ENABLE_DOC_GENERATION_TESTS OFF tribits_add_advanced_test( sphinx_rst_generator_UnitTests OVERALL_WORKING_DIRECTORY TEST_NAME OVERALL_NUM_MPI_PROCS 1 - EXCLUDE_IF_NOT_TRUE HAS_PYTHON3 + EXCLUDE_IF_NOT_TRUE Python3_EXECUTABLE TEST_0 CMND ${Python3_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/sphinx_rst_generator_UnitTests.py -v PASS_REGULAR_EXPRESSION "OK" @@ -21,7 +14,6 @@ tribits_add_advanced_test( sphinx_rst_generator_UnitTests DISABLED "Test is broken for long time, see commit c477daa1" ) - tribits_add_advanced_test( build_docs EXCLUDE_IF_NOT_TRUE ${PROJECT_NAME}_ENABLE_DOC_GENERATION_TESTS GIT_EXECUTABLE