| # Usage: ./update_compatibility_version.py <MAJOR>.<MINOR>.<MICRO> [<RC version>] |
| # ./update_compatibility_version.py 3.7.1 |
| from xml.dom import minidom |
| if len(sys.argv) < 2 or len(sys.argv) > 3: |
| [ERROR] Please specify a version. |
| ./update_version.py <MAJOR>.<MINOR>.<MICRO> [<RC version>] |
| ./update_version.py 3.7.1 2 |
| NEW_VERSION = sys.argv[1] |
| NEW_VERSION_INFO = NEW_VERSION.split('.') |
| if len(NEW_VERSION_INFO) != 3: |
| [ERROR] Version must be in the format <MAJOR>.<MINOR>.<MICRO> |
| ./update_version.py 3.7.3 |
| RC_VERSION = int(sys.argv[2]) |
| # Do not update compatibility versions for rc release |
| def RewriteTextFile(filename, line_rewriter): |
| lines = open(filename, 'r').readlines() |
| updated_lines.append(line_rewriter(line)) |
| if lines == updated_lines: |
| print '%s was not updated. Please double check.' % filename |
| f.write(''.join(updated_lines)) |
| RewriteTextFile('tests.sh', |
| 'LAST_RELEASED=%s' % NEW_VERSION, |