changeset 49267:f639982dfd00 stable

hghave: make black version regex work with newer versions of black Black commit 117891878e5be4d6b771ae5de299e51b679cea27 (included in black >= 21.11b0) dropped the string "version " from the output of "black --version". To make the regex work with newer black versions, make matching of "version " optional.
author Manuel Jacob <me@manueljacob.de>
date Sun, 22 May 2022 01:48:20 +0200
parents 13c37f1c7c4b
children a31245a984f2
files tests/hghave.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/hghave.py	Tue May 24 14:29:44 2022 +0200
+++ b/tests/hghave.py	Sun May 22 01:48:20 2022 +0200
@@ -1123,7 +1123,7 @@
 @check('black', 'the black formatter for python (>= 20.8b1)')
 def has_black():
     blackcmd = 'black --version'
-    version_regex = b'black, version ([0-9a-b.]+)'
+    version_regex = b'black, (?:version )?([0-9a-b.]+)'
     version = matchoutput(blackcmd, version_regex)
     sv = distutils.version.StrictVersion
     return version and sv(_bytes2sys(version.group(1))) >= sv('20.8b1')