Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bash + zsh path setting code for anvio-dev installation #23

Open
bluegenes opened this issue Jul 22, 2023 · 0 comments
Open

bash + zsh path setting code for anvio-dev installation #23

bluegenes opened this issue Jul 22, 2023 · 0 comments

Comments

@bluegenes
Copy link

bluegenes commented Jul 22, 2023

cc @ahenoch

The following detects shell to enable the path setting + update to work in zsh. It also uses the current working directory, fixing issues for any folks who don't place the anvio directory in ~/github

mkdir -p "${CONDA_PREFIX}/etc/conda/activate.d/"
SHELL_NAME=$(basename "$SHELL")

# Define color/formatting codes for different shells
if [ "$SHELL_NAME" = "zsh" ]; then
  # Zsh shell
  blue_text=$(tput setaf 4)
  red_text=$(tput setaf 1)
  reset_text=$(tput sgr0)
else
  # Bash shell (default to original formatting)
  blue_text="\033[1;34m"
  red_text="\033[0;31m"
  reset_text="\033[0m"
fi

# Create the activation script
cat <<EOF >"${CONDA_PREFIX}/etc/conda/activate.d/anvio.sh"
# creating an activation script for the conda environment for anvi'o
# development branch so (1) Python knows where to find anvi'o libraries,
# (2) the shell knows where to find anvi'o programs, and (3) every time
# the environment is activated, it synchronizes with the latest code from
# the active GitHub repository:
export PYTHONPATH=\$PYTHONPATH:${PWD}
export PATH=\$PATH:${PWD}/bin:${PWD}/sandbox
echo -e "${blue_text}Updating from anvi'o GitHub ${red_text}(press CTRL+C to cancel)${reset_text} ..."
cd ${PWD} && git pull && cd -
EOF

Tested for zsh on M2 mac, please do test on bash. This might be worth obscuring as a script.

A simpler solution might be to enable pip install -e . :)

(edited. had a pythonpath error initially :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant