From d23fba3e445312ded8f7443366244bd8a00c8fde Mon Sep 17 00:00:00 2001 From: Alex Duchesne Date: Fri, 2 Aug 2024 14:59:42 -0400 Subject: [PATCH] rg_tool: Fixed not working correctly on Windows with esp-idf 4.4 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. --- rg_tool.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rg_tool.py b/rg_tool.py index e20c2d9bc..0fdbec997 100755 --- a/rg_tool.py +++ b/rg_tool.py @@ -28,11 +28,16 @@ except: PROJECT_VER = "unknown" +# esp-idf 4.4 and 5.1+ make 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"):