Skip to content

Commit

Permalink
rg_tool: Fixed not working correctly on Windows with esp-idf 4.4
Browse files Browse the repository at this point in the history
esp-idf 4.4 does some fancy powershell stuff instead of adding commands to the PATH:

````
function idf.py { &python "$IDF_PATH\tools\idf.py" $args }
function espefuse.py { &python "$IDF_PATH\components\esptool_py\esptool\espefuse.py" $args }
function espsecure.py { &python "$IDF_PATH\components\esptool_py\esptool\espsecure.py" $args }
function otatool.py { &python "$IDF_PATH\components\app_update\otatool.py" $args }
function parttool.py { &python "$IDF_PATH\components\partition_table\parttool.py" $args }
````

`subprocess.run`'s subshell can't see or run those.
  • Loading branch information
ducalex committed Aug 2, 2024
1 parent 39c1477 commit 9d26cd1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion rg_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@
except:
PROJECT_VER = "unknown"

# esp-idf 4.4 makes powershell functions on Windows instead of adding these to the PATH...
# doesn't really hurt to have them again even if they're in PATH, so let's always do it...
os.environ["PATH"] += os.pathsep + os.path.join(os.getenv("IDF_PATH"), "components", "partition_table")
os.environ["PATH"] += os.pathsep + os.path.join(os.getenv("IDF_PATH"), "components", "esptool_py", "esptool")

IDF_PY = "idf.py"
ESPTOOL_PY = "esptool.py"
PARTTOOL_PY = "parttool.py"
IDF_MONITOR_PY = "idf_monitor.py"
GEN_ESP32PART_PY = os.path.join(os.getenv("IDF_PATH"), "components", "partition_table", "gen_esp32part.py")
GEN_ESP32PART_PY = "gen_esp32part.py"
MKFW_PY = os.path.join("tools", "mkfw.py")

if os.path.exists("rg_config.py"):
Expand Down

0 comments on commit 9d26cd1

Please sign in to comment.