###########################################################################
#
# Set up GILDAS environment under csh (J.Pety 2023).
#
###########################################################################
#
setenv GAG_GAG "${HOME}/.gag"
#
if ("$?GAG_EXEC_DIR" != "0") then
    # Undo append operations done by previous call. Beware not to leave a leading column
    setenv PATH `echo $PATH | sed "s%${GAG_EXEC_DIR}/bin:*%%"`
    setenv LD_LIBRARY_PATH `echo $LD_LIBRARY_PATH | sed "s%${GAG_EXEC_DIR}/lib:/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib:/opt/local/lib:*%%"`
    setenv PYTHONPATH `echo $PYTHONPATH | sed "s%${GAG_EXEC_DIR}/python:*%%"`
endif
#
setenv GAG_EXEC_DIR "${GAG_ROOT_DIR}/${GAG_EXEC_SYSTEM}"
#
setenv GAG_PATH "${GAG_ROOT_DIR}/etc"
if ("$?PATH" == "0") then
    setenv PATH "${GAG_EXEC_DIR}/bin"
else
    setenv PATH "${GAG_EXEC_DIR}/bin:${PATH}"
endif
if ("$?LD_LIBRARY_PATH" == "0") then
    setenv LD_LIBRARY_PATH "${GAG_EXEC_DIR}/lib:/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib:/opt/local/lib"
else
    setenv LD_LIBRARY_PATH "${GAG_EXEC_DIR}/lib:/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib:/opt/local/lib:${LD_LIBRARY_PATH}"
endif
if ("$?PYTHONPATH" == "0") then
    setenv PYTHONPATH "${GAG_EXEC_DIR}/python"
else
    setenv PYTHONPATH "${GAG_EXEC_DIR}/python:${PYTHONPATH}"
endif
if ($?prompt) then
   echo
   echo "Selecting GILDAS version: apr24a (01apr24 05:00 cest), executable tree, ${GAG_EXEC_SYSTEM}"
   echo
endif
#
###########################################################################
