From 27754a76dcecc11d428a8fb182c443e4d115433c 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 856a246fba..02cf124942 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 2b1b948119..fa095f704c 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 fe6ae7dba5..5b17c3586f 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 15c953156c..955f002016 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 6b499a8bcd..f89c891323 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: