-
Notifications
You must be signed in to change notification settings - Fork 165
/
Tiltfile
27 lines (24 loc) · 1.23 KB
/
Tiltfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
def min_tilt_version(min_version):
# this assumes that the tit version command always returns
# v0.13.0, built 2020-04-01
# Also supports dev versions
# v0.13.0-dev, built 2020-04-03
tilt_bin = os.environ.get('TILT_BIN', 'tilt')
ver_string = str(local('%s version' % tilt_bin, quiet=True))
# Clean out the version file so its in the format 0.13.0
versions = ver_string.split(', ')
# pull first string and remove the `v` and `-dev`
version = versions[0].replace('-dev', '').replace('v', '')
# Python allows you to compare two tuples
# (0, 12, 0) < (0, 12, 1)
tup_version = _version_tuple(version)
tup_min_version = _version_tuple(min_version)
if tup_version < tup_min_version:
print('+--+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+')
print('| Tilt Version is out of date! |')
print('| Please upgrade https://docs.tilt.dev/upgrade.html |')
print('+--+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+')
fail('Tilt version is out of date minimum required version is [%s]' % min_version)
# Private methods
def _version_tuple(v):
return [int(str_num) for str_num in v.split(".")]