pre-upload: require Python 2.7.5+ and 3.4+
We def don't work with Python 2.6 or earlier, and versions before
2.7.5 have a signal bug that we've been working around. Since that
was released in 2013 (6 years ago), lets just require newer Python
so we can drop the workarounds.
Similarly, we def don't work with Python 3.3 or earlier, and versions
before 3.4 have that same signaling bug. It's unclear if we even run
on Python 3.4, but lets set the bar low for now.
Bug: 142671918
Test: `repo upload` passes
Change-Id: Ie259d4f67f55a18216927a911c04e9e00e0562ef
diff --git a/pre-upload.py b/pre-upload.py
index 01cf3a3..0862dea 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -26,6 +26,19 @@
import os
import sys
+
+# Assert some minimum Python versions as we don't test or support any others.
+# We only support Python 2.7, and require 2.7.5+/3.4+ to include signal fix:
+# https://bugs.python.org/issue14173
+if sys.version_info < (2, 7, 5):
+ print('repohooks: error: Python-2.7.5+ is required', file=sys.stderr)
+ sys.exit(1)
+elif sys.version_info.major == 3 and sys.version_info < (3, 4):
+ # We don't actually test <Python-3.6. Hope for the best!
+ print('repohooks: error: Python-3.4+ is required', file=sys.stderr)
+ sys.exit(1)
+
+
_path = os.path.dirname(os.path.realpath(__file__))
if sys.path[0] != _path:
sys.path.insert(0, _path)