Skip to content

Commit

Permalink
Use _ENVEXE to activate devenv (conda#11461)
Browse files Browse the repository at this point in the history
When adding new dependencies (e.g. pluggy) the base install is unable to invoke `init` on the devenv. Unfortunately, this means our devenv will no longer be nicely labeled when activated and is instead [mis]labeled as base.
  • Loading branch information
kenodegard authored May 11, 2022
1 parent edb4586 commit 2d86e47
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
4 changes: 1 addition & 3 deletions dev/start
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ echo "Initializing shell integration..."
_AUTOBASE="${CONDA_AUTO_ACTIVATE_BASE:-undefined}"
_EXPORTED="$(export -p | grep CONDA_AUTO_ACTIVATE_BASE)"
export CONDA_AUTO_ACTIVATE_BASE=false
eval "$(cd "${_SRC}" ; "${_BASEEXE}" init --dev bash)" > /dev/null
eval "$(cd "${_SRC}" ; "${_ENVEXE}" init --dev bash)" > /dev/null
if [ "${_AUTOBASE}" = "undefined" ]; then
unset CONDA_AUTO_ACTIVATE_BASE
elif [ -n ${_EXPORTED+x} ]; then
Expand All @@ -227,8 +227,6 @@ if ! conda activate "${_ENV}" > /dev/null; then
echo "Error: failed to activate ${_NAME}" 1>&2
return 1
fi
export CONDA_EXE="${_ENVEXE}"
export CONDA_PYTHON_EXE="${_PYTHONEXE}"
export PYTHONPATH="${_SRC}:${PYTHONPATH}"

cleanup
Expand Down
14 changes: 6 additions & 8 deletions dev/start.bat
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,14 @@
@EXIT /B 1
)
@REM Windows doesn't ship with git so ensure installed into base otherwise auxlib will act up
@CALL :CONDA install -yq --name base defaults::git > NUL
@CALL :CONDA "%_BASEEXE%" install -yq --name base defaults::git > NUL
:INSTALLED

@REM create empty env if it doesn't exist
@IF EXIST "%_ENV%" @GOTO ENVEXISTS
@ECHO Creating %_NAME%...

@CALL :CONDA create -yq --prefix "%_ENV%" > NUL
@CALL :CONDA "%_BASEEXE%" create -yq --prefix "%_ENV%" > NUL
@IF NOT %ErrorLevel%==0 (
@ECHO Error: failed to create %_NAME% 1>&2
@EXIT /B 1
Expand All @@ -133,13 +133,13 @@
@IF NOT %ErrorLevel%==0 @GOTO UPTODATE
@ECHO Updating %_NAME%...

@CALL :CONDA update -yq --all > NUL
@CALL :CONDA "%_BASEEXE%" update -yq --all > NUL
@IF NOT %ErrorLevel%==0 (
@ECHO Error: failed to update development environment 1>&2
@EXIT /B 1
)

@CALL :CONDA install ^
@CALL :CONDA "%_BASEEXE%" install ^
-yq ^
--prefix "%_ENV%" ^
--override-channels ^
Expand All @@ -165,7 +165,7 @@
@SET "_AUTOBASE=%CONDA_AUTO_ACTIVATE_BASE%"
)
@SET "CONDA_AUTO_ACTIVATE_BASE=false"
@CALL :CONDA init --dev cmd.exe > NUL
@CALL :CONDA "%_ENVEXE%" init --dev cmd.exe > NUL
@CALL dev-init.bat > NUL
@IF "%_AUTOBASE%"=="undefined" (
@SET CONDA_AUTO_ACTIVATE_BASE=
Expand All @@ -185,8 +185,6 @@
@ECHO Error: failed to activate %_NAME% 1>&2
@EXIT /B 1
)
@SET "CONDA_EXE=%_ENVEXE%"
@SET "CONDA_PYTHON_EXE=%_PYTHONEXE%"
@SET "CONDA_BAT=%_CONDABAT%"
@DOSKEY conda="%CONDA_BAT%" $*

Expand Down Expand Up @@ -214,7 +212,7 @@
@SET "_PATH=%PATH%"
@SET "PATH=%_DEVENV%\Library\bin;%PATH%"

@CALL "%_BASEEXE%" %*
@CALL %*
@IF NOT %ErrorLevel%==0 @EXIT /B %ErrorLevel%

@REM restore %PATH%
Expand Down

0 comments on commit 2d86e47

Please sign in to comment.