Skip to content

Commit

Permalink
Run to-python3.sh on Trilinos CMake files (TriBITSPub/TriBITS#610)
Browse files Browse the repository at this point in the history
This is the result of running the script:

   cmake/tribits/refactoring/to-python3.sh

on the entire Trilinos source tree.

This just changes from "PYTHON_EXECUTABLE" to "Python3_EXECUTABLE".

NOTE: The script also fixes up then carriage-return/line-feed chars (which is
why all of the lines of the file packages/compadre/CMakeLists.txt was
changed).

Signed-off-by: Roscoe A. Bartlett <[email protected]>
  • Loading branch information
bartlettroscoe committed Oct 11, 2024
1 parent 434aecc commit 8cc5ddd
Show file tree
Hide file tree
Showing 39 changed files with 692 additions and 692 deletions.
2 changes: 1 addition & 1 deletion commonTools/build_stats/BuildStatsWrappers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ endfunction()
macro(get_base_build_dir_for_python)
set(get_cwd_for_python ${BUILD_STATS_SRC_DIR}/get_cwd_for_python.py)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${get_cwd_for_python}
COMMAND ${Python3_EXECUTABLE} ${get_cwd_for_python}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
OUTPUT_VARIABLE BASE_BUILD_DIR_FOR_PYTHON
OUTPUT_STRIP_TRAILING_WHITESPACE)
Expand Down
4 changes: 2 additions & 2 deletions commonTools/build_stats/unit_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
TRIBITS_ADD_ADVANCED_TEST( summarize_build_stats_UnitTests
OVERALL_WORKING_DIRECTORY TEST_NAME
OVERALL_NUM_MPI_PROCS 1
TEST_0 CMND ${PYTHON_EXECUTABLE}
TEST_0 CMND ${Python3_EXECUTABLE}
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/summarize_build_stats_UnitTests.py -v
PASS_REGULAR_EXPRESSION "OK"
ALWAYS_FAIL_ON_NONZERO_RETURN
Expand All @@ -10,7 +10,7 @@ TRIBITS_ADD_ADVANCED_TEST( summarize_build_stats_UnitTests
TRIBITS_ADD_ADVANCED_TEST( gather_build_stats_UnitTests
OVERALL_WORKING_DIRECTORY TEST_NAME
OVERALL_NUM_MPI_PROCS 1
TEST_0 CMND ${PYTHON_EXECUTABLE}
TEST_0 CMND ${Python3_EXECUTABLE}
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/gather_build_stats_UnitTests.py -v
PASS_REGULAR_EXPRESSION "OK"
ALWAYS_FAIL_ON_NONZERO_RETURN
Expand Down
10 changes: 5 additions & 5 deletions commonTools/framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ add_subdirectory(github_issue_creator)
TRIBITS_ADD_ADVANCED_TEST( ProjectCiFileChangeLogic_UnitTests
OVERALL_WORKING_DIRECTORY TEST_NAME
OVERALL_NUM_MPI_PROCS 1
TEST_0 CMND ${PYTHON_EXECUTABLE}
TEST_0 CMND ${Python3_EXECUTABLE}
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/ProjectCiFileChangeLogic_UnitTests.py -v
PASS_REGULAR_EXPRESSION "OK"
ALWAYS_FAIL_ON_NONZERO_RETURN
Expand All @@ -28,7 +28,7 @@ TRIBITS_ADD_ADVANCED_TEST( clean_all_jobs_UnitTests
OVERALL_WORKING_DIRECTORY TEST_NAME
OVERALL_NUM_MPI_PROCS 1
EXCLUDE_IF_NOT_TRUE TFW_Python_Testing
TEST_0 CMND ${PYTHON_EXECUTABLE}
TEST_0 CMND ${Python3_EXECUTABLE}
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/clean_workspace/unittests/test_clean_all_jobs.py -v
PASS_REGULAR_EXPRESSION "OK"
)
Expand All @@ -38,7 +38,7 @@ TRIBITS_ADD_ADVANCED_TEST( clean_sentinel_UnitTests
OVERALL_WORKING_DIRECTORY TEST_NAME
OVERALL_NUM_MPI_PROCS 1
EXCLUDE_IF_NOT_TRUE TFW_Python_Testing
TEST_0 CMND ${PYTHON_EXECUTABLE}
TEST_0 CMND ${Python3_EXECUTABLE}
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/clean_workspace/unittests/test_clean_sentinel.py -v
PASS_REGULAR_EXPRESSION "OK"
)
Expand All @@ -48,7 +48,7 @@ TRIBITS_ADD_ADVANCED_TEST( clean_workspace_UnitTests
OVERALL_WORKING_DIRECTORY TEST_NAME
OVERALL_NUM_MPI_PROCS 1
EXCLUDE_IF_NOT_TRUE TFW_Python_Testing
TEST_0 CMND ${PYTHON_EXECUTABLE}
TEST_0 CMND ${Python3_EXECUTABLE}
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/clean_workspace/unittests/test_clean_workspace.py -v
PASS_REGULAR_EXPRESSION "OK"
)
Expand All @@ -59,7 +59,7 @@ TRIBITS_ADD_ADVANCED_TEST( PullRequestLinuxDriver_UnitTests
OVERALL_NUM_MPI_PROCS 1
EXCLUDE_IF_NOT_TRUE TFW_Python_Testing
TEST_0 CMND bash
ARGS pr_python_test_driver.sh ${PYTHON_EXECUTABLE} ${PYTHON_PIP_EXECUTABLE}
ARGS pr_python_test_driver.sh ${Python3_EXECUTABLE} ${PYTHON_PIP_EXECUTABLE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../packages/framework/pr_tools
SKIP_CLEAN_WORKING_DIRECTORY
PASS_REGULAR_EXPRESSION "=+ [0-9]+ passed"
Expand Down
2 changes: 1 addition & 1 deletion commonTools/framework/github_issue_creator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tribits_add_advanced_test( create_trilinos_github_test_failure_issue_unit_tests
OVERALL_WORKING_DIRECTORY TEST_NAME
OVERALL_NUM_MPI_PROCS 1
TEST_0 CMND ${PYTHON_EXECUTABLE}
TEST_0 CMND ${Python3_EXECUTABLE}
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/create_trilinos_github_test_failure_issue_unit_tests.py -v
PASS_REGULAR_EXPRESSION "OK"
ALWAYS_FAIL_ON_NONZERO_RETURN
Expand Down
2 changes: 1 addition & 1 deletion packages/PyTrilinos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ MESSAGE(STATUS " ${PyTrilinos_PACKAGES}")
# Determine the PyTrilinos default installation directory prefix. If
# CMAKE_INSTALL_PREFIX is set by the user, then use it. Else the
# prefix is set to the value of python's sys.prefix.
EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import sys; print(sys.prefix)"
EXECUTE_PROCESS(COMMAND ${Python3_EXECUTABLE} -c "import sys; print(sys.prefix)"
OUTPUT_VARIABLE PYTHON_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE
)
Expand Down
12 changes: 6 additions & 6 deletions packages/PyTrilinos/cmake/FindMpi4Py.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# - Find the python mpi4py module

# This cmake module determines whether the python module mpi4py exists
# for the current PYTHON_EXECUTABLE. This code sets the following
# for the current Python3_EXECUTABLE. This code sets the following
# variables:
#
# Mpi4Py_FOUND = Set to TRUE if mpi4py is found
Expand All @@ -54,19 +54,19 @@
#
# If Mpi4Py is required and python executable does not exist, then send
# an error
IF(NOT PYTHON_EXECUTABLE)
IF(NOT Python3_EXECUTABLE)
IF(Mpi4Py_FIND_REQUIRED)
MESSAGE(SEND_ERROR
"Python executable not found, so required Mpi4Py module not found"
)
ENDIF(Mpi4Py_FIND_REQUIRED)
#
# Continue processing if python executable is known
ELSE(NOT PYTHON_EXECUTABLE)
ELSE(NOT Python3_EXECUTABLE)

# Retrieve the Mpi4Py version
EXECUTE_PROCESS(COMMAND
${PYTHON_EXECUTABLE} -c "import mpi4py; print(mpi4py.__version__)"
${Python3_EXECUTABLE} -c "import mpi4py; print(mpi4py.__version__)"
OUTPUT_VARIABLE Mpi4Py_VERSION
ERROR_VARIABLE Mpi4Py_VERSION_ERROR
OUTPUT_STRIP_TRAILING_WHITESPACE
Expand All @@ -76,7 +76,7 @@ ELSE(NOT PYTHON_EXECUTABLE)
# now look for the Mpi4Py include directory
IF(NOT Mpi4Py_VERSION_ERROR)
EXECUTE_PROCESS(COMMAND
${PYTHON_EXECUTABLE} -c "import mpi4py; print(mpi4py.get_include())"
${Python3_EXECUTABLE} -c "import mpi4py; print(mpi4py.get_include())"
OUTPUT_VARIABLE Mpi4Py_INCLUDE_DIR
ERROR_VARIABLE Mpi4Py_INCLUDE_ERROR
OUTPUT_STRIP_TRAILING_WHITESPACE
Expand Down Expand Up @@ -112,4 +112,4 @@ ELSE(NOT PYTHON_EXECUTABLE)

ENDIF(NOT Mpi4Py_VERSION_ERROR)

ENDIF(NOT PYTHON_EXECUTABLE)
ENDIF(NOT Python3_EXECUTABLE)
14 changes: 7 additions & 7 deletions packages/PyTrilinos/cmake/FindNumPy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# - Find the python numpy module

# This cmake module determines whether the python module numpy exists
# for the current PYTHON_EXECUTABLE. This code sets the following
# for the current Python3_EXECUTABLE. This code sets the following
# variable:
#
# NumPy_FOUND = Set to TRUE if numpy is found
Expand All @@ -54,19 +54,19 @@
#
# If NumPy is required and python executable does not exist, then send
# an error
IF(NOT PYTHON_EXECUTABLE)
IF(NOT Python3_EXECUTABLE)
IF(NumPy_FIND_REQUIRED)
MESSAGE(SEND_ERROR
"Python executable not found, so required NumPy module not found"
)
ENDIF(NumPy_FIND_REQUIRED)
#
# Continue processing if python executable is known
ELSE(NOT PYTHON_EXECUTABLE)
ELSE(NOT Python3_EXECUTABLE)

# Retrieve the NumPy version
EXECUTE_PROCESS(COMMAND
${PYTHON_EXECUTABLE} -c "import numpy; print(numpy.__version__)"
${Python3_EXECUTABLE} -c "import numpy; print(numpy.__version__)"
OUTPUT_VARIABLE NumPy_VERSION
ERROR_VARIABLE NumPy_VERSION_ERROR
OUTPUT_STRIP_TRAILING_WHITESPACE
Expand All @@ -84,7 +84,7 @@ ELSE(NOT PYTHON_EXECUTABLE)
# now look for the NumPy include directory
IF(NOT NumPy_VERSION_ERROR)
EXECUTE_PROCESS(COMMAND
${PYTHON_EXECUTABLE} -c "import numpy; print(numpy.get_include())"
${Python3_EXECUTABLE} -c "import numpy; print(numpy.get_include())"
OUTPUT_VARIABLE NumPy_INCLUDE_DIR
ERROR_VARIABLE NumPy_INCLUDE_ERROR
OUTPUT_STRIP_TRAILING_WHITESPACE
Expand All @@ -102,7 +102,7 @@ ELSE(NOT PYTHON_EXECUTABLE)
# and the wrong function name was called
IF(NumPy_INCLUDE_ERROR)
EXECUTE_PROCESS(COMMAND
${PYTHON_EXECUTABLE} -c "import numpy; print(numpy.get_numpy_include())"
${Python3_EXECUTABLE} -c "import numpy; print(numpy.get_numpy_include())"
OUTPUT_VARIABLE NumPy_INCLUDE_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
Expand Down Expand Up @@ -139,4 +139,4 @@ ELSE(NOT PYTHON_EXECUTABLE)

ENDIF(NOT NumPy_VERSION_ERROR)

ENDIF(NOT PYTHON_EXECUTABLE)
ENDIF(NOT Python3_EXECUTABLE)
2 changes: 1 addition & 1 deletion packages/PyTrilinos/cmake/FindPETSc4Py.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ IF(PETSC4PY_INCLUDES)
ENDIF(PETSC4PY_INCLUDES)

EXECUTE_PROCESS(
COMMAND ${PYTHON_EXECUTABLE} -c "import petsc4py; from sys import stdout; stdout.write(petsc4py.get_include())"
COMMAND ${Python3_EXECUTABLE} -c "import petsc4py; from sys import stdout; stdout.write(petsc4py.get_include())"
OUTPUT_VARIABLE PETSC4PY_INCLUDES
RESULT_VARIABLE PETSC4PY_NOT_FOUND)

Expand Down
12 changes: 6 additions & 6 deletions packages/PyTrilinos/cmake/FindPythonInclude.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,33 +43,33 @@
# - Find the python include path

# This module determines where the python include file Python.h is,
# based on the current value of PYTHON_EXECUTABLE. This code sets the
# based on the current value of Python3_EXECUTABLE. This code sets the
# following variable:
#
# PYTHON_INCLUDE_PATH = path to where Python.h is found
#

IF(PYTHON_EXECUTABLE)
IF(Python3_EXECUTABLE)

# Obtain the Python version string
EXECUTE_PROCESS(COMMAND
${PYTHON_EXECUTABLE} -c
${Python3_EXECUTABLE} -c
"import sys; print('python' + sys.version[:3])"
OUTPUT_VARIABLE PYVERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)

# Obtain the Python prefix path
EXECUTE_PROCESS(COMMAND
${PYTHON_EXECUTABLE} -c
${Python3_EXECUTABLE} -c
"import sys; print(sys.prefix)"
OUTPUT_VARIABLE PYPREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE
)

# Obtain the Python include path
EXECUTE_PROCESS(COMMAND
${PYTHON_EXECUTABLE} -c
${Python3_EXECUTABLE} -c
"import sysconfig; print(sysconfig.get_paths()['include'])"
OUTPUT_VARIABLE PYTHON_INCLUDE_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
Expand Down Expand Up @@ -100,4 +100,4 @@ IF(PYTHON_EXECUTABLE)

MESSAGE(STATUS "PYTHON_INCLUDE_PATH is ${PYTHON_INCLUDE_PATH}")

ENDIF(PYTHON_EXECUTABLE)
ENDIF(Python3_EXECUTABLE)
4 changes: 2 additions & 2 deletions packages/PyTrilinos/cmake/PyTrilinosMakeTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
MACRO(PyTrilinos_MAKE_TEST TEST_NAME)

ADD_CUSTOM_COMMAND(OUTPUT ${TEST_NAME}.py
COMMAND ${PYTHON_EXECUTABLE}
COMMAND ${Python3_EXECUTABLE}
${CMAKE_BINARY_DIR}/packages/PyTrilinos/util/copyWithCMakeSubstitutions.py
${CMAKE_CURRENT_SOURCE_DIR}/${TEST_NAME}.py.in
${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}.py
Expand All @@ -54,7 +54,7 @@ MACRO(PyTrilinos_MAKE_TEST TEST_NAME)
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}.py)

TRIBITS_ADD_TEST(
${PYTHON_EXECUTABLE}
${Python3_EXECUTABLE}
NOEXEPREFIX
NOEXESUFFIX
NAME ${TEST_NAME}
Expand Down
2 changes: 1 addition & 1 deletion packages/PyTrilinos/doc/Doxygen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ FOREACH(Package ${PyTrilinos_PACKAGES})
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_${Package}
@ONLY
)
EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/docstrings.py
EXECUTE_PROCESS(COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/docstrings.py
--doxygen=${DOXYGEN_EXECUTABLE} ${Package}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
ERROR_VARIABLE Doxy_CONVERT_ERROR)
Expand Down
4 changes: 2 additions & 2 deletions packages/PyTrilinos/example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ENABLE_TESTING()
INCLUDE(PyTrilinosMakeTest)

ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/testutil.py
COMMAND ${PYTHON_EXECUTABLE}
COMMAND ${Python3_EXECUTABLE}
${PyTrilinos_BINARY_DIR}/util/copyWithCMakeSubstitutions.py
${CMAKE_CURRENT_SOURCE_DIR}/testutil.py.in
${CMAKE_CURRENT_BINARY_DIR}/testutil.py
Expand All @@ -57,7 +57,7 @@ ADD_CUSTOM_TARGET(PyTrilinos_Example_testutil ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/testutil.py)

ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gre__115.rua
COMMAND ${PYTHON_EXECUTABLE}
COMMAND ${Python3_EXECUTABLE}
${PyTrilinos_BINARY_DIR}/util/copyWithCMakeSubstitutions.py
${CMAKE_CURRENT_SOURCE_DIR}/gre__115.mx
${CMAKE_CURRENT_BINARY_DIR}/gre__115.rua
Expand Down
Loading

0 comments on commit 8cc5ddd

Please sign in to comment.