🔨 Update 'pio vscode init' detection

This commit is contained in:
Scott Lahteine 2021-10-19 02:49:35 -05:00
parent fed72e4607
commit 2c6fe45847
4 changed files with 30 additions and 13 deletions

View File

@ -2,7 +2,12 @@
# common-dependencies.py
# Convenience script to check dependencies and add libs and sources for Marlin Enabled Features
#
import subprocess,os,re
import subprocess,os,re,pioutil
Import("env")
# Detect that 'vscode init' is running
if pioutil.is_vscode_init():
env.Exit(0)
PIO_VERSION_MIN = (5, 0, 3)
try:
@ -31,8 +36,6 @@ except:
from platformio.package.meta import PackageSpec
from platformio.project.config import ProjectConfig
Import("env")
#print(env.Dump())
try:

View File

@ -3,10 +3,15 @@
# Added by HAS_TFT_LVGL_UI to download assets from Makerbase repo
#
Import("env")
import os,requests,zipfile,tempfile,shutil
import os,requests,zipfile,tempfile,shutil,pioutil
url = "https://github.com/makerbase-mks/Mks-Robin-Nano-Marlin2.0-Firmware/archive/master.zip"
zip_path = os.path.join(env.Dictionary("PROJECT_LIBDEPS_DIR"), "mks-assets.zip")
# Detect that 'vscode init' is running
if pioutil.is_vscode_init():
env.Exit(0)
url = "https://github.com/makerbase-mks/Mks-Robin-Nano-Marlin2.0-Firmware/archive/0263cdaccf.zip"
deps_path = env.Dictionary("PROJECT_LIBDEPS_DIR")
zip_path = os.path.join(deps_path, "mks-assets.zip")
assets_path = os.path.join(env.Dictionary("PROJECT_BUILD_DIR"), env.Dictionary("PIOENV"), "assets")
def download_mks_assets():
@ -14,8 +19,8 @@ def download_mks_assets():
r = requests.get(url, stream=True)
# the user may have a very clean workspace,
# so create the PROJECT_LIBDEPS_DIR directory if not exits
if os.path.exists(env.Dictionary("PROJECT_LIBDEPS_DIR")) == False:
os.mkdir(env.Dictionary("PROJECT_LIBDEPS_DIR"))
if os.path.exists(deps_path) == False:
os.mkdir(deps_path)
with open(zip_path, 'wb') as fd:
for chunk in r.iter_content(chunk_size=128):
fd.write(chunk)

View File

@ -0,0 +1,8 @@
#
# buildroot/share/PlatformIO/scripts/pioutil.py
#
# Detect that 'vscode init' is running
def is_vscode_init():
from SCons.Script import COMMAND_LINE_TARGETS
return "idedata" in COMMAND_LINE_TARGETS or "_idedata" in COMMAND_LINE_TARGETS

View File

@ -2,9 +2,13 @@
# preflight-checks.py
# Check for common issues prior to compiling
#
import os,re,sys
import os,re,sys,pioutil
Import("env")
# Detect that 'vscode init' is running
if pioutil.is_vscode_init():
env.Exit(0)
def get_envs_for_board(board):
with open(os.path.join("Marlin", "src", "pins", "pins.h"), "r") as file:
@ -94,7 +98,4 @@ def sanity_check_target():
err = "ERROR: Old files fell into your Marlin folder. Remove %s and try again" % ", ".join(mixedin)
raise SystemExit(err)
# Detect that 'vscode init' is running
from SCons.Script import COMMAND_LINE_TARGETS
if "idedata" not in COMMAND_LINE_TARGETS:
sanity_check_target()
sanity_check_target()