Commit 06b25e6
committed
COMP: Initiate updating to find_package(Python3)
Now that cmake FindPython3 can be universally
used, prefer to only use that set of variable
names for identifying the python executables.
Intial procesing with manual cleanup by a mofified version
of the script used for ITK:
ITK/Utilities/Maintenance/FindPython3_ModernizeCMake.sh
This maintenance script can be used to assist with moving from
the deprecated find_package(PythonInterp) and find_package(PythonLib)
to the preferred find_package(Python3) variable names.
------------------------------
NOTE: This script is intended to make it easier
to identify old find_package(PythonInterp
uses, but it can not be blindly used.
each change must be carefully reviewed.
```bash
\#!/bin/bash
COMMIT_INFO="COMP: Script to initiate updating to find_package(Python3)
Now that cmake FindPython3 can be universally
used, prefer to only use that set of variable
names for identifying the python executables.
Intial procesing with manual cleanup by:
ITK/Utilities/Maintenance/FindPython3_ModernizeCMake.sh
This maintenance script can be used to assist with moving from
the deprecated find_package(PythonInterp) and find_package(PythonLib)
to the preferred find_package(Python3) variable names.
------------------------------
NOTE: This script is intended to make it easier
to identify old find_package(PythonInterp
uses, but it can not be blindly used.
each change must be carefully reviewed.
"
\# Utility functions
usage() {
cat << EOF
Usage: $0
$COMMIT_INFO
EOF
}
die() {
echo "$@" 1>&2; exit 1
}
while test $# -gt 0;
do
opt="$1";
case "$opt" in
"-h"|"--help")
shift;
help=true
break;;
*)
break;;
esac
done
if test $help; then
usage
exit 1
fi
\# Deprecated (since cmake 3.12) variables from the FindPythonInterp
\# PYTHONINTERP_FOUND
\# PYTHON_EXECUTABLE
\# PYTHON_VERSION_STRING
\# PYTHON_VERSION_MAJOR
\# PYTHON_VERSION_MINOR
\# PYTHON_VERSION_PATCH
\# Additional deprecated (since cmake 3.12) variables from the FindPythonLibs
\# PYTHONLIBS_FOUND
\# PYTHON_LIBRARIES
\# PYTHON_INCLUDE_PATH
\# PYTHON_INCLUDE_DIRS
\# PYTHON_DEBUG_LIBRARIES
\# PYTHONLIBS_VERSION_STRING
\# PYTHON_LIBRARY
\# PYTHON_INCLUDE_DIR
cat > /tmp/temp.sed << EOF
s/PYTHON_LIBRARY_PATH/CTK_PYTHON3_LIBRARY_PATH/g
s/PYTHON_LIBRARY/CTK_PYTHON3_LIBRARY/g
s/PYTHON_INCLUDE_DIR/CTK_PYTHON3_INCLUDE_DIR/g
s/PYTHON_DEBUG_LIBRARIES/CTK_PYTHON3_DEBUG_LIBRARIES/g
s/PYTHONINTERP_FOUND/Python3_Interpreter_FOUND/g
s/PYTHON_EXECUTABLE/Python3_EXECUTABLE/g
s/PYTHON_VERSION_STRING/Python3_VERSION/g
s/PYTHON_VERSION_MAJOR/Python3_VERSION_MAJOR/g
s/PYTHON_VERSION_MINOR/Python3_VERSION_MINOR/g
s/PYTHON_VERSION_PATCH/Python3_VERSION_PATCH/g
s/PYTHONLIBS_FOUND/Python3_Development_FOUND/g
s/PYTHON_LIBRARIES/Python3_LIBRARIES/g
s/PYTHON_INCLUDE_PATH/Python3_XXXXXXX_INCLUDE_PATH_NO_MAPPING_FOR_THIS_PYTHON.h_PATH_FINDER/g
s/PYTHON_INCLUDE_DIRS/Python3_INCLUDE_DIRS/g
s/PYTHON_DEBUG_LIBRARIES/Python3_XXXXX_NO_MAPPING_FOR_THIS_DEBUG_LIBRARIES_FLAG/g
s/PYTHONLIBS_VERSION_STRING/Python3_VERSION/g
s/PYTHON_LIBRARY/Python3_XXXXXX_LIBARY__NO_MAPPING_FOR_THIS_/g
s/PYTHON_INCLUDE_DIR/Python3_XXXXXXX_INCLUDE_DIR_NO_MAPPING_FOR_THIS_PYTHON.h_PATH_FINDER/g
s/find_package *( *PythonInterp *REQUIRED *)/find_package(Python3 COMPONENTS Interpreter REQUIRED)/g
s/find_package *( *PythonInterp *)/find_package(Python3 COMPONENTS Interpreter)/g
s/find_package *( *PythonLibs *)/find_package(Python3 COMPONENTS Development)/g
s/find_package *( *PythonInterp/find_package(Python3 COMPONENTS Interpreter/g
s/find_package *( *PythonLibs/find_package(Python3 COMPONENTS Development/g
s/below_restore_pattern_match_changes_to_original/values/g
s/____IGNORE_REVERSION_TO_ORIGINAL_VARIABLE_NAME_____CTK_PYTHON3_LIBRARY_PATH/PYTHON_LIBRARY_PATH/g
s/____IGNORE_REVERSION_TO_ORIGINAL_VARIABLE_NAME_____CTK_PYTHON3_LIBRARY/PYTHON_LIBRARY/g
s/____IGNORE_REVERSION_TO_ORIGINAL_VARIABLE_NAME_____CTK_PYTHON3_INCLUDE_DIR/PYTHON_INCLUDE_DIR/g
s/____IGNORE_REVERSION_TO_ORIGINAL_VARIABLE_NAME_____CTK_PYTHON3_DEBUG_LIBRARIES/PYTHON_DEBUG_LIBRARIES/g
EOF
if [ $(uname) == "Darwin" ] ; then
SEDBIN=gsed
else
SEDBIN=sed
fi
\# Do the replacement
find . -type f \( -name 'CMakeLists.txt' -o -name '*\.cmake*' \) -exec ${SEDBIN} -i'' -f /tmp/temp.sed {} \;
cat > /tmp/git_message.txt << EOF
${COMMIT_INFO}
EOF1 parent ba61ba5 commit 06b25e6
File tree
12 files changed
+59
-59
lines changed- CMakeExternals
- CMake
- Libs
- Scripting/Python/Core
- Visualization/VTK/Core
- Utilities/CMake
12 files changed
+59
-59
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
| 98 | + | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
| 130 | + | |
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
152 | | - | |
| 151 | + | |
| 152 | + | |
153 | 153 | | |
154 | | - | |
155 | | - | |
| 154 | + | |
| 155 | + | |
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
160 | | - | |
| 159 | + | |
| 160 | + | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
| 163 | + | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
| 196 | + | |
197 | 197 | | |
198 | 198 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
77 | | - | |
78 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
116 | | - | |
117 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | | - | |
74 | | - | |
| 73 | + | |
| 74 | + | |
75 | 75 | | |
76 | | - | |
77 | | - | |
78 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
880 | 880 | | |
881 | 881 | | |
882 | 882 | | |
883 | | - | |
884 | | - | |
885 | | - | |
886 | | - | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
887 | 887 | | |
888 | 888 | | |
889 | | - | |
890 | | - | |
891 | | - | |
892 | | - | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
893 | 893 | | |
894 | 894 | | |
895 | 895 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
0 commit comments