Skip to content

Commit

Permalink
tools: fix {install,export}.ps1 for IDF_PATH with spaces
Browse files Browse the repository at this point in the history
Usage of IDF_PATH has to be quoted in case it contains spaces.
  • Loading branch information
igrr committed Sep 9, 2022
1 parent 3ca44d4 commit 89d132f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions export.ps1
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/usr/bin/env pwsh
$S = [IO.Path]::PathSeparator # path separator. WIN:';', UNIX:":"

$IDF_PATH = $PSScriptRoot
$IDF_PATH = "$PSScriptRoot"

Write-Output "Setting IDF_PATH: $IDF_PATH"
$env:IDF_PATH = $IDF_PATH
$env:IDF_PATH = "$IDF_PATH"

Write-Output "Checking Python compatibility"
python $IDF_PATH/tools/python_version_checker.py
python "$IDF_PATH/tools/python_version_checker.py"

Write-Output "Adding ESP-IDF tools to PATH..."
$OLD_PATH = $env:PATH.split($S) | Select-Object -Unique # array without duplicates
# using idf_tools.py to get $envars_array to set
$envars_raw = python $IDF_PATH/tools/idf_tools.py export --format key-value
$envars_raw = python "$IDF_PATH/tools/idf_tools.py" export --format key-value
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # if error

$envars_array = @() # will be filled like:
Expand Down Expand Up @@ -75,7 +75,7 @@ Write-Output "Checking if Python packages are up to date..."
Start-Process -Wait -NoNewWindow -FilePath "python" -Args "`"$IDF_PATH/tools/idf_tools.py`" check-python-dependencies"
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # if error

$uninstall = python $IDF_PATH/tools/idf_tools.py uninstall --dry-run
$uninstall = python "$IDF_PATH/tools/idf_tools.py" uninstall --dry-run

if (![string]::IsNullOrEmpty($uninstall)){
Write-Output ""
Expand Down
4 changes: 2 additions & 2 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ $IDF_PATH = $PSScriptRoot
$TARGETS = (python "$IDF_PATH/tools/install_util.py" extract targets "$args")

Write-Output "Installing ESP-IDF tools"
$proces_tools = Start-Process -Wait -PassThru -NoNewWindow -FilePath "python" -Args "$IDF_PATH/tools/idf_tools.py install --targets=${TARGETS}"
$proces_tools = Start-Process -Wait -PassThru -NoNewWindow -FilePath "python" -Args "`"$IDF_PATH/tools/idf_tools.py`" install --targets=${TARGETS}"
$exit_code_tools = $proces_tools.ExitCode
if ($exit_code_tools -ne 0) { exit $exit_code_tools } # if error

$FEATURES = (python "$IDF_PATH/tools/install_util.py" extract features "$args")

Write-Output "Setting up Python environment"
$proces_py_env = Start-Process -Wait -PassThru -NoNewWindow -FilePath "python" -Args "$IDF_PATH/tools/idf_tools.py install-python-env --features=${FEATURES}"
$proces_py_env = Start-Process -Wait -PassThru -NoNewWindow -FilePath "python" -Args "`"$IDF_PATH/tools/idf_tools.py`" install-python-env --features=${FEATURES}"
$exit_code_py_env = $proces_py_env.ExitCode
if ($exit_code_py_env -ne 0) { exit $exit_code_py_env } # if error

Expand Down

0 comments on commit 89d132f

Please sign in to comment.