[Git][reproducible-builds/diffoscope][master] Fix Black version detection

Chris Lamb (@lamby) gitlab at salsa.debian.org
Thu Dec 9 17:10:45 UTC 2021



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
3fb091b6 by Brent Spillner at 2021-12-09T17:10:40+00:00
Fix Black version detection

- - - - -


1 changed file:

- tests/test_source.py


Changes:

=====================================
tests/test_source.py
=====================================
@@ -248,7 +248,14 @@ def black_version():
         out = subprocess.check_output(("black", "--version"))
     except subprocess.CalledProcessError as e:
         out = e.output
-    return out.strip().decode("utf-8").rsplit(" ", 1)[-1]
+
+    # black --version format changed starting in 21.11b0. Returning the first
+    # token starting with a decimal digit, since its ordinal position may vary.
+    return [
+        token
+        for token in out.strip().decode("utf-8").split(" ")
+        if token[0].isdigit()
+    ]
 
 
 @skip_unless_tool_is_at_least("black", black_version, "21.4b2")



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/3fb091b61d747a1cff65ff282263f8d4e979fc56

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/3fb091b61d747a1cff65ff282263f8d4e979fc56
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20211209/73fd3733/attachment.htm>


More information about the rb-commits mailing list