22import os
33
44file_location = "kepconfig/__init__.py"
5- version_re_string = "([0-9]+)\.([0-9]+)\.([0-9]+$|[0-9]+[ ab][0-9]+ )"
5+ version_re_string = "([0-9]+)\.([0-9]+)\.([0-9]+(?:[ ab][0-9])? )"
66version_search = re .compile (r'__version__ = "' + version_re_string + '"' )
77version_check = re .compile (version_re_string )
88
@@ -12,7 +12,7 @@ def bump_version():
1212 m = version_search .search (s )
1313 v1 , v2 , v3 = m .groups ()
1414 oldv = "{0}.{1}.{2}" .format (v1 , v2 , v3 )
15- ans = input ("Current version of kepconfig is: {0 } \n Update new version to? (ctrl-c to exit): " .format (oldv ))
15+ ans = input ("Current version of kepconfig is: {} \n Update new version to? (ctrl-c to exit): " .format (oldv ))
1616 if ans :
1717 m = version_check .search (ans )
1818 if (m == None ):
@@ -22,7 +22,7 @@ def bump_version():
2222 else :
2323 print ("Please enter updated version number. Exiting..." )
2424 exit ()
25- print ("\n " + "Updating " + file_location + " version to {0 }." .format (newv ))
25+ print ("\n " + "Updating " + file_location + " version to {}." .format (newv ))
2626 s = s .replace (oldv , newv )
2727 with open (file_location , "w" ) as f :
2828 f .write (s )
@@ -36,22 +36,24 @@ def release():
3636 os .system ("git add " + file_location )
3737 os .system ('git commit -m \" {} Release\" ' .format (v ))
3838 os .system ("git tag {0}" .format (v ))
39- ans = input ("Change committed, push to server? (y /n)" )
39+ ans = input ("Change committed, push to server? (Y /n)" )
4040 if ans .lower () in ("y" , "yes" ):
4141 # os.system("git push")
4242 # os.system("git push --tags")
4343 os .system ("git push --follow-tags" )
44- ans = input ("upload to pip?(Y/n)" )
45- if ans .lower () in ("y" , "yes" ):
46- # os.system("rm -rf dist/*") #Linux
47- os .system ("RMDIR /S /Q dist" ) #Windows
48- os .system ("python -m build" )
44+ ans = input ("Build dist packages?(Y/n)" )
45+ if ans .lower () in ("y" , "yes" ):
46+ # os.system("rm -rf dist/*") #Linux
47+ os .system ("RMDIR /S /Q dist" ) #Windows
48+ os .system ("python -m build" )
49+ ans = input ("upload to pip?(Y/n)" )
50+ if ans .lower () in ("y" , "yes" ):
4951
50- # Test PyPi Server
51- os .system ("twine upload --repository testpypi dist/*" )
52+ # Test PyPi Server
53+ os .system ("twine upload --repository testpypi dist/*" )
5254
53- #Production PyPi Server
54- # os.system("twine upload dist/*")
55+ #Production PyPi Server
56+ # os.system("twine upload dist/*")
5557
5658
5759if __name__ == "__main__" :
0 commit comments