enhanced 'Env' check (#20813)

This commit is contained in:
Jason2866 2024-02-26 14:30:44 +01:00 committed by GitHub
parent 100869a40f
commit 62d37e9fcf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 11 deletions

View File

@ -32,6 +32,7 @@ import requests
import shutil import shutil
import subprocess import subprocess
import codecs import codecs
from colorama import Fore, Back, Style
from SCons.Script import COMMAND_LINE_TARGETS from SCons.Script import COMMAND_LINE_TARGETS
sys.path.append(join(platform.get_package_dir("tool-esptoolpy"))) sys.path.append(join(platform.get_package_dir("tool-esptoolpy")))
@ -128,19 +129,23 @@ def patch_partitions_bin(size_string):
def esp32_create_chip_string(chip): def esp32_create_chip_string(chip):
tasmota_platform_org = env.subst("$BUILD_DIR").split(os.path.sep)[-1] tasmota_platform_org = env.subst("$BUILD_DIR").split(os.path.sep)[-1]
tasmota_platform = tasmota_platform_org.split('-')[0] tasmota_platform = tasmota_platform_org.split('-')[0]
if "tasmota" + chip[3:] not in tasmota_platform: # quick check for a valid name like 'tasmota' + '32c3' if ("CORE32SOLO1" in extra_flags or "FRAMEWORK_ARDUINO_SOLO1" in build_flags) and "tasmota32solo1" not in tasmota_platform_org:
print("Unexpected naming convention in this build environment:", tasmota_platform_org) print(Fore.YELLOW + "Unexpected naming convention in this build environment:" + Fore.RED, tasmota_platform_org)
print("Expected build environment name like 'tasmota32-whatever-you-want'") print(Fore.YELLOW + "Expected build environment name like " + Fore.GREEN + "'tasmota32solo1-whatever-you-want'")
print("Please correct your actual build environment, to avoid undefined behavior in build process!!") print(Fore.YELLOW + "Please correct your actual build environment, to avoid undefined behavior in build process!!")
tasmota_platform = "tasmota32solo1"
return tasmota_platform
if "tasmota" + chip[3:] not in tasmota_platform: # check + fix for a valid name like 'tasmota' + '32c3'
tasmota_platform = "tasmota" + chip[3:]
if "-DUSE_USB_CDC_CONSOLE" not in env.BoardConfig().get("build.extra_flags"):
print(Fore.YELLOW + "Unexpected naming convention in this build environment:" + Fore.RED, tasmota_platform_org)
print(Fore.YELLOW + "Expected build environment name like " + Fore.GREEN + "'tasmota" + chip[3:] + "-whatever-you-want'")
print(Fore.YELLOW + "Please correct your actual build environment, to avoid undefined behavior in build process!!")
if "-DUSE_USB_CDC_CONSOLE" in env.BoardConfig().get("build.extra_flags") and "cdc" not in tasmota_platform: if "-DUSE_USB_CDC_CONSOLE" in env.BoardConfig().get("build.extra_flags") and "cdc" not in tasmota_platform:
tasmota_platform += "cdc" tasmota_platform += "cdc"
print("WARNING: board definition uses CDC configuration, but environment name does not -> adding 'cdc' to environment name") print(Fore.YELLOW + "Board definition uses CDC configuration, but environment name does not -> fix by adding 'cdc'")
print("Please correct your actual build environment, to avoid undefined behavior in build process!!") print(Fore.YELLOW + "Expected build environment name like " + Fore.GREEN + "'tasmota" + chip[3:] + "cdc-whatever-you-want'")
if ("CORE32SOLO1" in extra_flags or "FRAMEWORK_ARDUINO_SOLO1" in build_flags) and "tasmota32solo1" not in tasmota_platform_org: print(Fore.YELLOW + "Please correct your actual build environment, to avoid undefined behavior in build process!!")
print("Unexpected naming convention in this build environment:", tasmota_platform_org)
print("Expected build environment name like 'tasmota32solo1-whatever-you-want'")
print("Please correct your actual build environment, to avoid undefined behavior in build process!!")
tasmota_platform = "tasmota32solo1"
return tasmota_platform return tasmota_platform
def esp32_build_filesystem(fs_size): def esp32_build_filesystem(fs_size):