repo: add rudimentary version checking

Change-Id: I957775c7ce0821971cc2320597e1a7a31950bcf3
Signed-off-by: Chirayu Desai <cdesai@cyanogenmod.org>
This commit is contained in:
Chirayu Desai 2013-04-16 19:36:09 +05:30
parent fef4ae74e2
commit 51813dfed1

14
repo
View File

@ -108,6 +108,7 @@ repodir = '.repo' # name of repo's private directory
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 @@ else:
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')