aboutsummaryrefslogtreecommitdiffstats
path: root/lib/python/qmk/util.py
diff options
context:
space:
mode:
authorzvecr2025-12-01 23:07:33 +0100
committerzvecr2025-12-01 23:07:33 +0100
commitb315b707e60f86d79d34bcb7a15084468117c1a1 (patch)
tree7bbdc5f5d703c28310b4751dd3db280d8f55a6bd /lib/python/qmk/util.py
parente2bf515df4c51c4d2e3b442d23e52d6d43f7f726 (diff)
parente10429baae2a4b3ffec67fe31a5e1ac3212817f0 (diff)
Merge branch 'develop'
Diffstat (limited to 'lib/python/qmk/util.py')
-rw-r--r--lib/python/qmk/util.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/python/qmk/util.py b/lib/python/qmk/util.py
index 8f99410e1d..6da684a577 100644
--- a/lib/python/qmk/util.py
+++ b/lib/python/qmk/util.py
@@ -3,9 +3,12 @@
import contextlib
import multiprocessing
import sys
+import re
from milc import cli
+TRIPLET_PATTERN = re.compile(r'^(\d+)\.(\d+)\.(\d+)')
+
maybe_exit_should_exit = True
maybe_exit_reraise = False
@@ -96,3 +99,10 @@ def parallel_map(*args, **kwargs):
# before the results are returned. Returning a list ensures results are
# materialised before any worker pool is shut down.
return list(map_fn(*args, **kwargs))
+
+
+def triplet_to_bcd(ver: str):
+ m = TRIPLET_PATTERN.match(ver)
+ if not m:
+ return '0x00000000'
+ return f'0x{int(m.group(1)):02d}{int(m.group(2)):02d}{int(m.group(3)):04d}'