Merge "Some fixes for supporting python3"
diff --git a/repo b/repo
index c348474..791e40c 100755
--- a/repo
+++ b/repo
@@ -108,6 +108,7 @@
S_repo = 'repo' # special repo repository
S_manifests = 'manifests' # special manifest repository
REPO_MAIN = S_repo + '/main.py' # main script
+MIN_PYTHON_VERSION = (2, 6) # minimum supported python version
import optparse
@@ -129,6 +130,19 @@
urllib.request = urllib2
urllib.error = urllib2
+# Python version check
+ver = sys.version_info
+if ver[0] == 3:
+ print('error: Python 3 support is not fully implemented in repo yet.\n'
+ 'Please use Python 2.6 - 2.7 instead.',
+ file=sys.stderr)
+ sys.exit(1)
+if (ver[0], ver[1]) < MIN_PYTHON_VERSION:
+ print('error: Python version %s unsupported.\n'
+ 'Please use Python 2.6 - 2.7 instead.'
+ % sys.version.split(' ')[0], file=sys.stderr)
+ sys.exit(1)
+
home_dot_repo = os.path.expanduser('~/.repoconfig')
gpg_dir = os.path.join(home_dot_repo, 'gnupg')