mirror of
https://github.com/esphome/esphome.git
synced 2024-12-24 22:44:54 +01:00
Respect ESPHOME_USE_SUBPROCESS in esp32 post_build script (#3246)
This commit is contained in:
parent
138d6e505b
commit
3d0899aa58
1 changed files with 9 additions and 2 deletions
|
@ -1,6 +1,10 @@
|
||||||
# Source https://github.com/letscontrolit/ESPEasy/pull/3845#issuecomment-1005864664
|
# 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
|
from SCons.Script import ARGUMENTS
|
||||||
|
|
||||||
# pylint: disable=E0602
|
# pylint: disable=E0602
|
||||||
|
@ -42,8 +46,11 @@ def esp32_create_combined_bin(source, target, env):
|
||||||
print()
|
print()
|
||||||
print(f"Using esptool.py arguments: {' '.join(cmd)}")
|
print(f"Using esptool.py arguments: {' '.join(cmd)}")
|
||||||
print()
|
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
|
# pylint: disable=E0602
|
||||||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_combined_bin) # noqa
|
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_combined_bin) # noqa
|
||||||
|
|
Loading…
Reference in a new issue