From 8f4f98582ef5f99db96e383400c3acf85e0eeb52 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 14 Oct 2023 01:10:29 +0545 Subject: [PATCH] main: drop Python 2 check Python 2 can't even parse this code anymore due to syntax changes, so there's no point in checking for it explicitly. Bug: 302871152 Change-Id: I9852ace5f5079d037c60fd3ac490d77e074e6875 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/389434 Commit-Queue: Mike Frysinger Reviewed-by: Aravind Vasudevan Tested-by: Mike Frysinger --- main.py | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/main.py b/main.py index 9c62722f..07c360f4 100755 --- a/main.py +++ b/main.py @@ -86,27 +86,19 @@ logger = RepoLogger(__file__) MIN_PYTHON_VERSION_SOFT = (3, 6) MIN_PYTHON_VERSION_HARD = (3, 6) -if sys.version_info.major < 3: +if sys.version_info < MIN_PYTHON_VERSION_HARD: logger.error( - "repo: error: Python 2 is no longer supported; " + "repo: error: Python version is too old; " "Please upgrade to Python %d.%d+.", *MIN_PYTHON_VERSION_SOFT, ) sys.exit(1) -else: - if sys.version_info < MIN_PYTHON_VERSION_HARD: - logger.error( - "repo: error: Python 3 version is too old; " - "Please upgrade to Python %d.%d+.", - *MIN_PYTHON_VERSION_SOFT, - ) - sys.exit(1) - elif sys.version_info < MIN_PYTHON_VERSION_SOFT: - logger.error( - "repo: warning: your Python 3 version is no longer supported; " - "Please upgrade to Python %d.%d+.", - *MIN_PYTHON_VERSION_SOFT, - ) +elif sys.version_info < MIN_PYTHON_VERSION_SOFT: + logger.error( + "repo: warning: your Python version is no longer supported; " + "Please upgrade to Python %d.%d+.", + *MIN_PYTHON_VERSION_SOFT, + ) KEYBOARD_INTERRUPT_EXIT = 128 + signal.SIGINT MAX_PRINT_ERRORS = 5