<commit_before>#
# Source this to set all what you need to use Xrootd at <xrd_install_path> 
#
# Usage:
#            source /Path/to/xrd-etc/setxrd.sh <xrd_install_path>
#
#
xrdsys=$1
binpath=""
libpath=""
manpath=""
if test "x$xrdsys" = "x"; then
   echo "ERROR: specifying the path to the installed distribution is mandatory"
   return 1;
fi
binpath="$xrdsys/bin"
if test ! -d "$binpath" ; then
   echo "ERROR: directory $binpath does not exist or not a directory!"
   return 1;
fi
libpath="$xrdsys/lib"
if test ! -d "$libpath" ; then
   libemsg="$libpath"
   libpath="$xrdsys/lib64"
   if test ! -d "$libpath" ; then
      echo "ERROR: directory $libemsg nor $libpath do not exist or are not directories!"
      return 1;
   fi
fi
manpath="$xrdsys/man"
if test ! -d "$manpath" ; then
   manemsg="$manpath"
   manpath="$xrdsys/share/man"
   if test ! -d "$manpath" ; then
      echo "WARNING: directory $manemasg and $manpath do not exist or are not directories; MANPATH unchanged"
      manpath=""
   fi
fi

ismac=`uname -s`
if test "x$ismac" = "xDarwin"; then
   ismac="yes"
else
   ismac="no"
fi

# Strip present settings, if there
if test ! "x$XRDSYS" = "x" ; then

   # Trim $PATH
   tpath=""
   oldpath=`echo $PATH | tr -s ':' ' '`
   for pp in $oldpath; do
      if test ! "x$binpath" = "x$pp" ; then
         if test ! "x$pp" = "x" ; then
            tpath="$tpath:$pp"
         fi
      fi
   done

   # Trim $LD_LIBRARY_PATH
   tldpath=""
   oldldpath=`echo $LD_LIBRARY_PATH | tr -s ':' ' '`
   for pp in $oldldpath; do
      if test ! "x$libpath" = "x$pp" ; then
         if test ! "x$pp" = "x" ; then
            tldpath="$tldpath:$pp"
         fi
      fi
   done

   # Trim $DYLD_LIBRARY_PATH
   tdyldpath=""
   if test "x$ismac" = "xyes"; then
      olddyldpath=`echo $DYLD_LIBRARY_PATH | tr -s ':' ' '`
      for pp in $olddyldpath; do
         if test ! "x$libpath" = "x$pp" ; then
            if test ! "x$pp" = "x" ; then
               tdyldpath="$tdyldpath:$pp"
            fi
         fi
      done
   fi

   # Trim $MAN_PATH
   tmanpath=""
   if test ! "x$manpath" = "x"; then
      oldmanpath=`echo $MANPATH | tr -s ':' ' '`
      for pp in $oldmanpath; do
         if test ! "x$manpath" = "x$pp" ; then
            if test ! "x$pp" = "x" ; then
               tmanpath="$tmanpath:$pp"
            fi
         fi
      done
   fi

else

   # Do not touch
   tpath="$PATH"
   tldpath="$LD_LIBRARY_PATH"
   if test "x$ismac" = "xyes"; then
      tdyldpath="$DYLD_LIBRARY_PATH"
   fi
   if test ! "x$manpath" = "x"; then
      tmanpath="$MANPATH"
   fi
fi

echo "Using XRD at $xrdsys"

export XRDSYS="$xrdsys"
export PATH="$binpath:$tpath"
export LD_LIBRARY_PATH="$libpath:$tldpath"
if test "x$ismac" = "xyes"; then
   export DYLD_LIBRARY_PATH="$libpath:$tdyldpath"
fi
if test ! "x$manpath" = "x"; then
   export MANPATH="$manpath:$tmanpath"
fi
<commit_msg>fix to avoid :: in path after removing previous xrd path component.<commit_after>#
# Source this to set all what you need to use Xrootd at <xrd_install_path> 
#
# Usage:
#      source /Path/to/xrd-etc/setxrd.sh <xrd_install_path>
#
# Author: <NAME>

