ENH: make use of FOAM_API for environment as well (issue #1158)

- was WM_PROJECT_API in the environment and FOAM_API in dictionaries.

  Make these both consistently FOAM_API.
  This is a non-breaking change, since the value of WM_PROJECT_API
  (added in 1812) and/or FOAM_API is purely informative.
  For the current correct values, always use

    * foamEtcFile -show-api
    * wmakeBuildInfo -show-api
This commit is contained in:
Mark Olesen
2019-01-10 12:21:19 +01:00
parent bae92919e5
commit 63d8e7e576
13 changed files with 71 additions and 63 deletions

View File

@ -29,7 +29,7 @@
# Extract data for each time-step from a log file for graphing. # Extract data for each time-step from a log file for graphing.
# #
# Environment # Environment
# WM_PROJECT_API # FOAM_API
# WM_PROJECT_DIR # WM_PROJECT_DIR
# WM_PROJECT_SITE # WM_PROJECT_SITE
# #
@ -90,9 +90,9 @@ cat <<HELP
The database ($Script.db) will taken from these locations: The database ($Script.db) will taken from these locations:
. .
$userDir/$WM_PROJECT_API/ $userDir/$FOAM_API/
$userDir/ $userDir/
$groupDir/$WM_PROJECT_API/etc/ $groupDir/$FOAM_API/etc/
$groupDir/etc/ $groupDir/etc/
$WM_PROJECT_DIR/etc/ $WM_PROJECT_DIR/etc/
$toolsDir $toolsDir

View File

@ -4,7 +4,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) 2011 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2018-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM. # This file is part of OpenFOAM.
@ -30,14 +30,14 @@
# - requires rsync # - requires rsync
# #
# Environment # Environment
# WM_PROJECT_API # FOAM_API
# WM_PROJECT_DIR # WM_PROJECT_DIR
# WM_PROJECT_SITE # WM_PROJECT_SITE
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
groupDir="${WM_PROJECT_SITE:-${WM_PROJECT_DIR:-<unknown>}/site}" groupDir="${WM_PROJECT_SITE:-${WM_PROJECT_DIR:-<unknown>}/site}"
userDir="$HOME/.OpenFOAM" userDir="$HOME/.OpenFOAM"
projectApi="${WM_PROJECT_API:-unknown}" projectApi="${FOAM_API:-unknown}"
templateDir="appTemplates" templateDir="appTemplates"
@ -52,7 +52,7 @@ options:
-app NAME specify the application to use -app NAME specify the application to use
-case DIR specify alternative case directory, default is the cwd -case DIR specify alternative case directory, default is the cwd
-list list the applications available -list list the applications available
-with-api=NUM specify alternative api to use (default: \$WM_PROJECT_API) -with-api=NUM specify alternative api to use (default: \$FOAM_API)
-version VER [obsolete] -version VER [obsolete]
-help Print the usage -help Print the usage

View File

@ -4,7 +4,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) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2018-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM. # This file is part of OpenFOAM.
@ -74,9 +74,9 @@ do
esac esac
done done
# Constant width for version - default to WM_PROJECT_API # Constant width for version - default to FOAM_API
: ${version:=$WM_PROJECT_API} : ${version:=$FOAM_API}
: ${version:=$WM_PROJECT_VERSION} : ${version:=$WM_PROJECT_VERSION}
version=$(printf %-36s ${version:-OPENFOAM}) version=$(printf %-36s ${version:-OPENFOAM})

View File

@ -196,13 +196,13 @@ sourceFoam=false # Fallback command
# Same as foamEtcFile -mode=uo bashrc # Same as foamEtcFile -mode=uo bashrc
# #
# check ~/.$WM_PROJECT/$WM_PROJECT_API/ # check ~/.$WM_PROJECT/$FOAM_API/
# check ~/.$WM_PROJECT/ # check ~/.$WM_PROJECT/
# check <installedProject>/etc/ # check projectDir/etc/
if [ -n "$WM_PROJECT" ] if [ -n "$WM_PROJECT_DIR" ]
then then
for i in \ for i in \
"$HOME/.$WM_PROJECT/$WM_PROJECT_API" \ "$HOME/.$WM_PROJECT/$FOAM_API" \
"$HOME/.$WM_PROJECT" \ "$HOME/.$WM_PROJECT" \
"$WM_PROJECT_DIR/etc" \ "$WM_PROJECT_DIR/etc" \
; ;

View File

@ -2,7 +2,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 | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -46,7 +46,7 @@
# #
# corresponds to the standard site location: # corresponds to the standard site location:
# #
# $WM_PROJECT_DIR/site{/$WM_PROJECT_API/platforms/$WM_OPTIONS} # $WM_PROJECT_DIR/site{/$FOAM_API/platforms/$WM_OPTIONS}
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

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) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -22,9 +22,9 @@
# - $WM_PROJECT_DIR/etc/prefs.sh # - $WM_PROJECT_DIR/etc/prefs.sh
# #
# - User or group values (first file found): # - User or group values (first file found):
# - ~/.OpenFOAM/$WM_PROJECT_API/prefs.sh # - ~/.OpenFOAM/$FOAM_API/prefs.sh
# - ~/.OpenFOAM/prefs.sh # - ~/.OpenFOAM/prefs.sh
# - $WM_PROJECT_SITE/$WM_PROJECT_API/etc/prefs.sh # - $WM_PROJECT_SITE/$FOAM_API/etc/prefs.sh
# - $WM_PROJECT_SITE/etc/prefs.sh # - $WM_PROJECT_SITE/etc/prefs.sh
# #
# Environment # Environment

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) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -183,11 +183,11 @@ endif
setenv PATH "${WM_PROJECT_DIR}/bin:${PATH}" setenv PATH "${WM_PROJECT_DIR}/bin:${PATH}"
# Prepend site-specific scripts to path - only if they exist # Prepend site-specific scripts to path - only if they exist
if ( -d "$siteDir/bin" ) then # Generic if ( -d "$siteDir/bin" ) then # Generic
_foamAddPath "$siteDir/bin" _foamAddPath "$siteDir/bin"
endif endif
if ( -d "$siteDir/$WM_PROJECT_API/bin" ) then # API-specific if ( -d "$siteDir/$FOAM_API/bin" ) then # API-specific
_foamAddPath "$siteDir/$WM_PROJECT_API/bin" _foamAddPath "$siteDir/$FOAM_API/bin"
endif endif
# OpenFOAM executables (user, group, standard) # OpenFOAM executables (user, group, standard)

View File

@ -2,7 +2,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) 2018 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -24,8 +24,8 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# [WM_PROJECT_API] - The API level for the project # [FOAM_API] - The API level for the project
setenv WM_PROJECT_API `$WM_PROJECT_DIR/bin/foamEtcFile -show-api` setenv FOAM_API `$WM_PROJECT_DIR/bin/foamEtcFile -show-api`
# The installation parent directory # The installation parent directory
set prefixDir="${WM_PROJECT_DIR:h}" set prefixDir="${WM_PROJECT_DIR:h}"
@ -51,8 +51,8 @@ _foamEcho "Locating ThirdParty directory"
foreach foamDir (\ foreach foamDir (\
"$WM_PROJECT_DIR/ThirdParty" \ "$WM_PROJECT_DIR/ThirdParty" \
"$prefixDir/ThirdParty-$WM_PROJECT_VERSION" \ "$prefixDir/ThirdParty-$WM_PROJECT_VERSION" \
"$prefixDir/ThirdParty-v$WM_PROJECT_API" \ "$prefixDir/ThirdParty-v$FOAM_API" \
"$prefixDir/ThirdParty-$WM_PROJECT_API" \ "$prefixDir/ThirdParty-$FOAM_API" \
"$prefixDir/ThirdParty-common" \ "$prefixDir/ThirdParty-common" \
) )
_foamEcho "... $foamDir" _foamEcho "... $foamDir"

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) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -180,13 +180,13 @@ fi
export PATH="$WM_PROJECT_DIR/bin:$PATH" export PATH="$WM_PROJECT_DIR/bin:$PATH"
# Prepend site-specific scripts to path - only if they exist # Prepend site-specific scripts to path - only if they exist
if [ -d "$siteDir/bin" ] # Generic if [ -d "$siteDir/bin" ] # Generic
then then
_foamAddPath "$siteDir/bin" _foamAddPath "$siteDir/bin"
fi fi
if [ -d "$siteDir/$WM_PROJECT_API/bin" ] # API-specific if [ -d "$siteDir/$FOAM_API/bin" ] # API-specific
then then
_foamAddPath "$siteDir/$WM_PROJECT_API/bin" _foamAddPath "$siteDir/$FOAM_API/bin"
fi fi
# OpenFOAM executables (user, group, standard) # OpenFOAM executables (user, group, standard)

