Skip to content

Commit d9e53bb

Browse files
fix: accept 2-part version in release_evidence.py semver validators (#123)
_TAG regex and project_version() fullmatch both required 3-part semver (x.y.z). Updated to accept 2-part (x.y) to match version 1.5.
1 parent 0035083 commit d9e53bb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎scripts/release_evidence.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
PACKAGE = "engraphis"
2525
_SHA256 = re.compile(r"[0-9a-f]{64}\Z")
2626
_COMMIT = re.compile(r"[0-9a-f]{40}\Z")
27-
_TAG = re.compile(r"v([0-9]+\.[0-9]+\.[0-9]+)\Z")
27+
_TAG = re.compile(r"v([0-9]+\.[0-9]+(?:\.[0-9]+)?)\Z")
2828
_SAFE_PATH = re.compile(r"[A-Za-z0-9][A-Za-z0-9._/-]*\Z")
2929
_SECRET_NAME = re.compile(
3030
r"(?:secret|token|password|credential|api[-_]?key|private[-_]?key)", re.IGNORECASE
@@ -105,7 +105,7 @@ def project_version(root: Path) -> str:
105105
version = match.group(1)
106106
except (KeyError, OSError, ValueError) as exc:
107107
raise EvidenceError("pyproject project.version is required") from exc
108-
if not isinstance(version, str) or not re.fullmatch(r"[0-9]+\.[0-9]+\.[0-9]+", version):
108+
if not isinstance(version, str) or not re.fullmatch(r"[0-9]+\.[0-9]+(?:\.[0-9]+)?", version):
109109
raise EvidenceError("project.version must use stable semantic version syntax")
110110
return version
111111

0 commit comments

Comments
 (0)