mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
- foamCleanPath now only splits the environment variable on ':', which allows other directories with spaces or '(..)' etc to pass through without major issue. - The filter arguments are split on whitespace, colons or semi-colons.
This commit is contained in:
@ -14,20 +14,19 @@
|
||||
# foamCleanPath
|
||||
#
|
||||
# Description
|
||||
# Usage: foamCleanPath [OPTION] path [wildcard] .. [wildcard]
|
||||
# foamCleanPath [OPTION] -env=name [wildcard1] .. [wildcardN]
|
||||
# Usage: foamCleanPath [OPTION] path [filter] .. [filter]
|
||||
# foamCleanPath [OPTION] -env=name [filter] .. [filter]
|
||||
#
|
||||
# Prints its argument (which should be a ':' separated path)
|
||||
# without the following:
|
||||
# - duplicate elements
|
||||
# - elements whose start matches a wildcard
|
||||
# - elements matching the specified filter(s)
|
||||
# - inaccessible directories (with the -strip option)
|
||||
#
|
||||
# Note
|
||||
# - this routine fails when directories have embedded spaces
|
||||
# - false matches possible if a wildcard contains '.' (sed regex)
|
||||
# - the wildcards themselves can be written together and separated
|
||||
# by colons or whitespace
|
||||
# - false matches possible when the filter contains '.' (sed regex) etc.
|
||||
# - a single composite filter can be passed in. This composite filter
|
||||
# is assumed to be delimited by whitespace, colons or semi-colons.
|
||||
#
|
||||
# Examples for cleaning the path:
|
||||
#
|
||||
@ -38,9 +37,9 @@
|
||||
# cleaned=$(foamCleanPath -env=PATH dir1:dir2) && PATH=$cleaned
|
||||
#
|
||||
# - Using shell evaluation for the output
|
||||
# eval $(foamCleanPath -sh=PATH "$PATH" dir1:dir2)
|
||||
# eval $(foamCleanPath -sh=PATH -env=PATH dir1:dir2)
|
||||
# eval $(foamCleanPath -sh-env=PATH dir1:dir2)
|
||||
# eval $(foamCleanPath -sh=PATH $PATH" dir1:dir2)
|
||||
# eval "$(foamCleanPath -sh=PATH -env=PATH dir1:dir2)"
|
||||
# eval "$(foamCleanPath -sh-env=PATH dir1:dir2)"
|
||||
#
|
||||
# - Similarly for c-shell
|
||||
# eval `foamCleanPath -csh-env=PATH dir1:dir2`
|
||||
@ -48,28 +47,27 @@
|
||||
#------------------------------------------------------------------------------
|
||||
usage() {
|
||||
cat <<USAGE 1>&2
|
||||
Usage: foamCleanPath [OPTION] path [wildcard1] .. [wildcardN]]
|
||||
foamCleanPath [OPTION] -env=name [wildcard1] .. [wildcardN]
|
||||
|
||||
Usage: foamCleanPath [OPTION] path [filter] .. [filter]
|
||||
foamCleanPath [OPTION] -env=name [filter] .. [filter]
|
||||
options:
|
||||
-csh=NAME Produce 'setenv NAME ...' output for csh eval
|
||||
-sh=NAME Produce 'NAME=...' output for sh eval
|
||||
-csh-env=NAME As per -csh, with -env for initial content
|
||||
-sh-env=NAME As per -sh, with -env for initial content
|
||||
-env=NAME Evaluate NAME to obtain initial content
|
||||
-debug print debug information to stderr
|
||||
-strip remove inaccessible directories
|
||||
-verbose report some progress (input, output, ...)
|
||||
-help print the usage
|
||||
-debug Print debug information to stderr
|
||||
-strip Remove inaccessible directories
|
||||
-verbose Report some progress (input, output, ...)
|
||||
-help Print the usage
|
||||
|
||||
Prints its argument (which should be a ':' separated list) cleansed from
|
||||
* duplicate elements
|
||||
* elements whose start matches one of the wildcard(s)
|
||||
* elements whose start matches one of the filters
|
||||
* inaccessible directories (the -strip option)
|
||||
|
||||
Exit status
|
||||
0 on success
|
||||
1 for miscellaneous errors.
|
||||
1 general error
|
||||
2 initial value of 'path' is empty
|
||||
|
||||
USAGE
|
||||
@ -169,19 +167,20 @@ else
|
||||
printDebug() { true; } # No-op
|
||||
fi
|
||||
|
||||
# Check directory existence (optional)
|
||||
# Optional test for directory existence
|
||||
if [ -n "$optStrip" ]
|
||||
then
|
||||
isDir() { test -d "$1"; } # Check for directory
|
||||
isDir() { test -d "$1"; } # Check for directory existence
|
||||
else
|
||||
isDir() { true; } # No check (always true)
|
||||
isDir() { test -n "$1"; } # Only check for non-zero string
|
||||
fi
|
||||
|
||||
# The "wildcard1 ... wildcardN" may have been passed as a single parameter
|
||||
# or may contain ':' separators
|
||||
# The "filter ... filterN" may have been passed as a single parameter
|
||||
# or may contain ':' separators.
|
||||
# Currently (OCT-2018) also accept split on whitespace too.
|
||||
|
||||
oldIFS="$IFS" # Preserve initial IFS
|
||||
IFS=':; ' # Split on colon, whitespace (semi-colon for good measure)
|
||||
IFS=':; ' # Split on colon, semicolon, whitespace
|
||||
set -- $*
|
||||
|
||||
if [ -n "$optVerbose" ]
|
||||
@ -192,22 +191,20 @@ fi
|
||||
|
||||
printDebug "input>$dirList<"
|
||||
|
||||
# Strip out wildcards via sed. Path and wildcard cannot contain '?'.
|
||||
for wildcard
|
||||
# Apply filters via sed. Path and filter cannot contain '?'.
|
||||
for filter
|
||||
do
|
||||
if [ -n "$wildcard" ]
|
||||
if [ -n "$filter" ]
|
||||
then
|
||||
printDebug "remove>$wildcard<"
|
||||
dirList=$(echo "$dirList:" | sed -e "s?${wildcard}[^:]*:??g")
|
||||
printDebug "remove>$filter<"
|
||||
dirList=$(echo "$dirList:" | sed -e "s?${filter}[^:]*:??g")
|
||||
fi
|
||||
done
|
||||
printDebug "intermediate>$dirList<"
|
||||
|
||||
IFS=':; ' # Split on colon, whitespace (semi-colon for good measure)
|
||||
IFS=':' # Split on colon. No split on whitespace.
|
||||
set -- $dirList
|
||||
|
||||
IFS="$oldIFS" # Restore initial IFS
|
||||
|
||||
# Rebuild the list
|
||||
unset dirList
|
||||
for dir
|
||||
@ -227,12 +224,14 @@ do
|
||||
fi
|
||||
done
|
||||
|
||||
IFS="$oldIFS" # Restore initial IFS
|
||||
|
||||
printDebug "output>$dirList<"
|
||||
if [ -n "$optVerbose" ]
|
||||
then
|
||||
echo "output: $dirList" 1>&2
|
||||
echo "output: \"$dirList\"" 1>&2
|
||||
fi
|
||||
|
||||
echo "$shellOutput$dirList"
|
||||
echo "$shellOutput\"$dirList\""
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
12
etc/bashrc
12
etc/bashrc
@ -47,10 +47,10 @@ export WM_PROJECT_VERSION=plus
|
||||
# set one of the fallback values to an appropriate path.
|
||||
# --
|
||||
rc="${BASH_SOURCE:-${ZSH_NAME:+$0}}"
|
||||
[ -n "$rc" ] && FOAM_INST_DIR=$(\cd $(dirname $rc)/../.. && \pwd -L) || \
|
||||
FOAM_INST_DIR=$HOME/$WM_PROJECT
|
||||
# FOAM_INST_DIR=/opt/$WM_PROJECT
|
||||
# FOAM_INST_DIR=/usr/local/$WM_PROJECT
|
||||
[ -n "$rc" ] && FOAM_INST_DIR="$(\cd $(dirname $rc)/../.. && \pwd -L)" || \
|
||||
FOAM_INST_DIR="$HOME/$WM_PROJECT"
|
||||
# FOAM_INST_DIR="/opt/$WM_PROJECT"
|
||||
# FOAM_INST_DIR="/usr/local/$WM_PROJECT"
|
||||
#
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
################################################################################
|
||||
@ -153,7 +153,7 @@ then
|
||||
unset FOAM_SETTINGS
|
||||
else
|
||||
export FOAM_SETTINGS
|
||||
_foamEval $@
|
||||
_foamEval "$@"
|
||||
fi
|
||||
|
||||
# Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH)
|
||||
@ -170,7 +170,7 @@ _foamEtc -config settings
|
||||
# Setup for third-party packages
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
_foamEtc -config mpi
|
||||
_foamEtc -config paraview -- $@ # Pass through for evaluation
|
||||
_foamEtc -config paraview -- "$@" # Pass through for evaluation
|
||||
_foamEtc -config vtk
|
||||
_foamEtc -config ensight
|
||||
_foamEtc -config gperftools
|
||||
|
||||
@ -37,7 +37,7 @@ export ADIOS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
#------------------------------------------------------------------------------
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
echo "Using adios ($adios_version) -> $ADIOS_ARCH_PATH" 1>&2
|
||||
fi
|
||||
|
||||
@ -25,7 +25,7 @@ export ADIOS2_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adio
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
#------------------------------------------------------------------------------
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
echo "Using adios ($adios2_version) -> $ADIOS2_ARCH_PATH" 1>&2
|
||||
fi
|
||||
|
||||
@ -49,7 +49,7 @@ export CGAL_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_v
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
#------------------------------------------------------------------------------
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
echo "Using boost ($boost_version) -> $BOOST_ARCH_PATH" 1>&2
|
||||
echo "Using CGAL ($cgal_version) -> $CGAL_ARCH_PATH" 1>&2
|
||||
|
||||
@ -38,7 +38,7 @@ export FFTW_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$fftw_v
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
#------------------------------------------------------------------------------
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
echo "Using fftw ($fftw_version) -> $FFTW_ARCH_PATH" 1>&2
|
||||
fi
|
||||
|
||||
@ -58,10 +58,10 @@ alias uutil='cd $WM_PROJECT_USER_DIR/applications/utilities'
|
||||
unset -f wmRefresh 2>/dev/null
|
||||
wmRefresh()
|
||||
{
|
||||
local projectDir=$WM_PROJECT_DIR
|
||||
local foamSettings=$FOAM_SETTINGS
|
||||
local projectDir="$WM_PROJECT_DIR"
|
||||
local foamSettings="$FOAM_SETTINGS"
|
||||
wmUnset
|
||||
. $projectDir/etc/bashrc $foamSettings
|
||||
. "$projectDir/etc/bashrc" "$foamSettings"
|
||||
}
|
||||
|
||||
|
||||
@ -73,13 +73,13 @@ foamVersion()
|
||||
if [ "$#" -gt 0 ]
|
||||
then
|
||||
local dir="${WM_PROJECT_DIR%/*}" # Parent directory
|
||||
local ver=$1
|
||||
local ver="$1"
|
||||
shift
|
||||
|
||||
if [ -f "$dir/OpenFOAM-$ver/etc/bashrc" ]
|
||||
then
|
||||
wmUnset
|
||||
. $dir/OpenFOAM-$ver/etc/bashrc
|
||||
. "$dir/OpenFOAM-$ver/etc/bashrc"
|
||||
foam
|
||||
echo "Changed to OpenFOAM-$WM_PROJECT_VERSION" 1>&2
|
||||
else
|
||||
@ -104,7 +104,7 @@ foamVersion()
|
||||
unset -f foamPV 2>/dev/null
|
||||
foamPV()
|
||||
{
|
||||
. $WM_PROJECT_DIR/etc/config.sh/paraview "${@+ParaView_VERSION=$@}"
|
||||
. "$WM_PROJECT_DIR/etc/config.sh/paraview" "${@+ParaView_VERSION=$@}"
|
||||
local pvdir="${ParaView_DIR##*/}"
|
||||
echo "${pvdir:-ParaView_DIR not set}" 1>&2
|
||||
}
|
||||
@ -117,13 +117,13 @@ foamPwd()
|
||||
{
|
||||
if [ -d "$WM_PROJECT_DIR" ]
|
||||
then
|
||||
echo $PWD | sed \
|
||||
echo "$PWD" | sed \
|
||||
-e "s#^${FOAM_RUN}#\$FOAM_RUN#;" \
|
||||
-e "s#^${WM_PROJECT_DIR}#\$WM_PROJECT_DIR#;" \
|
||||
-e "s#^${WM_PROJECT_USER_DIR}#\$WM_PROJECT_USER_DIR#;" \
|
||||
-e "s#^${HOME}#\$HOME#";
|
||||
else
|
||||
echo $PWD | sed -e "s#^${HOME}#\$HOME#;"
|
||||
echo "$PWD" | sed -e "s#^${HOME}#\$HOME#;"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ then
|
||||
foamOldDirs="$(complete 2>/dev/null | sed -ne 's/^.*-F _of_.* \(..*\)$/\1/p')"
|
||||
for cleaned in $foamOldDirs
|
||||
do
|
||||
complete -r $cleaned 2>/dev/null
|
||||
complete -r "$cleaned" 2>/dev/null
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
@ -27,6 +27,8 @@ pv=5.5.0
|
||||
pv=5.5.0-mpipy
|
||||
qt=qt-5.9.0
|
||||
|
||||
eval $(foamEtcFile -sh -config -mode=o paraview -- ParaView_VERSION=$pv ParaView_QT=$qt)
|
||||
eval \
|
||||
"$(foamEtcFile -sh -config -mode=o paraview -- \
|
||||
ParaView_VERSION=$pv ParaView_QT=$qt)"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -28,22 +28,22 @@ then
|
||||
WM_SHELL_FUNCTIONS=loaded
|
||||
|
||||
# Cleaning environment variables
|
||||
foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
|
||||
foamClean="$WM_PROJECT_DIR/bin/foamCleanPath"
|
||||
|
||||
# Cleaning environment variables
|
||||
unset -f _foamClean 2>/dev/null
|
||||
_foamClean()
|
||||
{
|
||||
foamVar_name=$1
|
||||
foamVar_name="$1"
|
||||
shift
|
||||
eval $($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=$foamVar_name "$@")
|
||||
unset foamVar_name
|
||||
eval "$($foamClean -sh-env=$foamVar_name $@)"
|
||||
unset "foamVar_name"
|
||||
}
|
||||
|
||||
# Source an etc file, possibly with some verbosity
|
||||
# - use eval to avoid intermediate variables (ksh doesn't have 'local')
|
||||
unset -f _foamEtc 2>/dev/null
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
_foamEtc()
|
||||
{
|
||||
@ -60,21 +60,21 @@ then
|
||||
unset -f _foamAddPath 2>/dev/null
|
||||
_foamAddPath()
|
||||
{
|
||||
[ -n "$1" ] && export PATH=$1:$PATH
|
||||
[ -n "$1" ] && export PATH="$1:$PATH"
|
||||
}
|
||||
|
||||
# Prepend MANPATH
|
||||
unset -f _foamAddMan 2>/dev/null
|
||||
_foamAddMan()
|
||||
{
|
||||
[ -n "$1" ] && export MANPATH=$1:$MANPATH
|
||||
[ -n "$1" ] && export MANPATH="$1:$MANPATH"
|
||||
}
|
||||
|
||||
# Prepend LD_LIBRARY_PATH
|
||||
unset -f _foamAddLib 2>/dev/null
|
||||
_foamAddLib()
|
||||
{
|
||||
[ -n "$1" ] && export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH
|
||||
[ -n "$1" ] && export LD_LIBRARY_PATH="$1:$LD_LIBRARY_PATH"
|
||||
}
|
||||
|
||||
# Prepend to LD_LIBRARY_PATH with additional checking
|
||||
@ -106,7 +106,7 @@ then
|
||||
do
|
||||
if [ -d "$foamVar_prefix/$foamVar_end" ]
|
||||
then
|
||||
export LD_LIBRARY_PATH=$foamVar_prefix/$foamVar_end:$LD_LIBRARY_PATH
|
||||
export LD_LIBRARY_PATH="$foamVar_prefix/$foamVar_end:$LD_LIBRARY_PATH"
|
||||
unset foamVar_prefix foamVar_end
|
||||
return 0
|
||||
fi
|
||||
@ -119,10 +119,10 @@ then
|
||||
then
|
||||
case "$foamVar_end" in
|
||||
/*) # An absolute path
|
||||
export LD_LIBRARY_PATH=$foamVar_end:$LD_LIBRARY_PATH
|
||||
export LD_LIBRARY_PATH="$foamVar_end:$LD_LIBRARY_PATH"
|
||||
;;
|
||||
(*) # Relative to prefix
|
||||
export LD_LIBRARY_PATH=$foamVar_prefix/$foamVar_end:$LD_LIBRARY_PATH
|
||||
export LD_LIBRARY_PATH="$foamVar_prefix/$foamVar_end:$LD_LIBRARY_PATH"
|
||||
;;
|
||||
esac
|
||||
unset foamVar_prefix foamVar_end
|
||||
@ -143,7 +143,7 @@ then
|
||||
# Prepend DYLD_LIBRARY_PATH
|
||||
_foamAddLib()
|
||||
{
|
||||
[ -n "$1" ] && export DYLD_LIBRARY_PATH=$1:$DYLD_LIBRARY_PATH
|
||||
[ -n "$1" ] && export DYLD_LIBRARY_PATH="$1:$DYLD_LIBRARY_PATH"
|
||||
}
|
||||
|
||||
# Prepend to DYLD_LIBRARY_PATH with additional checking
|
||||
@ -168,19 +168,22 @@ then
|
||||
;;
|
||||
*=)
|
||||
# name= -> unset name
|
||||
[ "$FOAM_VERBOSE" -a "$PS1" ] && echo "unset ${1%=}" 1>&2
|
||||
[ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] \
|
||||
&& echo "unset ${1%=}" 1>&2
|
||||
eval "unset ${1%=}"
|
||||
;;
|
||||
*=*)
|
||||
# name=value -> export name=value
|
||||
[ "$FOAM_VERBOSE" -a "$PS1" ] && echo "export $1" 1>&2
|
||||
[ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] \
|
||||
&& echo "export $1" 1>&2
|
||||
eval "export $1"
|
||||
;;
|
||||
*)
|
||||
# Filename: source it
|
||||
if [ -f "$1" ]
|
||||
then
|
||||
[ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Using: $1" 1>&2
|
||||
[ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] \
|
||||
&& echo "Using: $1" 1>&2
|
||||
. "$1"
|
||||
else
|
||||
_foamEtc -silent "$1"
|
||||
|
||||
@ -40,7 +40,7 @@ GPERFTOOLS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$gperfto
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
#------------------------------------------------------------------------------
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
echo "Using gperftools ($gperftools_version) -> $GPERFTOOLS_ARCH_PATH" 1>&2
|
||||
fi
|
||||
|
||||
@ -31,7 +31,7 @@ export HYPRE_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRE
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
#------------------------------------------------------------------------------
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
echo "Using hypre ($hypre_version) -> $HYPRE_ARCH_PATH" 1>&2
|
||||
fi
|
||||
|
||||
@ -68,7 +68,7 @@ OPENMPI)
|
||||
# Inform openmpi where to find its install directory
|
||||
export OPAL_PREFIX=$MPI_ARCH_PATH
|
||||
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
echo "Using $WM_MPLIB" 1>&2
|
||||
echo " FOAM_MPI : $FOAM_MPI" 1>&2
|
||||
@ -168,7 +168,7 @@ CRAY-MPICH)
|
||||
export FOAM_MPI=cray-mpich
|
||||
export MPI_ARCH_PATH=$MPICH_DIR
|
||||
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
echo "Using $WM_MPLIB" 1>&2
|
||||
echo " FOAM_MPI : $FOAM_MPI" 1>&2
|
||||
@ -247,7 +247,7 @@ SGIMPI)
|
||||
echo " Currently using '$MPI_ARCH_PATH'" 1>&2
|
||||
}
|
||||
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
echo "Using $WM_MPLIB" 1>&2
|
||||
echo " FOAM_MPI : $FOAM_MPI" 1>&2
|
||||
@ -269,7 +269,7 @@ INTELMPI)
|
||||
# If subdirectory is version number only, prefix with 'impi-'
|
||||
case "$FOAM_MPI" in ([0-9]*) FOAM_MPI="impi-$FOAM_MPI";; esac
|
||||
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
echo "Using $WM_MPLIB" 1>&2
|
||||
echo " FOAM_MPI : $FOAM_MPI" 1>&2
|
||||
@ -283,7 +283,7 @@ INTELMPI)
|
||||
# If subdirectory is version number only, prefix with 'impi-'
|
||||
case "$FOAM_MPI" in ([0-9]*) FOAM_MPI="impi-$FOAM_MPI";; esac
|
||||
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
echo "Using $WM_MPLIB" 1>&2
|
||||
echo " FOAM_MPI : $FOAM_MPI" 1>&2
|
||||
|
||||
@ -58,18 +58,20 @@ pv_api=auto # Either auto or pair of (major.minor) digits
|
||||
archDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER"
|
||||
|
||||
# Clean PATH and LD_LIBRARY_PATH
|
||||
eval $($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=PATH \
|
||||
"$ParaView_DIR $archDir/ParaView- $archDir/qt- $archDir/cmake-")
|
||||
eval \
|
||||
"$($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=PATH \
|
||||
$ParaView_DIR $archDir/ParaView- $archDir/qt- $archDir/cmake-)"
|
||||
|
||||
eval $($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=LD_LIBRARY_PATH \
|
||||
"$ParaView_DIR $archDir/ParaView- $archDir/qt-")
|
||||
eval \
|
||||
"$($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=LD_LIBRARY_PATH \
|
||||
$ParaView_DIR $archDir/ParaView- $archDir/qt-)"
|
||||
|
||||
# ThirdParty cmake
|
||||
cmake=$archDir/$cmake_version
|
||||
if [ -r $cmake/bin/cmake ]
|
||||
cmake="$archDir/$cmake_version"
|
||||
if [ -r "$cmake/bin/cmake" ]
|
||||
then
|
||||
# _foamAddPath not available when foamPV function is used
|
||||
PATH=$cmake/bin:$PATH
|
||||
PATH="$cmake/bin:$PATH"
|
||||
fi
|
||||
|
||||
# Evaluate command-line parameters for ParaView
|
||||
@ -159,7 +161,7 @@ then
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
echo "Using paraview"
|
||||
echo " ParaView_DIR : $ParaView_DIR"
|
||||
|
||||
@ -31,7 +31,7 @@ export PETSC_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRE
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
#------------------------------------------------------------------------------
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
echo "Using petsc ($petsc_version) -> $PETSC_ARCH_PATH" 1>&2
|
||||
fi
|
||||
|
||||
@ -273,7 +273,7 @@ GCC_NOT_FOUND
|
||||
|
||||
_foamAddLibAuto $mpcDir
|
||||
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
echo "Using ThirdParty compiler"
|
||||
echo " ${gccDir##*/} (${gmpDir##*/} $${mpfrDir##*/} ${mpcDir##*/})"
|
||||
@ -299,7 +299,7 @@ CLANG_NOT_FOUND
|
||||
_foamAddPath $clangDir/bin
|
||||
_foamAddLib $clangDir/lib # For things like libomp (openmp) etc
|
||||
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
echo "Using ThirdParty compiler"
|
||||
echo " ${clangDir##*/}"
|
||||
|
||||
@ -92,7 +92,7 @@ unset MPI_ARCH_PATH
|
||||
unset MPI_BUFFER_SIZE
|
||||
|
||||
# Undefine OPAL_PREFIX if set to one of the paths on foamOldDirs
|
||||
if [ -z "$($foamClean -env=OPAL_PREFIX "$foamOldDirs")" ]
|
||||
if [ -n "$foamClean" ] && [ -z "$($foamClean -env=OPAL_PREFIX $foamOldDirs)" ]
|
||||
then
|
||||
unset OPAL_PREFIX
|
||||
fi
|
||||
@ -108,7 +108,7 @@ unset PV_PLUGIN_PATH
|
||||
unset VTK_DIR
|
||||
|
||||
# Undefine Qt5_DIR if set to one of the paths on foamOldDirs
|
||||
if [ -z "$($foamClean -env=Qt5_DIR "$foamOldDirs")" ]
|
||||
if [ -n "$foamClean" ] && [ -z "$($foamClean -env=Qt5_DIR $foamOldDirs)" ]
|
||||
then
|
||||
unset Qt5_DIR
|
||||
fi
|
||||
@ -137,9 +137,9 @@ unset SCOTCH_ARCH_PATH
|
||||
|
||||
if [ -n "$foamClean" ]
|
||||
then
|
||||
eval $($foamClean -sh-env=PATH "$foamOldDirs")
|
||||
eval $($foamClean -sh-env=LD_LIBRARY_PATH "$foamOldDirs")
|
||||
eval $($foamClean -sh-env=MANPATH "$foamOldDirs")
|
||||
eval "$($foamClean -sh-env=PATH $foamOldDirs)"
|
||||
eval "$($foamClean -sh-env=LD_LIBRARY_PATH $foamOldDirs)"
|
||||
eval "$($foamClean -sh-env=MANPATH $foamOldDirs)"
|
||||
fi
|
||||
|
||||
[ -n "$LD_LIBRARY_PATH" ] || unset LD_LIBRARY_PATH
|
||||
@ -189,7 +189,7 @@ unset -f foamPV 2>/dev/null
|
||||
foamOldDirs="$(complete 2>/dev/null | sed -ne 's/^.*-F _of_.* \(..*\)$/\1/p')"
|
||||
for cleaned in $foamOldDirs
|
||||
do
|
||||
complete -r $cleaned 2>/dev/null
|
||||
complete -r "$cleaned" 2>/dev/null
|
||||
done
|
||||
|
||||
# Completion functions
|
||||
|
||||
@ -39,7 +39,7 @@ export MESA_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mesa_v
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
#------------------------------------------------------------------------------
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
echo "Using vtk ($vtk_version) -> $VTK_DIR" 1>&2
|
||||
echo "Using mesa ($mesa_version) -> $MESA_ARCH_PATH" 1>&2
|
||||
|
||||
Reference in New Issue
Block a user