From f756ee5884ef6f794857ad57d7ca2f3f6e2e3ff8 Mon Sep 17 00:00:00 2001
From: lintao <lintao51@gmail.com>
Date: Tue, 6 Sep 2022 16:02:42 +0800
Subject: [PATCH] setup the current InstallArea if the directory exists.

---
 setup.sh | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/setup.sh b/setup.sh
index a75d5f39..4a71a8de 100644
--- a/setup.sh
+++ b/setup.sh
@@ -9,6 +9,8 @@
 # Author: Tao Lin <lintao@ihep.ac.cn>
 ##############################################################################
 
+THISSCRITDIR=$(dirname $(readlink -e "${BASH_SOURCE[0]}" 2>/dev/null) 2>/dev/null) # Darwin readlink doesnt accept -e
+
 function info:() {
     echo "INFO: $*" 1>&2
 }
@@ -41,6 +43,19 @@ function setup-external() {
 
 }
 
+function setup-install-area() {
+    local installarea=$THISSCRITDIR/InstallArea
+    if [ ! -d "$installarea" ]; then
+        return
+    fi
+
+    export PATH=$installarea/bin:$PATH
+    export LD_LIBRARY_PATH=$installarea/lib:$LD_LIBRARY_PATH
+    export PYTHONPATH=$installarea/lib:$PYTHONPATH
+    export PYTHONPATH=$installarea/python:$PYTHONPATH
+    export ROOT_INCLUDE_PATH=$installarea/include:$ROOT_INCLUDE_PATH
+    info: "Setup CEPCSW: $installarea"
+}
 
 ##############################################################################
 # Parse the command line options
@@ -54,3 +69,4 @@ fi
 export CEPCSW_LCG_VERSION
 
 setup-external
+setup-install-area
-- 
GitLab