MCPcopy Index your code
hub / github.com/StackStorm/st2 / get_version_string

Function get_version_string

st2tests/dist_utils.py:121–132  ·  view source on GitHub ↗

Read __version__ string for an init file.

(init_file)

Source from the content-addressed store, hash-verified

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

Callers 1

setup.pyFile · 0.90

Calls 2

searchMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected