Skip to content

Commit

Permalink
Hornix: Use semantic versioning regex for version extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
blishko committed Nov 22, 2024
1 parent 0a3697c commit 763fa91
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions benchexec/tools/hornix.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ def executable(self, tool_locator):

def version(self, executable):
output = self._version_from_tool(executable, arg="--version")
version_pattern = r"\d+\.\d+\.\d+"
match = re.search(version_pattern, output)

# regex for semantic versioning taken from https://semver.org
semantic_versioning_pattern = r"(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?"
match = re.search(semantic_versioning_pattern, output)
return match.group(0) if match else ""

def name(self):
Expand Down

0 comments on commit 763fa91

Please sign in to comment.