Skip to content

Commit

Permalink
Fix up and better document to-python3.sh (#610)
Browse files Browse the repository at this point in the history
Now this is safer to run on a project's entire source tree and it is
documented to explain what this is for.
  • Loading branch information
bartlettroscoe committed Oct 10, 2024
1 parent 23135a9 commit 22c6ffe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tribits/refactoring/to-python3.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
#!/bin/sh
#
# Refactor a TriBITS project's CMake files for the change from
# find_package(PythonInterp) to find_package(Python3) (see CHANGELOG.md entry
# for 2024-10-08).
#
# Usage:
#
# to-python3.sh <base-dir>
#
# NOTES:
# * This is safe to run multiple times on the same set of files.
# * This is safe to run from the base project source tree.
# * This will exclude any files under '.git/'
# * This will exclude any files under 'tribits/' directories (so it will not mess up TriBITS)
#

_SCRIPT_DIR=`echo $0 | sed "s/\(.*\)\/to-python3[.]sh/\1/g"`
baseDir=$1
find ${baseDir} -type f \
\( -name CMakeLists.txt -or -name "*.cmake" -or -name "*.cmake.in" -or -name "*.rst" \) \
! -wholename "*/.git/*" ! -wholename "*/tribits/*" \
-exec $_SCRIPT_DIR/token-replace.py -t PYTHON_EXECUTABLE -r Python3_EXECUTABLE -f {} ';'

0 comments on commit 22c6ffe

Please sign in to comment.