diff --git a/etc/bashrc b/etc/bashrc index cc8b0a87d32d759568465224c7e9df4dd656e903..4465d2af6c0b82ab7b295acc26d4fcd6a1030859 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -132,12 +132,12 @@ fi # ~~~~~~~~~~~~~~~~~~~~~~ export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION -# Source initialization functions -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Load helper functions +# ~~~~~~~~~~~~~~~~~~~~~ . $WM_PROJECT_DIR/etc/config.sh/functions # Add in preset user or site preferences: -_foamSourceEtc prefs.sh +_foamEtc prefs.sh # Evaluate command-line parameters and record settings for later. # These can be used to set/unset values, or specify alternative pref files. @@ -163,22 +163,22 @@ export PATH LD_LIBRARY_PATH MANPATH # Source project setup files # ~~~~~~~~~~~~~~~~~~~~~~~~~~ -_foamSourceEtc config.sh/settings -_foamSourceEtc config.sh/aliases +_foamEtc config.sh/settings +_foamEtc config.sh/aliases # Source user setup files for optional packages # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -_foamSourceEtc config.sh/mpi -_foamSourceEtc config.sh/paraview -_foamSourceEtc config.sh/vtk -_foamSourceEtc config.sh/ensight -_foamSourceEtc config.sh/gperftools +_foamEtc config.sh/mpi +_foamEtc config.sh/paraview +_foamEtc config.sh/vtk +_foamEtc config.sh/ensight +_foamEtc config.sh/gperftools -#_foamSourceEtc config.sh/ADIOS -_foamSourceEtc config.sh/CGAL -_foamSourceEtc config.sh/scotch -_foamSourceEtc config.sh/FFTW +#_foamEtc config.sh/ADIOS +_foamEtc config.sh/CGAL +_foamEtc config.sh/scotch +_foamEtc config.sh/FFTW # Clean environment paths again. Only remove duplicates @@ -202,13 +202,13 @@ then fi -# Cleanup environment: -# ~~~~~~~~~~~~~~~~~~~~ +# Cleanup environment +# ~~~~~~~~~~~~~~~~~~~ unset cleaned foamClean foamOldDirs -# Unload initialization functions: -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Unload helper functions +# ~~~~~~~~~~~~~~~~~~~~~~~ . $WM_PROJECT_DIR/etc/config.sh/functions #------------------------------------------------------------------------------ diff --git a/etc/config.csh/mpi b/etc/config.csh/mpi index 88524e548d372653df7dcf825d0f939fd6536cc8..6604febf3d0172c566114ddb7e2a42be87a56aad 100644 --- a/etc/config.csh/mpi +++ b/etc/config.csh/mpi @@ -49,7 +49,7 @@ case SYSTEMOPENMPI: case OPENMPI: setenv FOAM_MPI openmpi-2.0.2 # Optional configuration tweaks: - _foamSourceEtc config.csh/openmpi + _foamEtc config.csh/openmpi setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI diff --git a/etc/config.csh/settings b/etc/config.csh/settings index 8e048e2323f4e9f03aa7dab44d89ae836b6461af..97bcc5d111fcd86a4a48d3301114eaa421a7a963 100644 --- a/etc/config.csh/settings +++ b/etc/config.csh/settings @@ -213,7 +213,7 @@ if ( ! $?WM_COMPILER_TYPE ) setenv WM_COMPILER_TYPE system # Load configured compiler versions, regardless of the compiler type # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -_foamSourceEtc config.csh/compiler +_foamEtc config.csh/compiler switch ("$WM_COMPILER_TYPE") case system: diff --git a/etc/config.sh/functions b/etc/config.sh/functions index edc316528879eafaf44fd30993aff62076fdb10b..8e62d11e241ed39b24c4421388f69390337f6771 100644 --- a/etc/config.sh/functions +++ b/etc/config.sh/functions @@ -32,22 +32,31 @@ if [ -z "$WM_BASH_FUNCTIONS" ] then + # Not previously loaded/defined - define now - # Temporary environment variable for automatically (un)loading functions + # Temporary environment variable to track loading/unloading of functions WM_BASH_FUNCTIONS=loaded - # Source a file, possibly with some verbosity - _foamSource() + # Prefix to PATH + _foamAddPath() { - if [ $# -gt 0 -a -f "$1" ] - then - [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Using: $1" 1>&2 - . $1 - fi + [ $# -gt 0 ] && export PATH=$1:$PATH + } + + # Prefix to LD_LIBRARY_PATH + _foamAddLib() + { + [ $# -gt 0 ] && export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH + } + + # Prefix to MANPATH + _foamAddMan() + { + [ $# -gt 0 ] && export MANPATH=$1:$MANPATH } # Source an etc file, possibly with some verbosity - _foamSourceEtc() + _foamEtc() { local file if [ $# -gt 0 ] && file=$($WM_PROJECT_DIR/bin/foamEtcFile "$@") @@ -85,7 +94,7 @@ then [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Using: $1" 1>&2 . "$1" else - _foamSourceEtc -silent "$1" + _foamEtc -silent "$1" fi ;; esac @@ -93,32 +102,12 @@ then done } - # Prefix to PATH - _foamAddPath() - { - [ $# -gt 0 ] && export PATH=$1:$PATH; - } - - # Prefix to LD_LIBRARY_PATH - _foamAddLib() - { - [ $# -gt 0 ] && export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH - } - - # Prefix to MANPATH - _foamAddMan() - { - [ $# -gt 0 ] && export MANPATH=$1:$MANPATH - } - else + # Was previously loaded/defined - now unset - # Cleanup environment: - # ~~~~~~~~~~~~~~~~~~~~ unset WM_BASH_FUNCTIONS unset -f _foamAddPath _foamAddLib _foamAddMan - unset -f _foamSourceEtc _foamEval - unset -f _foamSource + unset -f _foamEtc _foamEval fi diff --git a/etc/config.sh/mpi b/etc/config.sh/mpi index 5d04da0ff386da8f93ba02d913583af97696ebef..4bb31063b51806a60f71e2353b30af25dfbbdef0 100644 --- a/etc/config.sh/mpi +++ b/etc/config.sh/mpi @@ -55,7 +55,7 @@ SYSTEMOPENMPI) OPENMPI) export FOAM_MPI=openmpi-2.0.2 # Optional configuration tweaks: - _foamSourceEtc config.sh/openmpi + _foamEtc config.sh/openmpi export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI diff --git a/etc/config.sh/settings b/etc/config.sh/settings index 259d61ace9f14e0f2364cea4de83af658ca655f3..f2c76e5eac1a6ba96e69cfa6691ed171459b43ea 100644 --- a/etc/config.sh/settings +++ b/etc/config.sh/settings @@ -212,7 +212,7 @@ unset GMP_ARCH_PATH MPFR_ARCH_PATH # Load configured compiler versions, regardless of the compiler type # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -_foamSourceEtc config.sh/compiler +_foamEtc config.sh/compiler case "$WM_COMPILER_TYPE" in system) diff --git a/etc/cshrc b/etc/cshrc index 10165e0964e5f9491231cb8a34949b13018722e2..54a9b943435f4d361487178edbf92db53a38cee3 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -147,13 +147,13 @@ setenv WM_PROJECT_USER_DIR $HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION # Source etc files, possibly with some verbosity if ($?FOAM_VERBOSE && $?prompt) then - alias _foamSourceEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh-verbose \!*`' + alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh-verbose \!*`' else - alias _foamSourceEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh \!*`' + alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh \!*`' endif # Add in preset user or site preferences: -_foamSourceEtc prefs.csh +_foamEtc prefs.csh # Evaluate command-line parameters and record settings for later. # These can be used to set/unset values, or specify alternative pref files. @@ -180,7 +180,7 @@ while ( $#argv > 0 ) if ($?FOAM_VERBOSE && $?prompt) echo "Using: $1" source "$1" else - _foamSourceEtc -silent "$1" + _foamEtc -silent "$1" endif breaksw endsw @@ -213,19 +213,19 @@ if ( $status == 0 ) setenv MANPATH $cleaned # Source project setup files # ~~~~~~~~~~~~~~~~~~~~~~~~~~ -_foamSourceEtc config.csh/settings -_foamSourceEtc config.csh/aliases +_foamEtc config.csh/settings +_foamEtc config.csh/aliases # Source user setup files for optional packages # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -_foamSourceEtc config.csh/mpi -_foamSourceEtc config.csh/paraview -_foamSourceEtc config.csh/vtk -_foamSourceEtc config.csh/ensight +_foamEtc config.csh/mpi +_foamEtc config.csh/paraview +_foamEtc config.csh/vtk +_foamEtc config.csh/ensight -#_foamSourceEtc config.csh/ADIOS -_foamSourceEtc config.csh/CGAL -_foamSourceEtc config.csh/FFTW +#_foamEtc config.csh/ADIOS +_foamEtc config.csh/CGAL +_foamEtc config.csh/FFTW # Clean environment paths again. Only remove duplicates @@ -252,6 +252,6 @@ endif # Cleanup environment: # ~~~~~~~~~~~~~~~~~~~~ unset cleaned foamClean foamOldDirs -unalias _foamSourceEtc +unalias _foamEtc #------------------------------------------------------------------------------