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

Function get_version_string

scripts/dist_utils_old.py:95–106  ·  view source on GitHub ↗

Read __version__ string for an init file.

(init_file)

Source from the content-addressed store, hash-verified

93
94
95def get_version_string(init_file):
96 """
97 Read __version__ string for an init file.
98 """
99
100 with open(init_file, "r") as fp:
101 content = fp.read()
102 version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", content, re.M)
103 if version_match:
104 return version_match.group(1)
105
106 raise RuntimeError("Unable to find version string in %s." % (init_file))
107
108
109# alias for get_version_string

Callers

nothing calls this directly

Calls 2

searchMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected