mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 05:24:53 +01:00
Respect ESPHOME_USE_SUBPROCESS in esp32 post_build script (#3246)
This commit is contained in:
parent
69633826bb
commit
6919930aaa
1 changed files with 9 additions and 2 deletions
|
@ -1,6 +1,10 @@
|
|||
# Source https://github.com/letscontrolit/ESPEasy/pull/3845#issuecomment-1005864664
|
||||
|
||||
import esptool
|
||||
import os
|
||||
if os.environ.get("ESPHOME_USE_SUBPROCESS") is None:
|
||||
import esptool
|
||||
else:
|
||||
import subprocess
|
||||
from SCons.Script import ARGUMENTS
|
||||
|
||||
# pylint: disable=E0602
|
||||
|
@ -42,8 +46,11 @@ def esp32_create_combined_bin(source, target, env):
|
|||
print()
|
||||
print(f"Using esptool.py arguments: {' '.join(cmd)}")
|
||||
print()
|
||||
esptool.main(cmd)
|
||||
|
||||
if os.environ.get("ESPHOME_USE_SUBPROCESS") is None:
|
||||
esptool.main(cmd)
|
||||
else:
|
||||
subprocess.run(["esptool.py", *cmd])
|
||||
|
||||
# pylint: disable=E0602
|
||||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_combined_bin) # noqa
|
||||
|
|
Loading…
Reference in a new issue