Skip to content
Snippets Groups Projects
Commit 8c444826 authored by Fons Rademakers's avatar Fons Rademakers
Browse files

don't use too generic variables (like THIS). Fixes issue ROOT-5186.

parent 9019d203
No related branches found
No related tags found
No related merge requests found
......@@ -8,90 +8,90 @@
# Author: Fons Rademakers, 18/8/2006
if ($?ROOTSYS) then
setenv OLD_ROOTSYS "$ROOTSYS"
set old_rootsys="$ROOTSYS"
endif
# $_ should be source .../thisroot.csh
set ARGS=($_)
if ("$ARGS" != "") then
set THIS="`dirname ${ARGS[2]}`"
set thisroot="`dirname ${ARGS[2]}`"
else
# But $_ might not be set if the script is source non-interactively.
# In [t]csh the sourced file is inserted 'in place' inside the
# outer script, so we need an external source of information
# either via the current directory or an extra parameter.
if ( -e thisroot.csh ) then
set THIS=${PWD}
else if ( -e bin/thisroot.csh ) then
set THIS=${PWD}/bin
set thisroot=${PWD}
else if ( -e bin/thisroot.csh ) then
set thisroot=${PWD}/bin
else if ( "$1" != "" ) then
if ( -e ${1}/bin/thisroot.csh ) then
set THIS=${1}/bin
set thisroot=${1}/bin
else if ( -e ${1}/thisroot.csh ) then
set THIS=${1}
else
set thisroot=${1}
else
echo "thisroot.csh: ${1} does not contain a ROOT installation"
endif
endif
else
echo 'Error: The call to "source where_root_is/bin/thisroot.csh" can not determine the location of the ROOT installation'
echo "because it was embedded another script (this is an issue specific to csh)."
echo "Use either:"
echo " cd where_root_is; source bin/thisroot.csh"
echo "or"
echo " source where_root_is/bin/thisroot.csh where_root_is"
echo " source where_root_is/bin/thisroot.csh where_root_is"
endif
endif
if ($?THIS) then
if ($?thisroot) then
setenv ROOTSYS "`(cd ${THIS}/..;pwd)`"
setenv ROOTSYS "`(cd ${thisroot}/..;pwd)`"
if ($?OLD_ROOTSYS) then
setenv PATH `echo $PATH | sed -e "s;:$OLD_ROOTSYS/bin:;:;g" \
-e "s;:$OLD_ROOTSYS/bin;;g" \
-e "s;$OLD_ROOTSYS/bin:;;g" \
-e "s;$OLD_ROOTSYS/bin;;g"`
if ($?old_rootsys) then
setenv PATH `echo $PATH | sed -e "s;:$old_rootsys/bin:;:;g" \
-e "s;:$old_rootsys/bin;;g" \
-e "s;$old_rootsys/bin:;;g" \
-e "s;$old_rootsys/bin;;g"`
if ($?LD_LIBRARY_PATH) then
setenv LD_LIBRARY_PATH `echo $LD_LIBRARY_PATH | \
sed -e "s;:$OLD_ROOTSYS/lib:;:;g" \
-e "s;:$OLD_ROOTSYS/lib;;g" \
-e "s;$OLD_ROOTSYS/lib:;;g" \
-e "s;$OLD_ROOTSYS/lib;;g"`
sed -e "s;:$old_rootsys/lib:;:;g" \
-e "s;:$old_rootsys/lib;;g" \
-e "s;$old_rootsys/lib:;;g" \
-e "s;$old_rootsys/lib;;g"`
endif
if ($?DYLD_LIBRARY_PATH) then
setenv DYLD_LIBRARY_PATH `echo $DYLD_LIBRARY_PATH | \
sed -e "s;:$OLD_ROOTSYS/lib:;:;g" \
-e "s;:$OLD_ROOTSYS/lib;;g" \
-e "s;$OLD_ROOTSYS/lib:;;g" \
-e "s;$OLD_ROOTSYS/lib;;g"`
sed -e "s;:$old_rootsys/lib:;:;g" \
-e "s;:$old_rootsys/lib;;g" \
-e "s;$old_rootsys/lib:;;g" \
-e "s;$old_rootsys/lib;;g"`
endif
if ($?SHLIB_PATH) then
setenv SHLIB_PATH `echo $SHLIB_PATH | \
sed -e "s;:$OLD_ROOTSYS/lib:;:;g" \
-e "s;:$OLD_ROOTSYS/lib;;g" \
-e "s;$OLD_ROOTSYS/lib:;;g" \
-e "s;$OLD_ROOTSYS/lib;;g"`
sed -e "s;:$old_rootsys/lib:;:;g" \
-e "s;:$old_rootsys/lib;;g" \
-e "s;$old_rootsys/lib:;;g" \
-e "s;$old_rootsys/lib;;g"`
endif
if ($?LIBPATH) then
setenv LIBPATH `echo $LIBPATH | \
sed -e "s;:$OLD_ROOTSYS/lib:;:;g" \
-e "s;:$OLD_ROOTSYS/lib;;g" \
-e "s;$OLD_ROOTSYS/lib:;;g" \
-e "s;$OLD_ROOTSYS/lib;;g"`
sed -e "s;:$old_rootsys/lib:;:;g" \
-e "s;:$old_rootsys/lib;;g" \
-e "s;$old_rootsys/lib:;;g" \
-e "s;$old_rootsys/lib;;g"`
endif
if ($?PYTHONPATH) then
setenv PYTHONPATH `echo $PYTHONPATH | \
sed -e "s;:$OLD_ROOTSYS/lib:;:;g" \
-e "s;:$OLD_ROOTSYS/lib;;g" \
-e "s;$OLD_ROOTSYS/lib:;;g" \
-e "s;$OLD_ROOTSYS/lib;;g"`
sed -e "s;:$old_rootsys/lib:;:;g" \
-e "s;:$old_rootsys/lib;;g" \
-e "s;$old_rootsys/lib:;;g" \
-e "s;$old_rootsys/lib;;g"`
endif
if ($?MANPATH) then
setenv MANPATH `echo $MANPATH | \
sed -e "s;:$OLD_ROOTSYS/man:;:;g" \
-e "s;:$OLD_ROOTSYS/man;;g" \
-e "s;$OLD_ROOTSYS/man:;;g" \
-e "s;$OLD_ROOTSYS/man;;g"`
sed -e "s;:$old_rootsys/man:;:;g" \
-e "s;:$old_rootsys/man;;g" \
-e "s;$old_rootsys/man:;;g" \
-e "s;$old_rootsys/man;;g"`
endif
endif
......@@ -99,7 +99,7 @@ endif
if ($?MANPATH) then
# Nothing to do
else
# Grab the default man path before setting the path to avoid duplicates
# Grab the default man path before setting the path to avoid duplicates
if ( -X manpath ) then
set default_manpath = `manpath`
else
......@@ -145,4 +145,8 @@ else
setenv MANPATH `dirname @mandir@`:$default_manpath
endif
endif # if ("$THIS" != "")
endif # if ("$thisroot" != "")
set thisroot=
set old_rootsys=
......@@ -25,7 +25,7 @@ drop_from_path()
}
if [ -n "${ROOTSYS}" ] ; then
OLD_ROOTSYS=${ROOTSYS}
old_rootsys=${ROOTSYS}
fi
if [ "x${BASH_ARGV[0]}" = "x" ]; then
......@@ -37,43 +37,43 @@ if [ "x${BASH_ARGV[0]}" = "x" ]; then
ROOTSYS="$PWD"; export ROOTSYS
else
# get param to "."
THIS=$(dirname ${BASH_ARGV[0]})
ROOTSYS=$(cd ${THIS}/..;pwd); export ROOTSYS
thisroot=$(dirname ${BASH_ARGV[0]})
ROOTSYS=$(cd ${thisroot}/..;pwd); export ROOTSYS
fi
if [ -n "${OLD_ROOTSYS}" ] ; then
if [ -n "${old_rootsys}" ] ; then
if [ -n "${PATH}" ]; then
drop_from_path $PATH ${OLD_ROOTSYS}/bin
drop_from_path $PATH ${old_rootsys}/bin
PATH=$newpath
fi
if [ -n "${LD_LIBRARY_PATH}" ]; then
drop_from_path $LD_LIBRARY_PATH ${OLD_ROOTSYS}/lib
drop_from_path $LD_LIBRARY_PATH ${old_rootsys}/lib
LD_LIBRARY_PATH=$newpath
fi
if [ -n "${DYLD_LIBRARY_PATH}" ]; then
drop_from_path $DYLD_LIBRARY_PATH ${OLD_ROOTSYS}/lib
drop_from_path $DYLD_LIBRARY_PATH ${old_rootsys}/lib
DYLD_LIBRARY_PATH=$newpath
fi
if [ -n "${SHLIB_PATH}" ]; then
drop_from_path $SHLIB_PATH ${OLD_ROOTSYS}/lib
drop_from_path $SHLIB_PATH ${old_rootsys}/lib
SHLIB_PATH=$newpath
fi
if [ -n "${LIBPATH}" ]; then
drop_from_path $LIBPATH ${OLD_ROOTSYS}/lib
drop_from_path $LIBPATH ${old_rootsys}/lib
LIBPATH=$newpath
fi
if [ -n "${PYTHONPATH}" ]; then
drop_from_path $PYTHONPATH ${OLD_ROOTSYS}/lib
drop_from_path $PYTHONPATH ${old_rootsys}/lib
PYTHONPATH=$newpath
fi
if [ -n "${MANPATH}" ]; then
drop_from_path $MANPATH ${OLD_ROOTSYS}/man
drop_from_path $MANPATH ${old_rootsys}/man
MANPATH=$newpath
fi
fi
if [ -z "${MANPATH}" ]; then
# Grab the default man path before setting the path to avoid duplicates
# Grab the default man path before setting the path to avoid duplicates
if `which manpath > /dev/null 2>&1` ; then
default_manpath=`manpath`
else
......@@ -126,3 +126,7 @@ fi
if [ "x`root-config --arch | grep -v win32gcc | grep -i win32`" != "x" ]; then
ROOTSYS="`cygpath -w $ROOTSYS`"
fi
unset old_rootsys
unset thisroot
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment