Update version number to 3.7.1 (#5947)

* Update version number to 3.7.1

* Update version number in port_def.inc
diff --git a/update_version.py b/update_version.py
index dcc2531..4071563 100755
--- a/update_version.py
+++ b/update_version.py
@@ -101,17 +101,13 @@
 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,
       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 GOOGLE_PROTOBUF_MIN_PROTOC_VERSION .*$',
         '#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION %s' % cpp_version,
         line)
@@ -124,7 +120,27 @@
         'static const int kMinHeaderVersionForProtoc = %s;' % cpp_version,
         line)
     return line
-  RewriteTextFile('src/google/protobuf/stubs/common.h', 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():