View File

@ -24,8 +24,8 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# [WM_PROJECT_API] - The API level for the project # [FOAM_API] - The API level for the project
export WM_PROJECT_API="$($WM_PROJECT_DIR/bin/foamEtcFile -show-api)" export FOAM_API="$($WM_PROJECT_DIR/bin/foamEtcFile -show-api)"
# The installation parent directory # The installation parent directory
prefixDir="${WM_PROJECT_DIR%/*}" prefixDir="${WM_PROJECT_DIR%/*}"
@ -52,8 +52,8 @@ _foamEcho "Locating ThirdParty directory"
for WM_THIRD_PARTY_DIR in \ for WM_THIRD_PARTY_DIR in \
"$WM_PROJECT_DIR/ThirdParty" \ "$WM_PROJECT_DIR/ThirdParty" \
"$prefixDir/ThirdParty-$WM_PROJECT_VERSION" \ "$prefixDir/ThirdParty-$WM_PROJECT_VERSION" \
"$prefixDir/ThirdParty-v$WM_PROJECT_API" \ "$prefixDir/ThirdParty-v$FOAM_API" \
"$prefixDir/ThirdParty-$WM_PROJECT_API" \ "$prefixDir/ThirdParty-$FOAM_API" \
"$prefixDir/ThirdParty-common" \ "$prefixDir/ThirdParty-common" \
; ;
do do

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) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -22,9 +22,9 @@
# - $WM_PROJECT_DIR/etc/prefs.csh # - $WM_PROJECT_DIR/etc/prefs.csh
# #
# - User or group values (first file found): # - User or group values (first file found):
# - ~/.OpenFOAM/$WM_PROJECT_API/prefs.csh # - ~/.OpenFOAM/$FOAM_API/prefs.csh
# - ~/.OpenFOAM/prefs.csh # - ~/.OpenFOAM/prefs.csh
# - $WM_PROJECT_SITE/$WM_PROJECT_API/etc/prefs.csh # - $WM_PROJECT_SITE/$FOAM_API/etc/prefs.csh
# - $WM_PROJECT_SITE/prefs.csh # - $WM_PROJECT_SITE/prefs.csh
# #
# Environment # Environment

View File

@ -4,7 +4,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) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2018-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM. # This file is part of OpenFOAM.
@ -44,20 +44,24 @@
# Sources the relevant cshrc/bashrc if not set. # Sources the relevant cshrc/bashrc if not set.
# #
# Environment # Environment
# - FOAM_API
# - WM_PROJECT_DIR # - WM_PROJECT_DIR
# - WM_PROJECT # - WM_PROJECT (defaults to OpenFOAM)
# - WM_PROJECT_API
# #
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
Script=${0##*/} Script="${0##*/}"
# csh sets HOST, bash sets HOSTNAME # Default project
: ${HOST:=$HOSTNAME} [ -n "$WM_PROJECT" ] || WM_PROJECT=OpenFOAM
lockDir="$HOME/.$WM_PROJECT/.wmake" lockDir="$HOME/.$WM_PROJECT/.wmake"
# csh sets HOST, bash sets HOSTNAME
[ -n "$HOST" ] || HOST="$HOSTNAME"
# Fallback - 1 core on current host # Fallback - 1 core on current host
: ${WM_HOSTS:=$HOST:1} [ -n "$WM_HOSTS" ] || WM_HOSTS="${HOST}:1"
# Count the total number of slots available and exit # Count the total number of slots available and exit
if [ "$1" = "-count" ] if [ "$1" = "-count" ]
@ -90,13 +94,13 @@ esac
# Same as foamEtcFile -mode=uo bashrc # Same as foamEtcFile -mode=uo bashrc
# #
# Check ~/.$WM_PROJECT/$WM_PROJECT_API/ # Check ~/.$WM_PROJECT/$FOAM_API/
# Check ~/.$WM_PROJECT/ # Check ~/.$WM_PROJECT/
# Check projectDir/etc/ # Check projectDir/etc/
if [ -n "$WM_PROJECT" ] if [ -n "$WM_PROJECT_DIR" ]
then then
for i in \ for i in \
"$HOME/.$WM_PROJECT/$WM_PROJECT_API" \ "$HOME/.$WM_PROJECT/$FOAM_API" \
"$HOME/.$WM_PROJECT" \ "$HOME/.$WM_PROJECT" \
"$WM_PROJECT_DIR/etc" \ "$WM_PROJECT_DIR/etc" \
; ;
@ -114,11 +118,11 @@ fi
# Use FOAM_SETTINGS to pass command-line settings # Use FOAM_SETTINGS to pass command-line settings
case "$sourceFoam" in case "$sourceFoam" in
*/bashrc) */bashrc)
sourceFoam='[ -n "$WM_PROJECT" ] || '". $sourceFoam $FOAM_SETTINGS" sourceFoam='[ -n "$WM_PROJECT_DIR" ] || '". $sourceFoam $FOAM_SETTINGS"
;; ;;
*/cshrc) */cshrc)
sourceFoam='if ( ! $?WM_PROJECT ) source '"$sourceFoam $FOAM_SETTINGS" sourceFoam='if ( ! $?WM_PROJECT_DIR ) source '"$sourceFoam $FOAM_SETTINGS"
;; ;;
esac esac

