Skip to content

Commit

Permalink
COMP: Update python executable location and usage
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thewtex committed Dec 10, 2024
1 parent 1f82832 commit 1dd11d6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

#-----------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions apps/paramaps/Testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions apps/seg/Testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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']"
Expand Down
2 changes: 1 addition & 1 deletion apps/sr/Testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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']"
Expand Down

0 comments on commit 1dd11d6

Please sign in to comment.