File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ def get_version(tag: str) -> str:
55
55
else :
56
56
description_re = r"[0-9.]+-([0-9]+)-(g[0-9a-f]{7,}(?:-dirty)?)"
57
57
match = re .fullmatch (description_re , description )
58
- assert match is not None
58
+ if match is None :
59
+ raise ValueError (f"Unexpected git description: { description } " )
59
60
distance , remainder = match .groups ()
60
61
remainder = remainder .replace ("-" , "." ) # required by PEP 440
61
62
return f"{ tag } .dev{ distance } +{ remainder } "
@@ -75,7 +76,8 @@ def get_commit(tag: str, version: str) -> str:
75
76
# Extract commit from version, falling back to tag if not available.
76
77
version_re = r"[0-9.]+\.dev[0-9]+\+g([0-9a-f]{7,}|unknown)(?:\.dirty)?"
77
78
match = re .fullmatch (version_re , version )
78
- assert match is not None
79
+ if match is None :
80
+ raise ValueError (f"Unexpected version: { version } " )
79
81
(commit ,) = match .groups ()
80
82
return tag if commit == "unknown" else commit
81
83
You can’t perform that action at this time.
0 commit comments