10 from xml.dom
import minidom
12 if len(sys.argv) < 2
or len(sys.argv) > 3:
14 [ERROR] Please specify a version.
16 ./update_version.py <MAJOR>.<MINOR>.<MICRO> [<RC version>]
19 ./update_version.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_version.py 3.7.3
35 RC_VERSION =
int(sys.argv[2])
41 lines =
open(filename,
'r').readlines()
44 updated_lines.append(line_rewriter(line))
45 if lines == updated_lines:
46 print '%s was not updated. Please double check.' % filename
47 f =
open(filename,
'w')
48 f.write(
''.join(updated_lines))
55 'LAST_RELEASED=%s' % NEW_VERSION,