From 435d722c33521e91be6c3c8efdc3d7e5c3bd7246 Mon Sep 17 00:00:00 2001 From: ellensp Date: Thu, 18 Mar 2021 00:20:57 +1300 Subject: [PATCH 1/4] Fixes re join --- buildroot/share/PlatformIO/scripts/preflight-checks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildroot/share/PlatformIO/scripts/preflight-checks.py b/buildroot/share/PlatformIO/scripts/preflight-checks.py index 4499c2bfdcd0..1502996b7892 100644 --- a/buildroot/share/PlatformIO/scripts/preflight-checks.py +++ b/buildroot/share/PlatformIO/scripts/preflight-checks.py @@ -17,7 +17,7 @@ def get_envs_for_board(board, envregex): line = file.readline() found_envs = re.match(r"\s*#include .+" + envregex, line) if found_envs: - return re.findall(envregex + r"(\w+)", line) + return re.findall(re.compile("%s\w+" % osregex), line) return [] def check_envs(build_env, board_envs, config): From dd8b4231505d07dd9d3b83d840b32a4349a11b4d Mon Sep 17 00:00:00 2001 From: ellensp Date: Thu, 18 Mar 2021 00:27:52 +1300 Subject: [PATCH 2/4] use local name envregex --- buildroot/share/PlatformIO/scripts/preflight-checks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildroot/share/PlatformIO/scripts/preflight-checks.py b/buildroot/share/PlatformIO/scripts/preflight-checks.py index 1502996b7892..1d9ecc293ef7 100644 --- a/buildroot/share/PlatformIO/scripts/preflight-checks.py +++ b/buildroot/share/PlatformIO/scripts/preflight-checks.py @@ -17,7 +17,7 @@ def get_envs_for_board(board, envregex): line = file.readline() found_envs = re.match(r"\s*#include .+" + envregex, line) if found_envs: - return re.findall(re.compile("%s\w+" % osregex), line) + return re.findall(re.compile("%s\w+" % envregex), line) return [] def check_envs(build_env, board_envs, config): From 08fec869a520940ecec50e232ea7adf4a6aac9cf Mon Sep 17 00:00:00 2001 From: ellensp Date: Thu, 18 Mar 2021 01:08:52 +1300 Subject: [PATCH 3/4] update check_envs to use osregex --- buildroot/share/PlatformIO/scripts/preflight-checks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/preflight-checks.py b/buildroot/share/PlatformIO/scripts/preflight-checks.py index 1d9ecc293ef7..f64f0178ab8f 100644 --- a/buildroot/share/PlatformIO/scripts/preflight-checks.py +++ b/buildroot/share/PlatformIO/scripts/preflight-checks.py @@ -20,8 +20,8 @@ def get_envs_for_board(board, envregex): return re.findall(re.compile("%s\w+" % envregex), line) return [] -def check_envs(build_env, board_envs, config): - if build_env in board_envs: +def check_envs(build_env, board_envs, config, envregex): + if any((match := re.compile("%s%s" % (envregex,build_env)).match(x)) for x in board_envs): return True ext = config.get(build_env, 'extends', default=None) if ext: @@ -56,7 +56,7 @@ def check_envs(build_env, board_envs, config): motherboard = env['MARLIN_FEATURES']['MOTHERBOARD'] board_envs = get_envs_for_board(motherboard, osregex) config = env.GetProjectConfig() -result = check_envs(build_env, board_envs, config) +result = check_envs(build_env, board_envs, config, osregex) if not result: err = "Error: Build environment '%s' is incompatible with %s. Use one of these: %s" % \ From 6c9fe44883b5578fb0a223046bca5fbc62f7477e Mon Sep 17 00:00:00 2001 From: ellensp Date: Thu, 18 Mar 2021 01:22:50 +1300 Subject: [PATCH 4/4] dont use python 3.8 code... --- buildroot/share/PlatformIO/scripts/preflight-checks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildroot/share/PlatformIO/scripts/preflight-checks.py b/buildroot/share/PlatformIO/scripts/preflight-checks.py index f64f0178ab8f..8c30c5e261aa 100644 --- a/buildroot/share/PlatformIO/scripts/preflight-checks.py +++ b/buildroot/share/PlatformIO/scripts/preflight-checks.py @@ -21,7 +21,7 @@ def get_envs_for_board(board, envregex): return [] def check_envs(build_env, board_envs, config, envregex): - if any((match := re.compile("%s%s" % (envregex,build_env)).match(x)) for x in board_envs): + if any((re.compile("%s%s" % (envregex,build_env)).match(x)) for x in board_envs): return True ext = config.get(build_env, 'extends', default=None) if ext: