release.py
Go to the documentation of this file.
00001 import re
00002 import os
00003 
00004 
00005 def bump_version():
00006     with open("setup.py") as f:
00007         s = f.read()
00008     m = re.search(r'version="(.*)\.(.*)\.(.*)",', s)
00009     v1, v2, v3 = m.groups()
00010     oldv = "{0}.{1}.{2}".format(v1, v2, v3)
00011     newv = "{0}.{1}.{2}".format(v1, v2, str(int(v3) + 1))
00012     print("Current version is: {0}, write new version, ctrl-c to exit".format(oldv))
00013     ans = input(newv)
00014     if ans:
00015         newv = ans
00016     s = s.replace(oldv, newv)
00017     with open("setup.py", "w") as f:
00018         f.write(s)
00019     return newv
00020 
00021 
00022 def release():
00023     v = bump_version()
00024     ans = input("version bumped, commiting?(Y/n)")
00025     if ans in ("", "y", "yes"):
00026         os.system("git add setup.py")
00027         os.system("git commit -m 'new release'")
00028         os.system("git tag {0}".format(v))
00029         ans = input("change committed, push to server?(Y/n)")
00030         if ans in ("", "y", "yes"):
00031             os.system("git push")
00032             os.system("git push --tags")
00033         ans = input("upload to pip?(Y/n)")
00034         if ans in ("", "y", "yes"):
00035             os.system("python setup.py sdist upload")
00036 
00037 
00038 if __name__ == "__main__":
00039     release()


ros_opcua_impl_python_opcua
Author(s): Denis Štogl , Daniel Draper
autogenerated on Sat Jun 8 2019 18:26:23