summaryrefslogtreecommitdiffstats
path: root/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'main.py')
-rwxr-xr-xmain.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/main.py b/main.py
index 3efb1c35..ec031a4c 100755
--- a/main.py
+++ b/main.py
@@ -71,6 +71,34 @@ from subcmds import all_commands
71if not is_python3(): 71if not is_python3():
72 input = raw_input # noqa: F821 72 input = raw_input # noqa: F821
73 73
74# NB: These do not need to be kept in sync with the repo launcher script.
75# These may be much newer as it allows the repo launcher to roll between
76# different repo releases while source versions might require a newer python.
77#
78# The soft version is when we start warning users that the version is old and
79# we'll be dropping support for it. We'll refuse to work with versions older
80# than the hard version.
81#
82# python-3.6 is in Ubuntu Bionic.
83MIN_PYTHON_VERSION_SOFT = (3, 6)
84MIN_PYTHON_VERSION_HARD = (3, 4)
85
86if sys.version_info.major < 3:
87 print('repo: warning: Python 2 is no longer supported; '
88 'Please upgrade to Python {}.{}+.'.format(*MIN_PYTHON_VERSION_SOFT),
89 file=sys.stderr)
90else:
91 if sys.version_info < MIN_PYTHON_VERSION_HARD:
92 print('repo: error: Python 3 version is too old; '
93 'Please upgrade to Python {}.{}+.'.format(*MIN_PYTHON_VERSION_SOFT),
94 file=sys.stderr)
95 sys.exit(1)
96 elif sys.version_info < MIN_PYTHON_VERSION_SOFT:
97 print('repo: warning: your Python 3 version is no longer supported; '
98 'Please upgrade to Python {}.{}+.'.format(*MIN_PYTHON_VERSION_SOFT),
99 file=sys.stderr)
100
101
74global_options = optparse.OptionParser( 102global_options = optparse.OptionParser(
75 usage='repo [-p|--paginate|--no-pager] COMMAND [ARGS]', 103 usage='repo [-p|--paginate|--no-pager] COMMAND [ARGS]',
76 add_help_option=False) 104 add_help_option=False)