# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1620340823 14400
#      Thu May 06 18:40:23 2021 -0400
# Branch stable
# Node ID 94c0c36299b1a0c4596fbf5655ce9d4580267158
# Parent  5b3513177f2b449ff49f0879d5cf9d81e69a43a6
hghave: fix the definition of `python3` to work on Windows

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.

Differential Revision: https://phab.mercurial-scm.org/D10694

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")