From patchwork Mon May 18 15:58:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [6, of, 8, py3-cleanup] run-tests: insist that if people use Python 3, they use 3.5.x From: Augie Fackler X-Patchwork-Id: 9133 Message-Id: <22ba83915d7a737ec293.1431964725@augie-macbookair2.roam.corp.google.com> To: mercurial-devel@selenic.com Date: Mon, 18 May 2015 11:58:45 -0400 # HG changeset patch # User Augie Fackler # Date 1431912364 14400 # Sun May 17 21:26:04 2015 -0400 # Node ID 22ba83915d7a737ec293c9f602e0fad8da356490 # Parent de8390275f7448bb48e7631f4f98ea422b2daec0 run-tests: insist that if people use Python 3, they use 3.5.x We depend on both stdlib functionality (difflib.diff_bytes) and language behavior (bytes formatting) introduced in 3.5, so let's try and prevent some useless bug reports before they happen. diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -78,9 +78,13 @@ except ImportError: processlock = threading.Lock() -if sys.version_info > (3, 0, 0): +if sys.version_info > (3, 5, 0): PYTHON3 = True xrange = range # we use xrange in one place, and we'd rather not use range +elif sys.version_info >= (3, 0, 0): + print('%s is only supported on Python 3.5+ and 2.6-2.7, not %s' % + (sys.argv[0], '.'.join(str(v) for v in sys.version_info[:3]))) + sys.exit(70) # EX_SOFTWARE from `man 3 sysexit` else: PYTHON3 = False