bloaty/third_party/protobuf/update_compatibility_version.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # Usage: ./update_compatibility_version.py <MAJOR>.<MINOR>.<MICRO> [<RC version>]
3 #
4 # Example:
5 # ./update_compatibility_version.py 3.7.1
6 
7 import datetime
8 import re
9 import sys
10 from xml.dom import minidom
11 
12 if len(sys.argv) < 2 or len(sys.argv) > 3:
13  print """
14 [ERROR] Please specify a version.
15 
16 ./update_version.py <MAJOR>.<MINOR>.<MICRO> [<RC version>]
17 
18 Example:
19 ./update_version.py 3.7.1 2
20 """
21  exit(1)
22 
23 NEW_VERSION = sys.argv[1]
24 NEW_VERSION_INFO = NEW_VERSION.split('.')
25 if len(NEW_VERSION_INFO) != 3:
26  print """
27 [ERROR] Version must be in the format <MAJOR>.<MINOR>.<MICRO>
28 
29 Example:
30 ./update_version.py 3.7.3
31 """
32  exit(1)
33 
34 if len(sys.argv) > 2:
35  RC_VERSION = int(sys.argv[2])
36  # Do not update compatibility versions for rc release
37  if RC_VERSION != 0:
38  exit(0)
39 
40 def RewriteTextFile(filename, line_rewriter):
41  lines = open(filename, 'r').readlines()
42  updated_lines = []
43  for line in lines:
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))
49  f.close()
50 
51 
52 RewriteTextFile('tests.sh',
53  lambda line : re.sub(
54  r'LAST_RELEASED=.*$',
55  'LAST_RELEASED=%s' % NEW_VERSION,
56  line))
57 
xds_interop_client.int
int
Definition: xds_interop_client.py:113
open
#define open
Definition: test-fs.c:46
update_compatibility_version.RewriteTextFile
def RewriteTextFile(filename, line_rewriter)
Definition: bloaty/third_party/protobuf/update_compatibility_version.py:40
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:48