Browse Source

Fix update_version.py, so that PROTOBUF_VERSION is always a 9 digit number.

Rafi Kamal 6 years ago
parent
commit
c9af9a5539

+ 2 - 2
src/google/protobuf/any.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 30010000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 2 - 2
src/google/protobuf/api.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 30010000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 2 - 2
src/google/protobuf/compiler/plugin.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 30010000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 2 - 2
src/google/protobuf/descriptor.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 30010000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 2 - 2
src/google/protobuf/duration.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 30010000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 2 - 2
src/google/protobuf/empty.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 30010000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 2 - 2
src/google/protobuf/field_mask.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 30010000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 4 - 4
src/google/protobuf/port_def.inc

@@ -288,14 +288,14 @@
 
 // Shared google3/opensource definitions. //////////////////////////////////////
 
-#define PROTOBUF_VERSION 30010000
-#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 30010000
-#define PROTOBUF_MIN_PROTOC_VERSION 30010000
+#define PROTOBUF_VERSION 3010000
+#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3010000
+#define PROTOBUF_MIN_PROTOC_VERSION 3010000
 #define PROTOBUF_VERSION_SUFFIX ""
 
 // The minimum library version which works with the current version of the
 // headers.
-#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 30010000
+#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3010000
 
 #if defined(GOOGLE_PROTOBUF_NO_RTTI) && GOOGLE_PROTOBUF_NO_RTTI
 #define PROTOBUF_RTTI 0

+ 2 - 2
src/google/protobuf/source_context.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 30010000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 2 - 2
src/google/protobuf/struct.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 30010000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 4 - 4
src/google/protobuf/stubs/common.h

@@ -81,7 +81,7 @@ namespace internal {
 
 // The current version, represented as a single integer to make comparison
 // easier:  major * 10^6 + minor * 10^3 + micro
-#define GOOGLE_PROTOBUF_VERSION 30010000
+#define GOOGLE_PROTOBUF_VERSION 3010000
 
 // A suffix string for alpha, beta or rc releases. Empty for stable releases.
 #define GOOGLE_PROTOBUF_VERSION_SUFFIX ""
@@ -89,15 +89,15 @@ namespace internal {
 // The minimum header version which works with the current version of
 // the library.  This constant should only be used by protoc's C++ code
 // generator.
-static const int kMinHeaderVersionForLibrary = 30010000;
+static const int kMinHeaderVersionForLibrary = 3010000;
 
 // The minimum protoc version which works with the current version of the
 // headers.
-#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 30010000
+#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3010000
 
 // The minimum header version which works with the current version of
 // protoc.  This constant should only be used in VerifyVersion().
-static const int kMinHeaderVersionForProtoc = 30010000;
+static const int kMinHeaderVersionForProtoc = 3010000;
 
 // Verifies that the headers and libraries are compatible.  Use the macro
 // below to call this.

+ 2 - 2
src/google/protobuf/timestamp.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 30010000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 2 - 2
src/google/protobuf/type.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 30010000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 2 - 2
src/google/protobuf/wrappers.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 30010000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 30010000 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 7 - 7
update_version.py

@@ -24,7 +24,7 @@ Example:
   exit(1)
 
 NEW_VERSION = sys.argv[1]
-NEW_VERSION_INFO = NEW_VERSION.split('.')
+NEW_VERSION_INFO = [int(x) for x in NEW_VERSION.split('.')]
 if len(NEW_VERSION_INFO) != 3:
   print """
 [ERROR] Version must be in the format <MAJOR>.<MINOR>.<MICRO>
@@ -99,7 +99,7 @@ def UpdateConfigure():
 
 
 def UpdateCpp():
-  cpp_version = '%s00%s00%s' % (
+  cpp_version = '%d%03d%03d' % (
     NEW_VERSION_INFO[0], NEW_VERSION_INFO[1], NEW_VERSION_INFO[2])
   def RewriteCommon(line):
     line = re.sub(
@@ -110,7 +110,7 @@ def UpdateCpp():
       r'^#define PROTOBUF_VERSION .*$',
       '#define PROTOBUF_VERSION %s' % cpp_version,
       line)
-    if NEW_VERSION_INFO[2] == '0':
+    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,
@@ -134,7 +134,7 @@ def UpdateCpp():
       r'^#define PROTOBUF_VERSION .*$',
       '#define PROTOBUF_VERSION %s' % cpp_version,
       line)
-    if NEW_VERSION_INFO[2] == '0':
+    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,
@@ -228,7 +228,7 @@ def UpdateJavaScript():
 
 def UpdateMakefile():
   protobuf_version_offset = 11
-  expected_major_version = '3'
+  expected_major_version = 3
   if NEW_VERSION_INFO[0] != expected_major_version:
     print """[ERROR] Major protobuf version has changed. Please update
 update_version.py to readjust the protobuf_version_offset and
@@ -237,8 +237,8 @@ always increasing.
     """
     exit(1)
 
-  protobuf_version_info = '%s:%s:0' % (
-    int(NEW_VERSION_INFO[1]) + protobuf_version_offset, NEW_VERSION_INFO[2])
+  protobuf_version_info = '%d:%d:0' % (
+    NEW_VERSION_INFO[1] + protobuf_version_offset, NEW_VERSION_INFO[2])
   RewriteTextFile('src/Makefile.am',
     lambda line : re.sub(
       r'^PROTOBUF_VERSION = .*$',