mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Respect ESPHOME_USE_SUBPROCESS in esp32 post_build script (#3246)
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user