From 3eddbc7286ce2dd5a14ceb848ef26fd1dd7a3c4c Mon Sep 17 00:00:00 2001 From: Victor Oliveira Date: Thu, 3 Dec 2020 14:23:48 -0300 Subject: [PATCH] Require minimum PlatformIO version (#20361) Co-authored-by: Scott Lahteine Co-authored-by: Jason Smith --- .../PlatformIO/scripts/common-dependencies.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/buildroot/share/PlatformIO/scripts/common-dependencies.py b/buildroot/share/PlatformIO/scripts/common-dependencies.py index f3bc2b9b0..56dc86e63 100644 --- a/buildroot/share/PlatformIO/scripts/common-dependencies.py +++ b/buildroot/share/PlatformIO/scripts/common-dependencies.py @@ -16,6 +16,30 @@ except ImportError: # PIO >= 4.4 from platformio.package.meta import PackageSpec as PackageManager +PIO_VERSION_MIN = (5, 0, 3) +try: + from platformio import VERSION as PIO_VERSION + weights = (1000, 100, 1) + version_min = sum([x[0] * float(re.sub(r'[^0-9]', '.', str(x[1]))) for x in zip(weights, PIO_VERSION_MIN)]) + version_cur = sum([x[0] * float(re.sub(r'[^0-9]', '.', str(x[1]))) for x in zip(weights, PIO_VERSION)]) + if version_cur < version_min: + print() + print("**************************************************") + print("****** An update to PlatformIO is ******") + print("****** required to build Marlin Firmware. ******") + print("****** ******") + print("****** Minimum version: ", PIO_VERSION_MIN, " ******") + print("****** Current Version: ", PIO_VERSION, " ******") + print("****** ******") + print("****** Update PlatformIO and try again. ******") + print("**************************************************") + print() + exit(1) +except SystemExit: + exit(1) +except: + print("Can't detect PlatformIO Version") + Import("env") #print(env.Dump())