Require minimum PlatformIO version (#20361)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Co-authored-by: Jason Smith <jason.inet@gmail.com>
This commit is contained in:
Victor Oliveira 2020-12-03 14:23:48 -03:00 committed by Scott Lahteine
parent 20ea00e7f6
commit dab29dddc3

View File

@ -16,6 +16,30 @@ except ImportError:
# PIO >= 4.4 # PIO >= 4.4
from platformio.package.meta import PackageSpec as PackageManager 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") Import("env")
#print(env.Dump()) #print(env.Dump())