release.py
Go to the documentation of this file.
1 import re
2 import os
3 
4 
6  with open("setup.py") as f:
7  s = f.read()
8  m = re.search(r'version="(.*)\.(.*)\.(.*)",', s)
9  v1, v2, v3 = m.groups()
10  oldv = "{0}.{1}.{2}".format(v1, v2, v3)
11  newv = "{0}.{1}.{2}".format(v1, v2, str(int(v3) + 1))
12  print("Current version is: {0}, write new version, ctrl-c to exit".format(oldv))
13  ans = input(newv)
14  if ans:
15  newv = ans
16  s = s.replace(oldv, newv)
17  with open("setup.py", "w") as f:
18  f.write(s)
19  return newv
20 
21 
22 def release():
23  v = bump_version()
24  ans = input("version bumped, commiting?(Y/n)")
25  if ans in ("", "y", "yes"):
26  os.system("git add setup.py")
27  os.system("git commit -m 'new release'")
28  os.system("git tag {0}".format(v))
29  ans = input("change committed, push to server?(Y/n)")
30  if ans in ("", "y", "yes"):
31  os.system("git push")
32  os.system("git push --tags")
33  ans = input("upload to pip?(Y/n)")
34  if ans in ("", "y", "yes"):
35  os.system("python setup.py sdist upload")
36 
37 
38 if __name__ == "__main__":
39  release()
def release()
Definition: release.py:22
def bump_version()
Definition: release.py:5


ros_opcua_impl_python_opcua
Author(s): Denis Štogl , Daniel Draper
autogenerated on Tue Jan 19 2021 03:12:44