Skip to content

Commit

Permalink
Tweak
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Jerphanion <[email protected]>
  • Loading branch information
jjerphan committed Feb 3, 2025
1 parent 6a9e0a3 commit 07625ea
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
6 changes: 1 addition & 5 deletions repo2docker/buildpacks/conda/activate-conda.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
# enable conda and activate the notebook environment
set -ex

export MAMBA_ROOT_PREFIX="${CONDA_DIR}"
eval $(micromamba shell hook -s posix -r ${CONDA_DIR})
eval $(mamba shell hook --shell posix -r ${CONDA_DIR})

for name in conda; do
for name in conda mamba; do
CONDA_PROFILE="${CONDA_DIR}/etc/profile.d/${name}.sh"
echo "Activating profile: ${CONDA_PROFILE}"
test -f $CONDA_PROFILE && . $CONDA_PROFILE
Expand Down
6 changes: 6 additions & 0 deletions repo2docker/buildpacks/conda/install-base-env.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# and sets up the base environment
set -ex

DIRECTORY=$(dirname $0)
echo "PWD: `pwd`"
echo "DIRECTORY: $DIRECTORY"

cd $(dirname $0)

export MAMBA_VERSION="2.0.6.rc2"
Expand All @@ -24,6 +28,8 @@ chmod 0755 "$MICROMAMBA_EXE"
# Setting up micromamba in this shell and permanently
eval "$(${MICROMAMBA_EXE} shell hook --root-prefix ${CONDA_DIR} -s posix)"

cp ${DIRECTORY}/mamba.sh ${CONDA_DIR}/etc/profile.d/mamba.sh

micromamba activate

export PATH="${PWD}/bin:$PATH"
Expand Down
27 changes: 27 additions & 0 deletions repo2docker/buildpacks/conda/mamba.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
echo "WARNING: ${CONDA_DIR}/etc/profile.d/mamba.sh (the file emitting this warning) is deprecated."
echo "WARNING: This file will be removed in mamba 2.1.0."
echo "WARNING: Please use 'mamba shell init' to get the correct shell scripts for your shell."

if [ -z "${MAMBA_ROOT_PREFIX}" ]; then
echo "WARNING: The MAMBA_ROOT_PREFIX environment variable is not set."
echo "WARNING: This is required for mamba to work correctly as of 2.0."
echo "WARNING: "
echo "WARNING: For now, we are setting 'MAMBA_ROOT_PREFIX' to '${CONDA_DIR}'."
echo "WARNING: "
echo "WARNING: Please make sure this is consistent with your installation or alternatively (by order of preference):"
echo "WARNING: - rerun 'mamba shell init -s posix' to get the correct value"
echo "WARNING: - manually set 'MAMBA_ROOT_PREFIX' to the root of your installation in your shell profile script."
echo "WARNING: - use the '-r,--root-prefix' CLI option when calling mamba."
echo "WARNING: "
echo "WARNING: This message originates from ${CONDA_DIR}/etc/profile.d/mamba.sh"
export MAMBA_ROOT_PREFIX="${CONDA_DIR}"
fi

__mamba_setup="$("${CONDA_DIR}/bin/mamba" shell hook --shell posix 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__mamba_setup"
else
alias mamba="${CONDA_DIR}/bin/mamba" # Fallback on help from mamba activate
fi
unset __mamba_setup

0 comments on commit 07625ea

Please sign in to comment.