View File

@ -4,7 +4,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) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2018-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM. # This file is part of OpenFOAM.
@ -44,20 +44,24 @@
# Sources the relevant cshrc/bashrc if not set. # Sources the relevant cshrc/bashrc if not set.
# #
# Environment # Environment
# - FOAM_API
# - WM_PROJECT_DIR # - WM_PROJECT_DIR
# - WM_PROJECT # - WM_PROJECT (defaults to OpenFOAM)
# - WM_PROJECT_API
# #
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
Script=${0##*/} Script="${0##*/}"
# csh sets HOST, bash sets HOSTNAME # Default project
: ${HOST:=$HOSTNAME} [ -n "$WM_PROJECT" ] || WM_PROJECT=OpenFOAM
lockDir="$HOME/.$WM_PROJECT/.wmake" lockDir="$HOME/.$WM_PROJECT/.wmake"
# csh sets HOST, bash sets HOSTNAME
[ -n "$HOST" ] || HOST="$HOSTNAME"
# Fallback - 1 core on current host # Fallback - 1 core on current host
: ${WM_HOSTS:=$HOST:1} [ -n "$WM_HOSTS" ] || WM_HOSTS="${HOST}:1"
# Count the total number of slots available and exit # Count the total number of slots available and exit
if [ "$1" = "-count" ] if [ "$1" = "-count" ]
@ -90,13 +94,13 @@ esac
# Same as foamEtcFile -mode=uo bashrc # Same as foamEtcFile -mode=uo bashrc
# #
# Check ~/.$WM_PROJECT/$WM_PROJECT_API/ # Check ~/.$WM_PROJECT/$FOAM_API/
# Check ~/.$WM_PROJECT/ # Check ~/.$WM_PROJECT/
# Check projectDir/etc/ # Check projectDir/etc/
if [ -n "$WM_PROJECT" ] if [ -n "$WM_PROJECT_DIR" ]
then then
for i in \ for i in \
"$HOME/.$WM_PROJECT/$WM_PROJECT_API" \ "$HOME/.$WM_PROJECT/$FOAM_API" \
"$HOME/.$WM_PROJECT" \ "$HOME/.$WM_PROJECT" \
"$WM_PROJECT_DIR/etc" \ "$WM_PROJECT_DIR/etc" \
; ;
@ -114,11 +118,11 @@ fi
# Use FOAM_SETTINGS to pass command-line settings # Use FOAM_SETTINGS to pass command-line settings
case "$sourceFoam" in case "$sourceFoam" in
*/bashrc) */bashrc)
sourceFoam='[ -n "$WM_PROJECT" ] || '". $sourceFoam $FOAM_SETTINGS" sourceFoam='[ -n "$WM_PROJECT_DIR" ] || '". $sourceFoam $FOAM_SETTINGS"
;; ;;
*/cshrc) */cshrc)
sourceFoam='if ( ! $?WM_PROJECT ) source '"$sourceFoam $FOAM_SETTINGS" sourceFoam='if ( ! $?WM_PROJECT_DIR ) source '"$sourceFoam $FOAM_SETTINGS"
;; ;;
esac esac