Index: appengine/components/tools/compile_proto.py |
diff --git a/appengine/components/tools/compile_proto.py b/appengine/components/tools/compile_proto.py |
index e34e15a5f06b3e7dd8478bbef723d034d87e3c7a..d389eab23f0c9b1bcbaa0b0ceff692d23aa4d9ec 100755 |
--- a/appengine/components/tools/compile_proto.py |
+++ b/appengine/components/tools/compile_proto.py |
@@ -15,24 +15,27 @@ import sys |
import tempfile |
+# Directory with this file. |
+THIS_DIR = os.path.dirname(os.path.abspath(__file__)) |
+ |
+ |
# Printed if protoc is missing or too old. |
PROTOC_INSTALL_HELP = r"""Could not find working protocol buffers compiler. |
-To install it on Linux run install_protoc.py. |
+To install it on Linux and Mac run %s. |
-On Windows and Mac you are on your own. |
-""" |
+On Windows you are on your own. |
+""" % (os.path.join(THIS_DIR, 'install_protoc.py')) |
-# Directory with this file. |
-THIS_DIR = os.path.dirname(os.path.abspath(__file__)) |
- |
# Where to look for 'protoc' first (before hitting PATH). install_protoc.py |
# installs protoc there. |
DEFAULT_PROTOC_DIR = os.path.join(THIS_DIR, 'protoc') |
# Minimally required protoc version. |
MIN_SUPPORTED_PROTOC_VERSION = (2, 5, 0) |
+# Maximally supported protoc version. |
+MAX_SUPPORTED_PROTOC_VERSION = (2, 5, 9) |
# Paths that should not be searched for *.proto. |
BLACKLISTED_PATHS = [ |
@@ -183,6 +186,15 @@ def main(args, app_dir=None, import_paths=None, blacklisted_paths=None): |
(existing, expected)) |
sys.stderr.write(PROTOC_INSTALL_HELP) |
return 1 |
+ # Make sure protoc produces code compatible with vendored libprotobuf. |
+ if protoc_version > MAX_SUPPORTED_PROTOC_VERSION: |
+ existing = '.'.join(map(str, protoc_version)) |
+ expected = '.'.join(map(str, MAX_SUPPORTED_PROTOC_VERSION)) |
+ print >> sys.stderr, ( |
+ 'protoc version is too new (%s), expecting at most %s.\n' % |
+ (existing, expected)) |
+ sys.stderr.write(PROTOC_INSTALL_HELP) |
+ return 1 |
# Include default blacklisted paths. |
blacklisted_paths = list(blacklisted_paths or []) |