Skip to content

Commit 0371b2d

Browse files
authored
Merge pull request #4373 from scp-fs2open/fix/ci-re-str-cast
Don't try casting a string to an int
2 parents 263bf57 + 1bae96d commit 0371b2d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

ci/post/main.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,17 @@ def _match_version_number(text, regex):
6262
"""
6363
match = regex.search(text)
6464
return int(match.group(1))
65+
66+
def _match_version_str(text, regex):
67+
"""! Extracts the version component represented by `regex` from `text`
68+
69+
@param [in] `text` Filename with version string 'MAJOR.MINOR.BUILD'
70+
@param [in] `regex` Regex pattern of component to look for
71+
72+
@return The version component as integer
73+
"""
74+
match = regex.search(text)
75+
return match.group(1)
6576

6677

6778
def get_source_version(date_version: datetime, tag_name: str) -> semantic_version.Version:
@@ -84,7 +95,7 @@ def get_source_version(date_version: datetime, tag_name: str) -> semantic_versio
8495
minor = _match_version_number(filetext, MINOR_VERSION_PATTERN)
8596
build = _match_version_number(filetext, BUILD_VERSION_PATTERN)
8697
# revision = _match_version_number(filetext, REVISION_VERSION_PATTERN)
87-
revision_str = _match_version_number(filetext, REVISION_STR_VERSION_PATTERN)
98+
revision_str = _match_version_str(filetext, REVISION_STR_VERSION_PATTERN)
8899

89100
print("Parsing version_override.cmake...")
90101
if "rc" in tag_name.lower():

0 commit comments

Comments
 (0)