| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# Refactor a TriBITS project's CMake files for the change from |
| 4 |
# find_package(PythonInterp) to find_package(Python3) (see CHANGELOG.md entry |
| 5 |
# for 2024-10-08). |
| 6 |
# |
| 7 |
# Usage: |
| 8 |
# |
| 9 |
# to-python3.sh <base-dir> |
| 10 |
# |
| 11 |
# NOTES: |
| 12 |
# * This is safe to run multiple times on the same set of files. |
| 13 |
# * This is safe to run from the base project source tree. |
| 14 |
# * This will exclude any files under '.git/' |
| 15 |
# * This will exclude any files under 'tribits/' directories (so it will not mess up TriBITS) |
| 16 |
# |
| 17 |
|
| 18 |
_SCRIPT_DIR=`echo $0 | sed "s/\(.*\)\/to-python3[.]sh/\1/g"` |
| 19 |
baseDir=$1 |
| 20 |
find ${baseDir} -type f \ |
| 21 |
\( -name CMakeLists.txt -or -name "*.cmake" -or -name "*.cmake.in" -or -name "*.rst" \) \ |
| 22 |
! -wholename "*/.git/*" ! -wholename "*/tribits/*" \ |
| 23 |
-exec $_SCRIPT_DIR/token-replace.py -t PYTHON_EXECUTABLE -r Python3_EXECUTABLE -f {} ';' |