hghave: byteify the `regexp` arg to `matchoutput()`
This started failing in CI because a str was passed. All other callers already
pass bytes, and it's not clear why this started failing with a MR to use
`setuptools-scm` to derive the version when building. Clearly the
`if checks["hg09"][0]()` prior to these usages were working before, and that's
how it was overlooked. But that check apparently continued to work for me
locally in both Linux and Windows, as I can only hit this issue in CI.
--- a/tests/hghave.py Fri Oct 25 11:15:29 2024 +0200
+++ b/tests/hghave.py Sun Jan 12 19:55:06 2025 -0500
@@ -141,7 +141,7 @@
return env
-def matchoutput(cmd, regexp, ignorestatus=False):
+def matchoutput(cmd, regexp: bytes, ignorestatus=False):
"""Return the match object if cmd executes successfully and its output
is matched by the supplied regular expression.
"""
@@ -386,21 +386,23 @@
def has_hg08():
if checks["hg09"][0]():
return True
- return matchoutput('hg help annotate 2>&1', '--date')
+ return matchoutput('hg help annotate 2>&1', b'--date')
@check("hg07", "Mercurial >= 0.7")
def has_hg07():
if checks["hg08"][0]():
return True
- return matchoutput('hg --version --quiet 2>&1', 'Mercurial Distributed SCM')
+ return matchoutput(
+ 'hg --version --quiet 2>&1', b'Mercurial Distributed SCM'
+ )
@check("hg06", "Mercurial >= 0.6")
def has_hg06():
if checks["hg07"][0]():
return True
- return matchoutput('hg --version --quiet 2>&1', 'Mercurial version')
+ return matchoutput('hg --version --quiet 2>&1', b'Mercurial version')
@check("gettext", "GNU Gettext (msgfmt)")