diff --git a/buildroot/share/PlatformIO/scripts/chitu_crypt.py b/buildroot/share/PlatformIO/scripts/chitu_crypt.py index 7c94ef0a4a..a6761b01d3 100644 --- a/buildroot/share/PlatformIO/scripts/chitu_crypt.py +++ b/buildroot/share/PlatformIO/scripts/chitu_crypt.py @@ -12,7 +12,7 @@ if pioutil.is_pio_build(): accumulating_xor_value = seed for i in range(0, len(contents), 4): - value = struct.unpack('= level: print("[deps] %s" % str) @@ -206,6 +206,7 @@ if pioutil.is_pio_build(): else: blab("Added src file %s " % relp, 3) cur_srcs.add(relp) + # Special rule: If a direct folder is specified add all files within. fullplain = os.path.join(marlinbasedir, plain) if os.path.isdir(fullplain): @@ -218,6 +219,7 @@ if pioutil.is_pio_build(): def srepl(matchi): g0 = matchi.group(0) return r"**" + g0[1:] + gpattern = re.sub(r'[*]($|[^*])', srepl, plain) gpattern = os.path.join(marlinbasedir, gpattern) @@ -230,14 +232,17 @@ if pioutil.is_pio_build(): blab("Removed src file %s (%s)" % (relp, str(info)), 3) else: blab("Removed src file %s " % relp, 3) + fullplain = os.path.join(marlinbasedir, plain) if os.path.isdir(fullplain): blab("Directory content removal for %s " % plain, 2) + def filt(x): common = os.path.commonpath([plain, x]) if not common == os.path.normpath(plain): return True onremove(x, "dcr") return False + cur_srcs = set(filter(filt, cur_srcs)) else: # Remove matching source entries. @@ -245,6 +250,7 @@ if pioutil.is_pio_build(): if not fnmatch.fnmatch(x, plain): return True onremove(x) return False + cur_srcs = set(filter(filt, cur_srcs)) # Transform the resulting set into a string. for x in cur_srcs: diff --git a/buildroot/share/PlatformIO/scripts/configuration.py b/buildroot/share/PlatformIO/scripts/configuration.py index fdd2fa3854..e7b4998f75 100755 --- a/buildroot/share/PlatformIO/scripts/configuration.py +++ b/buildroot/share/PlatformIO/scripts/configuration.py @@ -28,7 +28,10 @@ def apply_opt(name, val, conf=None): # 7: Option value # 8: Whitespace after value # 9: End comment - regex = re.compile(rf'^(\s*)(//\s*)?(#define\s+)({name}\b)(\s?)(\s*)(.*?)(\s*)(//.*)?$', re.IGNORECASE) + regex = re.compile( + rf"^(\s*)(//\s*)?(#define\s+)({name}\b)(\s?)(\s*)(.*?)(\s*)(//.*)?$", + re.IGNORECASE + ) # Find and enable and/or update all matches for file in ("Configuration.h", "Configuration_adv.h"): diff --git a/buildroot/share/PlatformIO/scripts/preprocessor.py b/buildroot/share/PlatformIO/scripts/preprocessor.py index bda00dfd27..4f24458d96 100644 --- a/buildroot/share/PlatformIO/scripts/preprocessor.py +++ b/buildroot/share/PlatformIO/scripts/preprocessor.py @@ -15,6 +15,7 @@ def blab(str): # Invoke GCC to run the preprocessor and extract enabled features # preprocessor_cache = {} + def run_preprocessor(env, fn=None): filename = fn or 'buildroot/share/PlatformIO/scripts/common-dependencies.h' if filename in preprocessor_cache: diff --git a/buildroot/share/scripts/validate_boards.py b/buildroot/share/scripts/validate_boards.py index a495420d9d..8d5650d6c6 100755 --- a/buildroot/share/scripts/validate_boards.py +++ b/buildroot/share/scripts/validate_boards.py @@ -12,11 +12,11 @@ def logmsg(msg, line): # Print a formatted error def err(board, msg): - print(f'[ERROR] {board:30} {msg}') + print(f"[ERROR] {board:30} {msg}") # Print a formatted warning def warn(board, msg): - print(f'[WARNING] {board:30} {msg}') + print(f"[WARNING] {board:30} {msg}") def bshort(board): return board.replace('BOARD_', '') @@ -119,7 +119,7 @@ def boards_checks(argv): print(f'[ERROR] Non-matching boards order in pins.h. Expected {bshort(boards_boards[i])} but got {bshort(pins_boards[i])}') break - return ERRS; + return ERRS if __name__ == '__main__': ERR_COUNT = boards_checks(sys.argv[1:])