MCPcopy Create free account
hub / github.com/apache/cloudstack / replaceVersion

Function replaceVersion

tools/marvin/mvn-setup.py:32–42  ·  view source on GitHub ↗

replace VERSION in setup.py

(fname, version)

Source from the content-addressed store, hash-verified

30
31
32def replaceVersion(fname, version):
33 """replace VERSION in setup.py"""
34 with open(fname, 'r') as f:
35 content = f.read()
36 needle = '\nVERSION\s*=\s*[\'"][^\'"]*[\'"]'
37 # Ensure the version is PEP440 compliant
38 version = version.replace('-', '+', 1)
39 replacement = '\nVERSION = "%s"' % version
40 content = re.sub(needle, replacement, content, 1)
41 with open(fname, 'w') as f:
42 f.write(content)
43
44
45def runSetupScript(args):

Callers 1

mvn-setup.pyFile · 0.85

Calls 3

replaceMethod · 0.80
writeMethod · 0.65
readMethod · 0.45

Tested by

no test coverage detected