From f88e11ce3cded335f56520e4f90d60a869445830 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Thu, 18 Mar 2010 11:05:39 +0100
Subject: [PATCH] ENH: don't set ParaView_MAJOR if the ParaView_VERSION appears
 non-numeric (eg, a git or cvs version).

- place the onus on the user to provide the correct ParaView_MAJOR in
  these situations.

STYLE: Drop support for cmake older than 2.6.4 (installed in 3rdParty)
---
 etc/apps/paraview3/bashrc | 14 ++++++++------
 etc/apps/paraview3/cshrc  |  9 +++++----
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/etc/apps/paraview3/bashrc b/etc/apps/paraview3/bashrc
index 51d6c2604ce..be74f7cb8fa 100644
--- a/etc/apps/paraview3/bashrc
+++ b/etc/apps/paraview3/bashrc
@@ -39,7 +39,7 @@ cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" "$WM_THIRD_PARTY_DIR/platform
 
 # determine the cmake to be used
 unset CMAKE_HOME
-for cmake in cmake-2.8.1 cmake-2.8.0 cmake-2.6.4 cmake-2.6.2 cmake-2.4.6
+for cmake in cmake-2.8.1 cmake-2.8.0 cmake-2.6.4
 do
     cmake=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cmake
     if [ -r $cmake ]
@@ -52,20 +52,22 @@ done
 
 
 # set VERSION and MAJOR (version) variables if not already set
-[ -z "$ParaView_VERSION" ] && export ParaView_VERSION=3.6.1
+[ -n "$ParaView_VERSION" ] || ParaView_VERSION=3.6.1
+[ -n "$ParaView_MAJOR" ]   || ParaView_MAJOR=unknown
 
 # if needed, set MAJOR version to correspond to VERSION
 # ParaView_MAJOR is "<digits>.<digits>" from ParaView_VERSION
 case "$ParaView_VERSION" in
-"${ParaView_MAJOR}.*" )
+"$ParaView_MAJOR".* )
     # version and major appear to correspond
     ;;
 
-*)
-    [ -z ${ParaView_MAJOR} ] && ParaView_MAJOR=`echo $ParaView_VERSION | sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
+[0-9]*)
+    # extract major from the version
+    ParaView_MAJOR=`echo $ParaView_VERSION | sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
     ;;
 esac
-export ParaView_MAJOR
+export ParaView_VERSION ParaView_MAJOR
 
 paraviewInstDir=$WM_THIRD_PARTY_DIR/paraview-$ParaView_VERSION
 export ParaView_DIR=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-$ParaView_VERSION
diff --git a/etc/apps/paraview3/cshrc b/etc/apps/paraview3/cshrc
index f5cbb60d467..4b7f4700288 100644
--- a/etc/apps/paraview3/cshrc
+++ b/etc/apps/paraview3/cshrc
@@ -40,7 +40,7 @@ if ( $status == 0 ) set path=($cleaned)
 
 # determine the cmake to be used
 unsetenv CMAKE_HOME
-foreach cmake ( cmake-2.8.1 cmake-2.8.0 cmake-2.6.4 cmake-2.6.2 cmake-2.4.6 )
+foreach cmake ( cmake-2.8.1 cmake-2.8.0 cmake-2.6.4 )
     set cmake=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cmake
     if ( -r $cmake ) then
         setenv CMAKE_HOME $cmake
@@ -51,16 +51,17 @@ end
 
 # set VERSION and MAJOR (version) variables if not already set
 if ( ! $?ParaView_VERSION || "x$ParaView_VERSION" == "x" ) setenv ParaView_VERSION 3.6.1
-if ( ! $?ParaView_MAJOR )   setenv ParaView_MAJOR unknown
+if ( ! $?ParaView_MAJOR ) setenv ParaView_MAJOR unknown
 
 # if needed, set MAJOR version to correspond to VERSION
 # ParaView_MAJOR is "<digits>.<digits>" from ParaView_VERSION
 switch ("$ParaView_VERSION")
-case "${ParaView_MAJOR}.*":
+case "$ParaView_MAJOR".*:
     # version and major appear to correspond
     breaksw
 
-default:
+case [0-9]*:
+    # extract major from the version
     setenv ParaView_MAJOR `echo ${ParaView_VERSION} | \
         sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
     breaksw
-- 
GitLab