Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-25 08:29:08

0001 if echo "$SHELL" | grep -q bash ; then
0002    UsingBash="BashTrue"
0003 fi
0004 if echo "$SHELL" | grep -q zsh ; then
0005    UsingZsh="ZshTrue"
0006 fi
0007 if [ -z "$UsingBash" ] && [ -z "$UsingZsh" ]; then
0008    echo "This script must be run in bash or zsh"
0009    return 1
0010 fi
0011 
0012 if [ $UsingBash ]; then
0013    echo "Running in bash, presumably in docker. Setting up venvdocker"
0014    if [ -z "$VIRTUAL_ENV" ]; then
0015       source /Users/eickolja/sphenix/venvdocker/bin/activate
0016    else
0017       echo "Using existing virtual environment: $VIRTUAL_ENV"
0018    fi
0019 fi
0020 
0021 if [ $UsingZsh ]; then
0022    echo "Running in zsh. Setting up venvsphenix"
0023    if [ -z "$VIRTUAL_ENV" ]; then
0024       source /Users/eickolja/sphenix/venvsphenix/bin/activate
0025    else
0026       echo "Using existing virtual environment: $VIRTUAL_ENV"
0027    fi
0028 fi
0029 
0030 echo "Setting up Test environment for sPHENIX Production (possibly inside Docker) on Mac."
0031 # echo WARNING: This script is meant for testing on a MacOS system without connection to the production system
0032 # echo WARNING: It is not meant for, and will not work in, production use.
0033 
0034 # This is the directory of the script (but no symlinks allowed)
0035 SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
0036 echo "Using scripts in: ${SCRIPT_DIR}"
0037 
0038 export PATH=${PATH}:${HOME}/bin:./bin
0039 export ODBCINI=./odbc.ini
0040 export PYTHONPATH=${PYTHONPATH}:${SCRIPT_DIR}
0041 export PATH=${PATH}:${SCRIPT_DIR}
0042 
0043 echo Using $(python --version)
0044 
0045 parse_git_branch() {
0046    branch=$( git -C ${SCRIPT_DIR} rev-parse --abbrev-ref HEAD  2> /dev/null )
0047    local branch_color_status="\e[31m" # red is bad
0048    if [ -z "$(git -C ${SCRIPT_DIR} status --porcelain -uno)" ]; then
0049       branch_color_status="\e[32m" # green is good
0050    fi
0051    pbranch=""
0052    pstatus=""
0053    if [ -e ProdFlow ]; then
0054       pbranch=$( git -C ./ProdFlow rev-parse --abbrev-ref HEAD  2> /dev/null )
0055       pstatus="\e[31m"
0056       if [ -z "$(git -C ./ProdFlow status --porcelain -uno)" ]; then
0057          pstatus="\e[32m"
0058       fi
0059    else
0060       pbranch=""
0061       pstatus="\e[31m"
0062   fi
0063 
0064    # The output needs to include the leading space and the yellow color,
0065    # and ensure all internal ANSI codes are bracketed for correct prompt width calculation.
0066    gitstatus="${branch_color_status} prod:${branch}\e[0m"
0067    if [ -n "$pbranch" ]; then
0068       #status="${status} \e[0;33mprodflow:${pbranch}\e[0m"
0069       gitstatus="${gitstatus} ${pstatus} prodflow:${pbranch}"
0070    fi
0071    echo -e "${gitstatus}\e[0m"
0072    # echo -e "${branch_color_status} prod:${branch} ${pstatus} prodflow:${pbranch} \e[0m"
0073 }
0074 
0075 if [[ "$-" == *i* ]]; then
0076    #echo "Interactive shell"
0077    : # nop
0078 else
0079    echo "Non-interactive shell"
0080    return 0
0081 fi
0082 
0083 #aliases
0084 alias cqb='condor_q -batch'
0085 
0086 if [[ -n "$BASH_VERSION" ]]; then
0087    # Bash prompt
0088    #PS1="\u@\h \$(parse_git_branch)\W> "
0089    #PS1="\e[36m\u@\h \e[33m\W>\e[0m "
0090    PS1="\u@\h \W> "
0091    git config --global user.name "Kolja Kauder"
0092    git config --global user.email "kkauder@gmail.com"
0093 elif [[ -n "$ZSH_VERSION" ]]; then
0094    # Zsh prompt
0095    PS1="%{%}me@%m%{%}%{%} [%1~/]> %{%}"
0096    #PS1='%n@%m$(parse_git_branch) %1~> '
0097 fi
0098