From e8af38cc2df433536e6fc584efc251f62e826999 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 17 Apr 2021 14:19:33 -0500 Subject: [PATCH] Skip scripts during 'platformio init' (#21643) --- .../share/PlatformIO/scripts/common-cxxflags.py | 6 ++++++ .../PlatformIO/scripts/common-dependencies-post.py | 7 ++++++- .../share/PlatformIO/scripts/common-dependencies.py | 13 +++++++++---- .../scripts/copy_marlin_variant_to_framework.py | 7 +++++++ .../share/PlatformIO/scripts/preflight-checks.py | 8 +++++++- 5 files changed, 35 insertions(+), 6 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/common-cxxflags.py b/buildroot/share/PlatformIO/scripts/common-cxxflags.py index 856a246fb..02cf12494 100644 --- a/buildroot/share/PlatformIO/scripts/common-cxxflags.py +++ b/buildroot/share/PlatformIO/scripts/common-cxxflags.py @@ -3,6 +3,12 @@ # Convenience script to apply customizations to CPP flags # Import("env") + +# Detect that 'vscode init' is running +from SCons.Script import COMMAND_LINE_TARGETS +if "idedata" in COMMAND_LINE_TARGETS: + env.Exit(0) + env.Append(CXXFLAGS=[ "-Wno-register" #"-Wno-incompatible-pointer-types", diff --git a/buildroot/share/PlatformIO/scripts/common-dependencies-post.py b/buildroot/share/PlatformIO/scripts/common-dependencies-post.py index 2b1b94811..fa095f704 100644 --- a/buildroot/share/PlatformIO/scripts/common-dependencies-post.py +++ b/buildroot/share/PlatformIO/scripts/common-dependencies-post.py @@ -2,8 +2,13 @@ # common-dependencies-post.py # Convenience script to add build flags for Marlin Enabled Features # - Import("env") + +# Detect that 'vscode init' is running +from SCons.Script import COMMAND_LINE_TARGETS +if "idedata" in COMMAND_LINE_TARGETS: + env.Exit(0) + Import("projenv") def apply_board_build_flags(): diff --git a/buildroot/share/PlatformIO/scripts/common-dependencies.py b/buildroot/share/PlatformIO/scripts/common-dependencies.py index fe6ae7dba..5b17c3586 100644 --- a/buildroot/share/PlatformIO/scripts/common-dependencies.py +++ b/buildroot/share/PlatformIO/scripts/common-dependencies.py @@ -2,6 +2,15 @@ # common-dependencies.py # Convenience script to check dependencies and add libs and sources for Marlin Enabled Features # +Import("env") + +#print(env.Dump()) + +# Detect that 'vscode init' is running +from SCons.Script import COMMAND_LINE_TARGETS +if "idedata" in COMMAND_LINE_TARGETS: + env.Exit(0) + import subprocess,os,re PIO_VERSION_MIN = (5, 0, 3) @@ -31,10 +40,6 @@ except: from platformio.package.meta import PackageSpec from platformio.project.config import ProjectConfig -Import("env") - -#print(env.Dump()) - try: verbose = int(env.GetProjectOption('custom_verbose')) except: diff --git a/buildroot/share/PlatformIO/scripts/copy_marlin_variant_to_framework.py b/buildroot/share/PlatformIO/scripts/copy_marlin_variant_to_framework.py index 15c953156..955f00201 100644 --- a/buildroot/share/PlatformIO/scripts/copy_marlin_variant_to_framework.py +++ b/buildroot/share/PlatformIO/scripts/copy_marlin_variant_to_framework.py @@ -1,6 +1,13 @@ # # copy_marlin_variant_to_framework.py # +Import("env") + +# Detect that 'vscode init' is running +from SCons.Script import COMMAND_LINE_TARGETS +if "idedata" in COMMAND_LINE_TARGETS: + env.Exit(0) + import os,shutil from SCons.Script import DefaultEnvironment from platformio import util diff --git a/buildroot/share/PlatformIO/scripts/preflight-checks.py b/buildroot/share/PlatformIO/scripts/preflight-checks.py index 6b499a8bc..f89c89132 100644 --- a/buildroot/share/PlatformIO/scripts/preflight-checks.py +++ b/buildroot/share/PlatformIO/scripts/preflight-checks.py @@ -2,9 +2,15 @@ # preflight-checks.py # Check for common issues prior to compiling # -import os,re,sys Import("env") +# Detect that 'vscode init' is running +from SCons.Script import COMMAND_LINE_TARGETS +if "idedata" in COMMAND_LINE_TARGETS: + env.Exit(0) + +import os,re,sys + def get_envs_for_board(board): with open(os.path.join("Marlin", "src", "pins", "pins.h"), "r") as file: