Skip to content

Commit

Permalink
Don't make devenv dir when running dev/start --dry-run (conda#11243)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodegard authored Feb 21, 2022
1 parent 4ce56aa commit c5d5414
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
16 changes: 9 additions & 7 deletions dev/start
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ while [ $# -gt 0 ]; do
esac
done

# fallback to default values
_PYTHON="${_PYTHON:-3.8}"
_UPDATE="${_UPDATE:-1}"
_DRYRUN="${_DRYRUN:-1}"

# get source path
# since zsh is MacOS standard fallback to $0 if not in bash
_SRC="$(cd "$(dirname "$(dirname "${BASH_SOURCE:-$0}")")" 2>&1 > /dev/null; pwd -P)"
Expand All @@ -86,13 +91,10 @@ _DEVENV="${_DEVENV/#\~/${HOME}}"
# include OS
_DEVENV="${_DEVENV}/$(uname)"
# ensure exists and absolute path
mkdir -p "${_DEVENV}"
_DEVENV="$( cd "${_DEVENV}" 2>&1 > /dev/null ; pwd -P)"

# fallback to default values
_PYTHON="${_PYTHON:-3.8}"
_UPDATE="${_UPDATE:-1}"
_DRYRUN="${_DRYRUN:-1}"
if [ ${_DRYRUN} = 1 ]; then
mkdir -p "${_DEVENV}"
_DEVENV="$( cd "${_DEVENV}" 2>&1 > /dev/null ; pwd -P)"
fi

# other environment values
_NAME="devenv-${_PYTHON}-c"
Expand Down
14 changes: 8 additions & 6 deletions dev/start.bat
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,21 @@
@EXIT /B 1
:ARGS_END

@REM fallback to default values
@IF "%_PYTHON%"=="" @SET "_PYTHON=3.8"
@IF "%_UPDATE%"=="" @SET "_UPDATE=1"
@IF "%_DRYRUN%"=="" @SET "_DRYRUN=1"

@REM read devenv from ~\.condarc
@IF "%_DEVENV%"=="" @FOR /F "usebackq delims=" %%I IN (`powershell.exe "(Select-String -Path '~\.condarc' -Pattern '^devenv:\s*(.+)' | Select-Object -Last 1).Matches.Groups[1].Value -replace '^~',$Env:UserProfile"`) DO @SET "_DEVENV=%%~fI"
@REM fallback to devenv in source default
@IF "%_DEVENV%"=="" @SET "_DEVENV=%_SRC%\devenv"
@REM include OS
@SET "_DEVENV=%_DEVENV%\Windows"
@REM ensure exists
@IF NOT EXIST "%_DEVENV%" @MKDIR "%_DEVENV%"

@REM fallback to default values
@IF "%_PYTHON%"=="" @SET "_PYTHON=3.8"
@IF "%_UPDATE%"=="" @SET "_UPDATE=1"
@IF "%_DRYRUN%"=="" @SET "_DRYRUN=1"
@IF %_DRYRUN%==1 (
@IF NOT EXIST "%_DEVENV%" @MKDIR "%_DEVENV%"
)

@REM other environment variables
@SET "_NAME=devenv-%_PYTHON%-c"
Expand Down

0 comments on commit c5d5414

Please sign in to comment.