6
6
# This script can:
7
7
# - extract a tag or a commit from the PHYEX repository
8
8
# - merge code from common and model specific directories
9
- # - apply the pyft tool
9
+ # - apply the pyfortool script
10
10
# - push the result in a new branch of the repository
11
11
12
12
@@ -16,39 +16,39 @@ PHYEXTOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
16
16
# ##### COMMAND LINE ARGUMENTS
17
17
function usage {
18
18
echo " Usage: $0 [-h] [-c CHECKOUT_POINT] [-m MODEL] [-D OPTION [-D OPTION [...]]]] \\ "
19
- echo " [-s SUBDIR [-s SUBDIR [...]]] [--pyft_opts_env VAR] [-v [-v [-v]]] \\ "
20
- echo " DIRECTORY -- PYFT_OPTIONS "
19
+ echo " [-s SUBDIR [-s SUBDIR [...]]] [--pyfortool_opts_env VAR] [-v [-v [-v]]] \\ "
20
+ echo " DIRECTORY -- PYFORTOOL_OPTIONS "
21
21
echo " DIRECTORY directory containing the script result"
22
22
echo " -c CHECKOUT_POINT git object to checkout, can be a specific commit"
23
23
echo " or a tag with the following syntax: tags/TAG where TAG is the tag name"
24
24
echo " -m MODEL merge the code under the common directory with the code specific to MODEL model"
25
- echo " --mnhExpand option passed to the pyft tool "
26
- echo " --removeACC option passed to the pyft tool "
25
+ echo " --mnhExpand option passed to the pyfortool script "
26
+ echo " --removeACC option passed to the pyfortool script "
27
27
echo " -p push the result as a new branch"
28
- echo " -s SUB subdiretory or file (under src) to consider when merging and applying pyft "
28
+ echo " -s SUB subdiretory or file (under src) to consider when merging and applying pyfortool "
29
29
echo " --renameFf rename .F90 into .f90"
30
30
echo " --ilooprm replace indexes in do loop (and mnh_expand) by :"
31
31
echo " --repo use this repository instead of the one derived (if any) from the env variables"
32
32
echo " PHYEXREPOuser (=$PHYEXREPOuser ) and PHYEXREPOprotocol (=$PHYEXREPOprotocol )"
33
33
echo " -v add verbosity (up to 3 -v)"
34
- echo " --pyft_opts_env VAR name of an environment variable containing options to use to call"
35
- echo " the pyft_tool.py script"
36
- echo " --useParallelPyft use the parallel version of the pyft tool (pyft_parallel_tool.py )"
37
- echo " -- PYFT_OPTIONS everything after '--' are used as options for pyft_tool.py "
34
+ echo " --pyfortool_opts_env VAR name of an environment variable containing options to use to call"
35
+ echo " the pyfortool script"
36
+ echo " --useParallelPyForTool use the parallel version of the pyfortool script (pyfortool_parallel )"
37
+ echo " -- PYFORTOOL_OPTIONS everything after '--' are used as options for pyfortool "
38
38
echo " These options are used for all the files."
39
39
echo " "
40
40
echo " * If the -c option is not provided, DIRECTORY must already contain files and directory as if"
41
41
echo " it was the result of a git checkout"
42
42
echo " * If the -m option is used, directory tree is modified, only relevant code is kept"
43
- echo " * If none of --mnhExpand, --removeACC, --pyft_opts_env or PYFT_OPTIONS is not used, pyft is not called at all"
43
+ echo " * If none of --mnhExpand, --removeACC, --pyfortool_opts_env or PYFORTOOL_OPTIONS is not used, pyfortool is not called at all"
44
44
echo " * -s options are mandatory for -m, -D and -p options"
45
45
echo " * -p option is allowed only if -c and -m options are provided"
46
46
echo " "
47
- echo " Everything after the '--' is passed to pyft for source-to-source transformation"
47
+ echo " Everything after the '--' is passed to pyfortool for source-to-source transformation"
48
48
echo " "
49
- echo " To use the pyft tool ... it must be installed"
49
+ echo " To use the pyfortool script ... it must be installed"
50
50
echo " "
51
- echo " The variable name sent with --pyft_opts_env must correspond to an exported environement"
51
+ echo " The variable name sent with --pyfortool_opts_env must correspond to an exported environement"
52
52
echo " variable. The variable can contain a multi-lines string."
53
53
echo " The variable is read line by line and the last applicable line is used."
54
54
echo " A line can take one of these two forms:"
@@ -60,13 +60,13 @@ function usage {
60
60
echo " If the line doesn't contain the FILE_DESCRIPTOR part, it applies to all source code."
61
61
echo " "
62
62
echo " For example, to transform all source code in lower case:"
63
- echo " > export OPTS='--lowerCase'; $0 --pyft\_opts\_env OPTS ..."
63
+ echo " > export OPTS='--lowerCase'; $0 --pyfortool_opts_env OPTS ..."
64
64
echo " "
65
65
echo " To transform all source code in lower case, except routines in turb directory which must be"
66
66
echo " in upper case but keeping the turb.F90 in lower case:"
67
67
echo " > export OPTS='--lowerCase "
68
68
echo " > ^turb/:=:--upperCase "
69
- echo " > ^turb/turb\..90:=:--lowerCase'; $0 --pyft\_opts\_env OPTS ..."
69
+ echo " > ^turb/turb\..90:=:--lowerCase'; $0 --pyfortool_opts_env OPTS ..."
70
70
}
71
71
72
72
full_command=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) /$( basename " ${BASH_SOURCE[0]} " ) $@ "
@@ -75,16 +75,16 @@ separator='_' #- be carrefull, gmkpack (at least on belenos) has multiple allerg
75
75
76
76
directory=" "
77
77
checkout_point=" "
78
- pyft_options =" "
78
+ pyfortool_options =" "
79
79
model=" "
80
80
push=0
81
81
subs=" "
82
82
renameFf=0
83
83
verbose=0
84
84
ilooprm=0
85
- useParallelPyft =0
86
- forpyft =0
87
- pyft_opts_env =" "
85
+ useParallelPyForTool =0
86
+ forpyfortool =0
87
+ pyfortool_opts_env =" "
88
88
89
89
if [ -z " ${PHYEXREPOprotocol-} " ]; then
90
90
repository=" "
@@ -103,21 +103,21 @@ while [ -n "$1" ]; do
103
103
' -h' ) usage; exit ;;
104
104
' -c' ) checkout_point=" $2 " ; shift ;;
105
105
' -m' ) model=" $2 " ; shift ;;
106
- ' --mnhExpand' ) pyft_options =" $pyft_options $1 " ;;
107
- ' --removeACC' ) pyft_options =" $pyft_options $1 " ;;
106
+ ' --mnhExpand' ) pyfortool_options =" $pyfortool_options $1 " ;;
107
+ ' --removeACC' ) pyfortool_options =" $pyfortool_options $1 " ;;
108
108
' -s' ) subs=" $subs $2 " ; shift ;;
109
109
' -p' ) push=1;;
110
110
' --renameFf' ) renameFf=1;;
111
111
' --ilooprm' ) ilooprm=1;;
112
112
' --repo' ) repository=$2 ; shift ;;
113
113
' -v' ) verbose=$(( $verbose + 1 )) ;;
114
- ' --useParallelPyft ' ) useParallelPyft =1;;
115
- ' --pyft_opts_env ' ) pyft_opts_env =$2 ; shift ;;
116
- ' --' ) forpyft =1;;
117
- * ) if [ $forpyft -eq 0 ]; then
114
+ ' --useParallelPyForTool ' ) useParallelPyForTool =1;;
115
+ ' --pyfortool_opts_env ' ) pyfortool_opts_env =$2 ; shift ;;
116
+ ' --' ) forpyfortool =1;;
117
+ * ) if [ $forpyfortool -eq 0 ]; then
118
118
directory=" $1 "
119
119
else
120
- pyft_options =" $pyft_options $1 "
120
+ pyfortool_options =" $pyfortool_options $1 "
121
121
fi ;;
122
122
esac
123
123
shift
174
174
fi
175
175
176
176
# ##### RENAME .F90 into .f90
177
- # This step could also be achieved by pyft_tool.py but it must be done *before* the call to pyft_tool
177
+ # This step could also be achieved by pyfortool but it must be done *before* the call to pyfortool
178
178
if [ $renameFf -eq 1 ]; then
179
179
# we use find/while/read in case the number of files is too big to be hold on a single shell line
180
180
find . -type f -name \* .F90 -print0 | \
@@ -290,15 +290,15 @@ if [ $ilooprm -eq 1 ]; then
290
290
done
291
291
fi
292
292
293
- # ##### PYFT
294
- if [ " $pyft_opts_env " != " " -o -n " ${pyft_options -} " ]; then
295
- [ $verbose -gt 0 ] && echo " Applying pyft_tool "
293
+ # ##### PyForTool
294
+ if [ " $pyfortool_opts_env " != " " -o -n " ${pyfortool_options -} " ]; then
295
+ [ $verbose -gt 0 ] && echo " Applying pyfortool "
296
296
297
297
# Update PATH and PYTHONPATH if needed
298
- if [ $useParallelPyft -eq 1 ]; then
299
- which pyft_parallel_tool.py > /dev/null || . $PHYEXTOOLSDIR /site/pyft /bin/env.sh
298
+ if [ $useParallelPyForTool -eq 1 ]; then
299
+ which pyfortool_parallel > /dev/null || . $PHYEXTOOLSDIR /site/pyfortool /bin/env.sh
300
300
else
301
- which pyft_tool.py > /dev/null || . $PHYEXTOOLSDIR /site/pyft /bin/env.sh
301
+ which pyfortool > /dev/null || . $PHYEXTOOLSDIR /site/pyfortool /bin/env.sh
302
302
fi
303
303
304
304
if [ -n " ${model-} " ]; then
@@ -311,13 +311,13 @@ if [ "$pyft_opts_env" != "" -o -n "${pyft_options-}" ]; then
311
311
fi
312
312
313
313
extra_opts=" "
314
- if [ " $pyft_opts_env " != " " ]; then
315
- extra_opts=" --optsByEnv $pyft_opts_env "
314
+ if [ " $pyfortool_opts_env " != " " ]; then
315
+ extra_opts=" --optsByEnv $pyfortool_opts_env "
316
316
fi
317
317
318
- if [ " $extra_opts " != " " -o -n " ${pyft_options -} " ]; then
319
- if [ $useParallelPyft -eq 1 ]; then
320
- cmd=" pyft_parallel_tool.py --wrapH $pyft_options $extra_opts --nbPar 8" # --wrapH allows to deal with h files
318
+ if [ " $extra_opts " != " " -o -n " ${pyfortool_options -} " ]; then
319
+ if [ $useParallelPyForTool -eq 1 ]; then
320
+ cmd=" pyfortool_parallel --wrapH $pyfortool_options $extra_opts --nbPar 8" # --wrapH allows to deal with h files
321
321
[ $verbose -gt 1 ] && echo $cmd
322
322
$cmd
323
323
else
@@ -326,8 +326,8 @@ if [ "$pyft_opts_env" != "" -o -n "${pyft_options-}" ]; then
326
326
find $rep -type f -not -name ' .*.swp' -not -name ' .*.swo' | while read file; do
327
327
if [ " $( echo $file | grep ' \.' ) " != ' ' -a $( echo $file | rev | cut -d. -f1 | rev) != ' fypp' ]; then
328
328
# Files without extension are certainly not source code files
329
- # .fypp files cannot be read by pyft_tool.py
330
- cmd=" pyft_tool.py --wrapH $pyft_options $extra_opts " # --wrapH allows to deal with h files
329
+ # .fypp files cannot be read by pyfortool
330
+ cmd=" pyfortool --wrapH $pyfortool_options $extra_opts " # --wrapH allows to deal with h files
331
331
[ $verbose -gt 1 ] && echo $cmd " $file "
332
332
$cmd " $file "
333
333
fi
0 commit comments