MCPcopy Create free account
hub / github.com/StackStorm/st2 / get_version_string

Function get_version_string

scripts/dist_utils.py:125–136  ·  view source on GitHub ↗

Read __version__ string for an init file.

(init_file)

Source from the content-addressed store, hash-verified

123
124
125def get_version_string(init_file):
126 """
127 Read __version__ string for an init file.
128 """
129
130 with open(init_file, "r") as fp:
131 content = fp.read()
132 version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", content, re.M)
133 if version_match:
134 return version_match.group(1)
135
136 raise RuntimeError("Unable to find version string in %s." % (init_file))
137
138
139# alias for get_version_string

Callers

nothing calls this directly

Calls 2

searchMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected