From patchwork Fri May 7 04:02:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D10694: hghave: fix the definition of `python3` to work on Windows From: phabricator X-Patchwork-Id: 49011 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Fri, 7 May 2021 04:02:08 +0000 mharbison72 created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Both py2 and py3 executables are named `python.exe`, and may or may not be on PATH. So use the dispatcher executable that comes with py3 to fetch the version of the latest py3 executable. This allows at least one relnotes test to run on Windows. REPOSITORY rHG Mercurial BRANCH stable REVISION DETAIL https://phab.mercurial-scm.org/D10694 AFFECTED FILES tests/hghave.py CHANGE DETAILS To: mharbison72, #hg-reviewers Cc: mercurial-patches, mercurial-devel diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -863,7 +863,10 @@ @check("py3exe", "a Python 3.x interpreter is available") def has_python3exe(): - return matchoutput('python3 -V', br'^Python 3.(5|6|7|8|9)') + py = 'python3' + if os.name == 'nt': + py = 'py -3' + return matchoutput('%s -V' % py, br'^Python 3.(5|6|7|8|9)') @check("pure", "running with pure Python code")