BUG: foamCreateModuleInclude ignores -output option (fixes #1190)

ENH: add -prefs option to pass in a preferences configuration file
This commit is contained in:
Mark Olesen
2019-02-04 14:48:03 +01:00
parent 9b8ac57e98
commit ba26175198

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2016-2017 CINECA # \\/ M anipulation | Copyright (C) 2016-2017 CINECA
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -27,8 +27,10 @@
# #
# Description # Description
# Script to create module settings. # Script to create module settings.
#
# This is still incomplete, but can be a useful basis when using a module # This is still incomplete, but can be a useful basis when using a module
# system. # system.
#
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { usage() {
exec 1>&2 exec 1>&2
@ -38,7 +40,8 @@ usage() {
usage: ${0##*/} [OPTION] projectDir usage: ${0##*/} [OPTION] projectDir
options: options:
-output=file The output name (default: ModuleInclude.tcl) -output=file The output name (default: ModuleInclude.tcl)
-preload=file Specify (module) file to preload. Can use multiple times -prefs=file A preferences file (OpenFOAM) to load.
-preload=file Specify a shell file to preload. Can use multiple times
-tmpdir=file The tmp directory to use. -tmpdir=file The tmp directory to use.
-help Print the usage -help Print the usage
@ -63,7 +66,7 @@ die()
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
unset optBackend optDebug preload projectDir unset optBackend optDebug optPrefs preloads projectDir
unset moduleOutput moduleTmpDir unset moduleOutput moduleTmpDir
# Parse some options # Parse some options
@ -79,8 +82,11 @@ do
-debug) -debug)
optDebug=true optDebug=true
;; ;;
-prefs=*)
optPrefs="${1#*=}"
;;
-preload=*) -preload=*)
preload="$preload${preload:+ }${1#*=}" preloads="$preloads${preloads:+ }${1#*=}"
;; ;;
--recursive-backend--) --recursive-backend--)
optBackend=true optBackend=true
@ -130,7 +136,7 @@ then
die "Incorrect projectDir? $projectDir" die "Incorrect projectDir? $projectDir"
# Check preloads # Check preloads
for file in $preloads for file in "$preloads"
do do
[ -f "$file" ] || echo "No such file to preload: $file" 1>&2 [ -f "$file" ] || echo "No such file to preload: $file" 1>&2
done done
@ -146,7 +152,8 @@ then
$0 \ $0 \
--recursive-backend-- \ --recursive-backend-- \
"${optDebug:+-debug}" \ "${optDebug:+-debug}" \
"${output:+-output=$moduleOutput}" \ "${optPrefs:+-prefs=$optPrefs}" \
"${moduleOutput:+-output=$moduleOutput}" \
"${preloads:+-preload=$preloads}" \ "${preloads:+-preload=$preloads}" \
"${moduleTmpDir:+-tmpdir=$moduleTmpDir}" \ "${moduleTmpDir:+-tmpdir=$moduleTmpDir}" \
$projectDir $projectDir
@ -164,7 +171,7 @@ fi
: ${moduleTmpDir:=${TMPDIR:-/tmp}} : ${moduleTmpDir:=${TMPDIR:-/tmp}}
# Preload any/all modules # Preload any/all modules
for file in $preloads for file in "$preloads"
do do
[ -f "$file" ] && . "$file" '' [ -f "$file" ] && . "$file" ''
done done
@ -213,7 +220,7 @@ printEnv > $tmpFiles.env.pre.log
printAlias > $tmpFiles.alias.pre.log printAlias > $tmpFiles.alias.pre.log
# OpenFOAM settings # OpenFOAM settings
. $projectDir/etc/bashrc '' . $projectDir/etc/bashrc "$optPrefs"
echo "Using openfoam: $WM_PROJECT_DIR" 1>&2 echo "Using openfoam: $WM_PROJECT_DIR" 1>&2
echo "==> $moduleOutput" 1>&2 echo "==> $moduleOutput" 1>&2
@ -227,7 +234,9 @@ unset SCOTCH_VERSION
# Also remove user directories as being unreliable # Also remove user directories as being unreliable
foamOldDirs="$CEI_HOME $BOOST_ARCH_PATH $CGAL_ARCH_PATH $FFTW_ARCH_PATH $MPI_ARCH_PATH $SCOTCH_ARCH_PATH \ foamOldDirs="$BOOST_ARCH_PATH $CGAL_ARCH_PATH $FFTW_ARCH_PATH \
$MESA_ARCH_PATH $LLVM_ARCH_PATH \
$MPI_ARCH_PATH $SCOTCH_ARCH_PATH \
$FOAM_SITE_APPBIN $FOAM_SITE_LIBBIN $WM_PROJECT_SITE \ $FOAM_SITE_APPBIN $FOAM_SITE_LIBBIN $WM_PROJECT_SITE \
$FOAM_USER_APPBIN $FOAM_USER_LIBBIN" $FOAM_USER_APPBIN $FOAM_USER_LIBBIN"
foamClean=$WM_PROJECT_DIR/bin/foamCleanPath foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
@ -245,9 +254,6 @@ then
unset FOAM_EXT_LIBBIN unset FOAM_EXT_LIBBIN
fi fi
fi fi
unset CEI_HOME
unset ENSIGHT9_INPUT ENSIGHT9_READER
unset ENSIGHT10_INPUT ENSIGHT10_READER
# Always consider site to be bogus. If needed, should be done elsewhere. # Always consider site to be bogus. If needed, should be done elsewhere.
unset FOAM_SITE_APPBIN FOAM_SITE_LIBBIN WM_PROJECT_SITE unset FOAM_SITE_APPBIN FOAM_SITE_LIBBIN WM_PROJECT_SITE