From 4425db227d98278c0ec86fa8a3d25de611fc03eb Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 10 Jan 2011 10:42:14 +0100 Subject: [PATCH] STYLE: set ParaView_VERSION in etc/apps/paraview3/*rc only - this change was wished by Mattijs and/or Henry - allow command-line settings to retain the flexibility of 'foamPV' alias mechanism. --- etc/aliases.csh | 6 +++--- etc/aliases.sh | 9 +++------ etc/apps/paraview3/bashrc | 28 ++++++++++++++++++---------- etc/apps/paraview3/cshrc | 27 +++++++++++++++++---------- etc/bashrc | 4 ---- etc/cshrc | 4 ---- 6 files changed, 41 insertions(+), 37 deletions(-) diff --git a/etc/aliases.csh b/etc/aliases.csh index 3ee5a555a6..e65135f62a 100644 --- a/etc/aliases.csh +++ b/etc/aliases.csh @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -44,9 +44,9 @@ alias wmDP 'wmSET WM_PRECISION_OPTION=DP' alias wmSchedON 'setenv WM_SCHEDULER $WM_PROJECT_DIR/wmake/wmakeScheduler' alias wmSchedOFF 'unsetenv WM_SCHEDULER' -# Change paraview version +# Change ParaView version # ~~~~~~~~~~~~~~~~~~~~~~~ -alias foamPV 'setenv ParaView_VERSION \!*; source $WM_PROJECT_DIR/etc/apps/paraview3/cshrc; echo paraview-$ParaView_VERSION' +alias foamPV 'source `$WM_PROJECT_DIR/etc/apps/paraview3/cshrc` ParaView_VERSION=\!*; echo paraview-$ParaView_VERSION' # Change directory aliases diff --git a/etc/aliases.sh b/etc/aliases.sh index 9755f000a5..411548482a 100644 --- a/etc/aliases.sh +++ b/etc/aliases.sh @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -44,16 +44,13 @@ alias wmDP='wmSET WM_PRECISION_OPTION=DP' alias wmSchedON='export WM_SCHEDULER=$WM_PROJECT_DIR/wmake/wmakeScheduler' alias wmSchedOFF='unset WM_SCHEDULER' -# Change paraview version +# Change ParaView version # ~~~~~~~~~~~~~~~~~~~~~~~ unset foamPV foamPV() { - export ParaView_VERSION=$1 - . $WM_PROJECT_DIR/etc/apps/paraview3/bashrc + . $WM_PROJECT_DIR/etc/apps/paraview3/bashrc ParaView_VERSION=$1 echo "paraview-$ParaView_VERSION (major: $ParaView_MAJOR)" - echo "dir: $ParaView_DIR" - [ -d "$ParaView_DIR" ] || echo "WARNING: directory does not exist" } diff --git a/etc/apps/paraview3/bashrc b/etc/apps/paraview3/bashrc index 7648d9bac8..9cd181b2a2 100644 --- a/etc/apps/paraview3/bashrc +++ b/etc/apps/paraview3/bashrc @@ -50,17 +50,25 @@ do done -# set VERSION and MAJOR (version) variables -if [ -z "$ParaView_VERSION" ] -then - ParaView_VERSION=3.8.0 - ParaView_MAJOR=unknown - echo "Warning in app/paraview3/bashrc:" 1>&2 - echo " ParaView_VERSION not set, using '$ParaView_VERSION'" 1>&2 -fi -[ -n "$ParaView_MAJOR" ] || ParaView_MAJOR=unknown +#- ParaView version, automatically determine major version +export ParaView_VERSION=3.8.0 +export ParaView_MAJOR=detect -# if needed, set MAJOR version to correspond to VERSION + +# Evaluate command-line parameters for ParaView +while [ $# -gt 0 ] +do + case "$1" in + ParaView*=*) + # name=value -> export name=value + eval "export $1" + ;; + esac + shift +done + + +# set MAJOR version to correspond to VERSION # ParaView_MAJOR is "." from ParaView_VERSION case "$ParaView_VERSION" in "$ParaView_MAJOR".* ) diff --git a/etc/apps/paraview3/cshrc b/etc/apps/paraview3/cshrc index 38ef886470..e82fc7b0c6 100644 --- a/etc/apps/paraview3/cshrc +++ b/etc/apps/paraview3/cshrc @@ -48,17 +48,24 @@ foreach cmake ( cmake-2.8.3 cmake-2.8.1 ) endif end -# set VERSION and MAJOR (version) variables -if ( ! $?ParaView_VERSION ) -then - setenv ParaView_VERSION 3.8.0 - setenv ParaView_MAJOR unknown - echo "Warning in app/paraview3/cshrc:" - echo " ParaView_VERSION not set, using '$ParaView_VERSION'" -fi -if ( ! $?ParaView_MAJOR ) setenv ParaView_MAJOR unknown +#- ParaView version, automatically determine major version: +setenv ParaView_VERSION 3.8.0 +setenv ParaView_MAJOR detect -# if needed, set MAJOR version to correspond to VERSION + +# Evaluate command-line parameters for ParaView +while ( $#argv > 0 ) + switch ($argv[1]) + case ParaView*=*: + # name=value -> setenv name value + eval "setenv $argv[1]:s/=/ /" + breaksw + endsw + shift +end + + +# set MAJOR version to correspond to VERSION # ParaView_MAJOR is "." from ParaView_VERSION switch ("$ParaView_VERSION") case "$ParaView_MAJOR".*: diff --git a/etc/bashrc b/etc/bashrc index 86fe72ff43..2867309ecb 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -57,10 +57,6 @@ foamInstall=$HOME/$WM_PROJECT #- note the location for later use (eg, in job scripts) : ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR -#- ParaView version, automatically determine major version: -export ParaView_VERSION=3.8.0 -export ParaView_MAJOR=unknown - #- Compiler location: # foamCompiler= system | ThirdParty (OpenFOAM) foamCompiler=system diff --git a/etc/cshrc b/etc/cshrc index 5ee5361fc3..4dfab67cbb 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -56,10 +56,6 @@ set foamInstall = $HOME/$WM_PROJECT #- note the location for later use (eg, in job scripts) if ( ! $?FOAM_INST_DIR ) setenv FOAM_INST_DIR $foamInstall -#- ParaView version, automatically determine major version: -setenv ParaView_VERSION 3.8.0 -setenv ParaView_MAJOR unknown - #- Compiler location: # foamCompiler= system | ThirdParty (OpenFOAM) set foamCompiler=system