From 1dd11d648417ca457af39afdb24b08fa95c9bd06 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 10 Dec 2024 14:21:29 -0500 Subject: [PATCH 1/2] COMP: Update python executable location and usage Use the CMake Python3 module instead of PythonInterp, which it has replaced with the Interpreter COMPONENT. Use Python 3 instead of Python 2, which is end-of-life. Ensure we use ${Python3_EXECUTABLE} in the test commands. --- CMakeLists.txt | 6 +++--- apps/paramaps/Testing/CMakeLists.txt | 4 ++-- apps/seg/Testing/CMakeLists.txt | 4 ++-- apps/sr/Testing/CMakeLists.txt | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 69335f25..b33f0535 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -246,10 +246,10 @@ mark_as_superbuild(JsonCpp_INCLUDE_DIR:PATH) mark_as_superbuild(JsonCpp_LIBRARY:FILEPATH) mark_as_superbuild(DCMQI_BUILTIN_JSONCPP:BOOL) -# Python 2.7 +# Python 3 if(BUILD_TESTING) - find_package(PythonInterp 2.7 REQUIRED) - mark_as_superbuild(PYTHON_EXECUTABLE) + find_package(Python3 COMPONENTS Interpreter REQUIRED) + mark_as_superbuild(Python3_EXECUTABLE) endif() #----------------------------------------------------------------------------- diff --git a/apps/paramaps/Testing/CMakeLists.txt b/apps/paramaps/Testing/CMakeLists.txt index df23eb3e..699c17e6 100644 --- a/apps/paramaps/Testing/CMakeLists.txt +++ b/apps/paramaps/Testing/CMakeLists.txt @@ -129,7 +129,7 @@ dcmqi_add_test( dcmqi_add_test( NAME ${MODULE_NAME}_meta_roundtrip MODULE_NAME ${MODULE_NAME} - COMMAND python ${CMAKE_SOURCE_DIR}/util/comparejson.py + COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/util/comparejson.py ${CMAKE_SOURCE_DIR}/doc/examples/pm-example.json ${MODULE_TEMP_DIR}/makeNRRDParametricMap-meta.json TEST_DEPENDS @@ -153,7 +153,7 @@ dcmqi_add_test( dcmqi_add_test( NAME ${MODULE_NAME}_FP_meta_roundtrip MODULE_NAME ${MODULE_NAME} - COMMAND python ${CMAKE_SOURCE_DIR}/util/comparejson.py + COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/util/comparejson.py ${CMAKE_SOURCE_DIR}/doc/examples/pm-example-float.json ${MODULE_TEMP_DIR}/makeNRRDParametricMapFP-meta.json TEST_DEPENDS diff --git a/apps/seg/Testing/CMakeLists.txt b/apps/seg/Testing/CMakeLists.txt index 91b5bfa0..c27b48ef 100644 --- a/apps/seg/Testing/CMakeLists.txt +++ b/apps/seg/Testing/CMakeLists.txt @@ -263,7 +263,7 @@ dcmqi_add_test( dcmqi_add_test( NAME seg_meta_roundtrip MODULE_NAME ${MODULE_NAME} - COMMAND python ${CMAKE_SOURCE_DIR}/util/comparejson.py + COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/util/comparejson.py ${CMAKE_SOURCE_DIR}/doc/examples/seg-example.json ${MODULE_TEMP_DIR}/makeNRRD-meta.json TEST_DEPENDS @@ -273,7 +273,7 @@ dcmqi_add_test( dcmqi_add_test( NAME multi_seg_meta_roundtrip MODULE_NAME ${MODULE_NAME} - COMMAND python ${CMAKE_SOURCE_DIR}/util/comparejson.py + COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/util/comparejson.py ${CMAKE_SOURCE_DIR}/doc/examples/seg-example_multiple_segments.json ${MODULE_TEMP_DIR}/makeNRRD_multiple_segments-meta.json "['labelID']" diff --git a/apps/sr/Testing/CMakeLists.txt b/apps/sr/Testing/CMakeLists.txt index 88020ba2..6cd2d5fb 100644 --- a/apps/sr/Testing/CMakeLists.txt +++ b/apps/sr/Testing/CMakeLists.txt @@ -129,7 +129,7 @@ set(MODULE_NAME tid1500) dcmqi_add_test( NAME ${MODULE_NAME}_meta_roundtrip MODULE_NAME ${READER_MODULE_NAME} - COMMAND python ${CMAKE_SOURCE_DIR}/util/comparejson.py + COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/util/comparejson.py ${EXAMPLES}/sr-tid1500-ct-liver-example.json ${MODULE_TEMP_DIR}/sr-tid1500-ct-liver-example.json "['activitySession', 'timePoint', 'imageLibrary', 'compositeContext','procedureReported']" From 027ccb392d96085d6b3a9a09151e6a24f2c1942a Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 10 Dec 2024 14:33:38 -0500 Subject: [PATCH 2/2] CI: Update tested Python version to 3.9 CPython 3.8 is officially end-of-life by upstream. --- .github/workflows/cmake-linux.yml | 2 +- .github/workflows/cmake-win.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake-linux.yml b/.github/workflows/cmake-linux.yml index 896b87b3..cd5eb046 100644 --- a/.github/workflows/cmake-linux.yml +++ b/.github/workflows/cmake-linux.yml @@ -22,7 +22,7 @@ jobs: fetch-tags: true - uses: actions/setup-python@v4 with: - python-version: '3.7.14' + python-version: '3.9' - name: "Install jsondiff" run: pip install jsondiff diff --git a/.github/workflows/cmake-win.yml b/.github/workflows/cmake-win.yml index 65cb85f9..172e584c 100644 --- a/.github/workflows/cmake-win.yml +++ b/.github/workflows/cmake-win.yml @@ -25,7 +25,7 @@ jobs: - uses: actions/setup-python@v4 with: - python-version: '3.8.0' + python-version: '3.9.0' - name: Download prerequisite packages run: |