mirror of
https://github.com/esphome/esphome.git
synced 2025-09-22 21:22:22 +01:00
Allow global setting of compile process limit (#4081)
This commit is contained in:
@@ -110,6 +110,15 @@ def validate_version(value: str):
|
||||
return value
|
||||
|
||||
|
||||
if "ESPHOME_DEFAULT_COMPILE_PROCESS_LIMIT" in os.environ:
|
||||
_compile_process_limit_default = min(
|
||||
int(os.environ["ESPHOME_DEFAULT_COMPILE_PROCESS_LIMIT"]),
|
||||
multiprocessing.cpu_count(),
|
||||
)
|
||||
else:
|
||||
_compile_process_limit_default = cv.UNDEFINED
|
||||
|
||||
|
||||
CONF_ESP8266_RESTORE_FROM_FLASH = "esp8266_restore_from_flash"
|
||||
CONFIG_SCHEMA = cv.All(
|
||||
cv.Schema(
|
||||
@@ -153,9 +162,9 @@ CONFIG_SCHEMA = cv.All(
|
||||
cv.Optional(CONF_MIN_VERSION, default=ESPHOME_VERSION): cv.All(
|
||||
cv.version_number, validate_version
|
||||
),
|
||||
cv.Optional(CONF_COMPILE_PROCESS_LIMIT): cv.int_range(
|
||||
min=1, max=multiprocessing.cpu_count()
|
||||
),
|
||||
cv.Optional(
|
||||
CONF_COMPILE_PROCESS_LIMIT, default=_compile_process_limit_default
|
||||
): cv.int_range(min=1, max=multiprocessing.cpu_count()),
|
||||
}
|
||||
),
|
||||
validate_hostname,
|
||||
|
Reference in New Issue
Block a user