aboutsummaryrefslogtreecommitdiff
path: root/update_version.py
diff options
context:
space:
mode:
authorAdam Cozzette <acozzette@google.com>2019-03-26 14:32:20 -0700
committerAdam Cozzette <acozzette@google.com>2019-03-26 14:32:20 -0700
commit8645d893aba03f3d5757bfb8b6c1dba9b31baf96 (patch)
tree062c1547c1335e79bc1648b8538192c562fa4d23 /update_version.py
parent5939bc3619ddc446d277ad87a4ac4e47491ea36e (diff)
parent6973c3a5041636c1d8dc5f7f6c8c1f3c15bc63d6 (diff)
downloadprotobuf-8645d893aba03f3d5757bfb8b6c1dba9b31baf96.tar.gz
Merge branch '3.7.x' into merge-3-7-x
Diffstat (limited to 'update_version.py')
-rwxr-xr-xupdate_version.py29
1 files changed, 22 insertions, 7 deletions
diff --git a/update_version.py b/update_version.py
index d2127f4f6..dd01d833c 100755
--- a/update_version.py
+++ b/update_version.py
@@ -101,7 +101,7 @@ def UpdateConfigure():
def UpdateCpp():
cpp_version = '%s00%s00%s' % (
NEW_VERSION_INFO[0], NEW_VERSION_INFO[1], NEW_VERSION_INFO[2])
- def RewriteCpp(line):
+ def RewriteCommon(line):
line = re.sub(
r'^#define GOOGLE_PROTOBUF_VERSION .*$',
'#define GOOGLE_PROTOBUF_VERSION %s' % cpp_version,
@@ -112,10 +112,6 @@ def UpdateCpp():
line)
if NEW_VERSION_INFO[2] == '0':
line = re.sub(
- r'^#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION .*$',
- '#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION %s' % cpp_version,
- line)
- line = re.sub(
r'^#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC .*$',
'#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC %s' % cpp_version,
line)
@@ -132,8 +128,27 @@ def UpdateCpp():
'static const int kMinHeaderVersionForProtoc = %s;' % cpp_version,
line)
return line
- RewriteTextFile('src/google/protobuf/stubs/common.h', RewriteCpp)
- RewriteTextFile('src/google/protobuf/port_def.inc', RewriteCpp)
+ def RewritePortDef(line):
+ line = re.sub(
+ r'^#define PROTOBUF_VERSION .*$',
+ '#define PROTOBUF_VERSION %s' % cpp_version,
+ line)
+ if NEW_VERSION_INFO[2] == '0':
+ line = re.sub(
+ r'^#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC .*$',
+ '#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC %s' % cpp_version,
+ line)
+ line = re.sub(
+ r'^#define PROTOBUF_MIN_PROTOC_VERSION .*$',
+ '#define PROTOBUF_MIN_PROTOC_VERSION %s' % cpp_version,
+ line)
+ line = re.sub(
+ r'^#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION .*$',
+ '#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION %s' % cpp_version,
+ line)
+ return line
+ RewriteTextFile('src/google/protobuf/stubs/common.h', RewriteCommon)
+ RewriteTextFile('src/google/protobuf/port_def.inc', RewritePortDef)
def UpdateCsharp():