Commit bef508de authored by Mark Olesen's avatar Mark Olesen
Browse files

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
parent b6d87f56
......@@ -29,7 +29,7 @@
# Extract data for each time-step from a log file for graphing.
#
# Environment
# WM_PROJECT_API
# FOAM_API
# WM_PROJECT_DIR
# WM_PROJECT_SITE
#
......@@ -90,9 +90,9 @@ cat <<HELP
The database ($Script.db) will taken from these locations:
.
$userDir/$WM_PROJECT_API/
$userDir/$FOAM_API/
$userDir/
$groupDir/$WM_PROJECT_API/etc/
$groupDir/$FOAM_API/etc/
$groupDir/etc/
$WM_PROJECT_DIR/etc/
$toolsDir
......
......@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2018-2019 OpenCFD Ltd.
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
......@@ -30,14 +30,14 @@
# - requires rsync
#
# Environment
# WM_PROJECT_API
# FOAM_API
# WM_PROJECT_DIR
# WM_PROJECT_SITE
#
#------------------------------------------------------------------------------
groupDir="${WM_PROJECT_SITE:-${WM_PROJECT_DIR:-<unknown>}/site}"
userDir="$HOME/.OpenFOAM"
projectApi="${WM_PROJECT_API:-unknown}"
projectApi="${FOAM_API:-unknown}"
templateDir="appTemplates"
......@@ -52,7 +52,7 @@ options:
-app NAME specify the application to use
-case DIR specify alternative case directory, default is the cwd
-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]
-help Print the usage
......
......@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2018-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
......@@ -74,9 +74,9 @@ do
esac
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=$(printf %-36s ${version:-OPENFOAM})
......
......@@ -196,13 +196,13 @@ sourceFoam=false # Fallback command
# Same as foamEtcFile -mode=uo bashrc
#
# check ~/.$WM_PROJECT/$WM_PROJECT_API/
# check ~/.$WM_PROJECT/$FOAM_API/
# check ~/.$WM_PROJECT/
# check <installedProject>/etc/
if [ -n "$WM_PROJECT" ]
# check projectDir/etc/
if [ -n "$WM_PROJECT_DIR" ]
then
for i in \
"$HOME/.$WM_PROJECT/$WM_PROJECT_API" \
"$HOME/.$WM_PROJECT/$FOAM_API" \
"$HOME/.$WM_PROJECT" \
"$WM_PROJECT_DIR/etc" \
;
......
......@@ -2,7 +2,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -46,7 +46,7 @@
#
# 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}
#
#------------------------------------------------------------------------------
......
......@@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / 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
# This file is part of OpenFOAM, licensed under GNU General Public License
......@@ -22,9 +22,9 @@
# - $WM_PROJECT_DIR/etc/prefs.sh
#
# - User or group values (first file found):
# - ~/.OpenFOAM/$WM_PROJECT_API/prefs.sh
# - ~/.OpenFOAM/$FOAM_API/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
#
# Environment
......
......@@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / 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
# This file is part of OpenFOAM, licensed under GNU General Public License
......@@ -183,11 +183,11 @@ endif
setenv PATH "${WM_PROJECT_DIR}/bin:${PATH}"
# 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"
endif
if ( -d "$siteDir/$WM_PROJECT_API/bin" ) then # API-specific
_foamAddPath "$siteDir/$WM_PROJECT_API/bin"
if ( -d "$siteDir/$FOAM_API/bin" ) then # API-specific
_foamAddPath "$siteDir/$FOAM_API/bin"
endif
# OpenFOAM executables (user, group, standard)
......
......@@ -2,7 +2,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -24,8 +24,8 @@
#
#------------------------------------------------------------------------------
# [WM_PROJECT_API] - The API level for the project
setenv WM_PROJECT_API `$WM_PROJECT_DIR/bin/foamEtcFile -show-api`
# [FOAM_API] - The API level for the project
setenv FOAM_API `$WM_PROJECT_DIR/bin/foamEtcFile -show-api`
# The installation parent directory
set prefixDir="${WM_PROJECT_DIR:h}"
......@@ -51,8 +51,8 @@ _foamEcho "Locating ThirdParty directory"
foreach foamDir (\
"$WM_PROJECT_DIR/ThirdParty" \
"$prefixDir/ThirdParty-$WM_PROJECT_VERSION" \
"$prefixDir/ThirdParty-v$WM_PROJECT_API" \
"$prefixDir/ThirdParty-$WM_PROJECT_API" \
"$prefixDir/ThirdParty-v$FOAM_API" \
"$prefixDir/ThirdParty-$FOAM_API" \
"$prefixDir/ThirdParty-common" \
)
_foamEcho "... $foamDir"
......
......@@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / 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
# This file is part of OpenFOAM, licensed under GNU General Public License
......@@ -180,13 +180,13 @@ fi
export PATH="$WM_PROJECT_DIR/bin:$PATH"
# Prepend site-specific scripts to path - only if they exist
if [ -d "$siteDir/bin" ] # Generic
if [ -d "$siteDir/bin" ] # Generic
then
_foamAddPath "$siteDir/bin"
fi
if [ -d "$siteDir/$WM_PROJECT_API/bin" ] # API-specific
if [ -d "$siteDir/$FOAM_API/bin" ] # API-specific
then
_foamAddPath "$siteDir/$WM_PROJECT_API/bin"
_foamAddPath "$siteDir/$FOAM_API/bin"
fi
# OpenFOAM executables (user, group, standard)
......
......@@ -24,8 +24,8 @@
#
#------------------------------------------------------------------------------
# [WM_PROJECT_API] - The API level for the project
export WM_PROJECT_API="$($WM_PROJECT_DIR/bin/foamEtcFile -show-api)"
# [FOAM_API] - The API level for the project
export FOAM_API="$($WM_PROJECT_DIR/bin/foamEtcFile -show-api)"
# The installation parent directory
prefixDir="${WM_PROJECT_DIR%/*}"
......@@ -51,9 +51,9 @@ _foamEcho "Locating ThirdParty directory"
for WM_THIRD_PARTY_DIR in \
"$WM_PROJECT_DIR/ThirdParty" \
"$prefixDir/ThirdParty-$WM_PROJECT_VERSION" \
"$prefixDir/ThirdParty-v$WM_PROJECT_API" \
"$prefixDir/ThirdParty-$WM_PROJECT_API" \
"$prefixDir/ThirdParty-$FOAM_API" \
"$prefixDir/ThirdParty-v$FOAM_API" \
"$prefixDir/ThirdParty-$FOAM_API" \
"$prefixDir/ThirdParty-common" \
;
do
......
......@@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / 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
# This file is part of OpenFOAM, licensed under GNU General Public License
......@@ -22,9 +22,9 @@
# - $WM_PROJECT_DIR/etc/prefs.csh
#
# - User or group values (first file found):
# - ~/.OpenFOAM/$WM_PROJECT_API/prefs.csh
# - ~/.OpenFOAM/$FOAM_API/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
#
# Environment
......
......@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2018-2019 OpenCFD Ltd.
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
......@@ -44,20 +44,24 @@
# Sources the relevant cshrc/bashrc if not set.
#
# Environment
# - FOAM_API
# - WM_PROJECT_DIR
# - WM_PROJECT
# - WM_PROJECT_API
# - WM_PROJECT (defaults to OpenFOAM)
#
#-------------------------------------------------------------------------------
Script=${0##*/}
Script="${0##*/}"
# csh sets HOST, bash sets HOSTNAME
: ${HOST:=$HOSTNAME}
# Default project
[ -n "$WM_PROJECT" ] || WM_PROJECT=OpenFOAM
lockDir="$HOME/.$WM_PROJECT/.wmake"
# csh sets HOST, bash sets HOSTNAME
[ -n "$HOST" ] || HOST="$HOSTNAME"
# 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
if [ "$1" = "-count" ]
......@@ -90,13 +94,13 @@ esac
# Same as foamEtcFile -mode=uo bashrc
#
# Check ~/.$WM_PROJECT/$WM_PROJECT_API/
# Check ~/.$WM_PROJECT/$FOAM_API/
# Check ~/.$WM_PROJECT/
# Check projectDir/etc/
if [ -n "$WM_PROJECT" ]
if [ -n "$WM_PROJECT_DIR" ]
then
for i in \
"$HOME/.$WM_PROJECT/$WM_PROJECT_API" \
"$HOME/.$WM_PROJECT/$FOAM_API" \
"$HOME/.$WM_PROJECT" \
"$WM_PROJECT_DIR/etc" \
;
......@@ -114,11 +118,11 @@ fi
# Use FOAM_SETTINGS to pass command-line settings
case "$sourceFoam" in
*/bashrc)
sourceFoam='[ -n "$WM_PROJECT" ] || '". $sourceFoam $FOAM_SETTINGS"
sourceFoam='[ -n "$WM_PROJECT_DIR" ] || '". $sourceFoam $FOAM_SETTINGS"
;;
*/cshrc)
sourceFoam='if ( ! $?WM_PROJECT ) source '"$sourceFoam $FOAM_SETTINGS"
sourceFoam='if ( ! $?WM_PROJECT_DIR ) source '"$sourceFoam $FOAM_SETTINGS"
;;
esac
......
......@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2018-2019 OpenCFD Ltd.
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
......@@ -44,20 +44,24 @@
# Sources the relevant cshrc/bashrc if not set.
#
# Environment
# - FOAM_API
# - WM_PROJECT_DIR
# - WM_PROJECT
# - WM_PROJECT_API
# - WM_PROJECT (defaults to OpenFOAM)
#
#-------------------------------------------------------------------------------
Script=${0##*/}
Script="${0##*/}"
# csh sets HOST, bash sets HOSTNAME
: ${HOST:=$HOSTNAME}
# Default project
[ -n "$WM_PROJECT" ] || WM_PROJECT=OpenFOAM
lockDir="$HOME/.$WM_PROJECT/.wmake"
# csh sets HOST, bash sets HOSTNAME
[ -n "$HOST" ] || HOST="$HOSTNAME"
# 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
if [ "$1" = "-count" ]
......@@ -90,13 +94,13 @@ esac
# Same as foamEtcFile -mode=uo bashrc
#
# Check ~/.$WM_PROJECT/$WM_PROJECT_API/
# Check ~/.$WM_PROJECT/$FOAM_API/
# Check ~/.$WM_PROJECT/
# Check projectDir/etc/
if [ -n "$WM_PROJECT" ]
if [ -n "$WM_PROJECT_DIR" ]
then
for i in \
"$HOME/.$WM_PROJECT/$WM_PROJECT_API" \
"$HOME/.$WM_PROJECT/$FOAM_API" \
"$HOME/.$WM_PROJECT" \
"$WM_PROJECT_DIR/etc" \
;
......@@ -114,11 +118,11 @@ fi
# Use FOAM_SETTINGS to pass command-line settings
case "$sourceFoam" in
*/bashrc)
sourceFoam='[ -n "$WM_PROJECT" ] || '". $sourceFoam $FOAM_SETTINGS"
sourceFoam='[ -n "$WM_PROJECT_DIR" ] || '". $sourceFoam $FOAM_SETTINGS"
;;
*/cshrc)
sourceFoam='if ( ! $?WM_PROJECT ) source '"$sourceFoam $FOAM_SETTINGS"
sourceFoam='if ( ! $?WM_PROJECT_DIR ) source '"$sourceFoam $FOAM_SETTINGS"
;;
esac
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment