diff options
| -rwxr-xr-x | main.py | 28 |
1 files changed, 28 insertions, 0 deletions
| @@ -71,6 +71,34 @@ from subcmds import all_commands | |||
| 71 | if not is_python3(): | 71 | if 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. | ||
| 83 | MIN_PYTHON_VERSION_SOFT = (3, 6) | ||
| 84 | MIN_PYTHON_VERSION_HARD = (3, 4) | ||
| 85 | |||
| 86 | if 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) | ||
| 90 | else: | ||
| 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 | |||
| 74 | global_options = optparse.OptionParser( | 102 | global_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) |
