2 """Compatibility tests between last released and the current version.
4 Usage: ./update_compatibility_version.py <MAJOR>.<MINOR>.<MICRO> [<RC version>]
5 Example: ./update_compatibility_version.py 3.7.1
8 from __future__
import print_function
12 if len(sys.argv) < 2
or len(sys.argv) > 3:
14 [ERROR] Please specify a version.
16 ./update_compatibility_version.py.py <MAJOR>.<MINOR>.<MICRO> [<RC version>]
19 ./update_compatibility_version.py.py 3.7.1 2
23 NEW_VERSION = sys.argv[1]
24 NEW_VERSION_INFO = NEW_VERSION.split(
'.')
25 if len(NEW_VERSION_INFO) != 3:
27 [ERROR] Version must be in the format <MAJOR>.<MINOR>.<MICRO>
30 ./update_compatibility_version.py.py 3.7.3
35 RC_VERSION =
int(sys.argv[2])
42 lines =
open(filename,
'r').readlines()
45 updated_lines.append(line_rewriter(line))
46 if lines == updated_lines:
47 print(
'%s was not updated. Please double check.' % filename)
48 f =
open(filename,
'w')
49 f.write(
''.join(updated_lines))
54 return re.sub(
r'LAST_RELEASED=.*$',
'LAST_RELEASED=%s' % NEW_VERSION, line)