drop_from_path()
{
   # Assert that we got enough arguments
   if test $# -ne 2 ; then
      echo "drop_from_path: needs 2 arguments"
      return 1
   fi

   p=$1
   drop=$2

   newpath=`echo $p | sed -e "s;:${drop}:;:;g" \
                          -e "s;:${drop};;g"   \
                          -e "s;${drop}:;;g"   \
                          -e "s;${drop};;g"`
}

xrdset="xrdset"
xrdsys=$1
binpath=""
libpath=""
manpath=""
if test "x$xrdsys" = "x"; then
   echo "$xrdset: ERROR, you must specify the path to the xrootd installed"
   return 1;
fi
binpath="$xrdsys/bin"
if test ! -d "$binpath" ; then
   echo "$xrdset: ERROR, directory $binpath does not exist or not a directory!"
   return 1;
fi
libpath="$xrdsys/lib"
if test ! -d "$libpath" ; then
   libemsg="$libpath"
   libpath="$xrdsys/lib64"
   if test ! -d "$libpath" ; then
      echo "$xrdset: ERROR, directory $libemsg nor $libpath do not exist or not directories!"
      return 1;
   fi
fi
manpath="$xrdsys/man"
if test ! -d "$manpath" ; then
   manemsg="$manpath"
   manpath="$xrdsys/share/man"
   if test ! -d "$manpath" ; then
      echo "$xrdset: WARNING, directory $manemsg and $manpath do not exist or not directories; MANPATH unchanged"
      manpath=""
   fi
fi

# Strip present settings, if there
if test ! "x$XRDSYS" = "x" ; then
   # Trim $PATH
   if [ -n "${PATH}" ]; then
      drop_from_path $PATH $binpath
      PATH=$newpath
   fi

   # Trim $LD_LIBRARY_PATH
   if [ -n "${LD_LIBRARY_PATH}" ]; then
      drop_from_path $LD_LIBRARY_PATH $libpath
      LD_LIBRARY_PATH=$newpath
   fi

   # Trim $DYLD_LIBRARY_PATH
   if [ -n "${DYLD_LIBRARY_PATH}" ]; then
      drop_from_path $DYLD_LIBRARY_PATH $libpath
      DYLD_LIBRARY_PATH=$newpath
   fi

   # Trim $MANPATH
   if [ -n "${MANPATH}" ]; then
      drop_from_path $MANPATH $manpath
      MANPATH=$newpath
   fi
fi

if [ -z "${MANPATH}" ]; then
   # Grab the default man path before setting the path to avoid duplicates
   if `which manpath > /dev/null 2>&1` ; then
      default_manpath=`manpath`
   else
      default_manpath=`man -w 2> /dev/null`
   fi
fi

#echo "Using XRD at $xrdsys"

export XRDSYS="$xrdsys"
if [ -z "${PATH}" ]; then
   PATH=$binpath; export PATH
else
   PATH=$binpath:$PATH; export PATH
fi
if [ -z "${LD_LIBRARY_PATH}" ]; then
   LD_LIBRARY_PATH=$libpath; export LD_LIBRARY_PATH
else
   LD_LIBRARY_PATH=$libpath:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
fi
if [ -z "${DYLD_LIBRARY_PATH}" ]; then
   DYLD_LIBRARY_PATH=$libpath; export DYLD_LIBRARY_PATH       
else
   DYLD_LIBRARY_PATH=$libpath:$DYLD_LIBRARY_PATH; export DYLD_LIBRARY_PATH
fi
if [ -z "${MANPATH}" ]; then
   MANPATH=$manpath:${default_manpath}; export MANPATH
else
   MANPATH=$manpath:$MANPATH; export MANPATH
fi
{'fraction_non_alphanumeric': 0.13674339300937766, 'fraction_numerical': 0.0034100596760443308, 'mean_word_length': 2.774774774774775, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1018435', 'n_tokens_mistral': 2318, 'n_tokens_neox': 2203, 'n_words': 617}