Skip to content

Commit 6aa079c

Browse files
committed
1.0.0 Release
1 parent 2b8af90 commit 6aa079c

2 files changed

Lines changed: 59 additions & 1 deletion

File tree

kepconfig/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# license information.
55
# --------------------------------------------------------------------------
66

7-
7+
__version__ = "1.0.0"
88
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
99
from . import connection, error
1010

release.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import re
2+
import os
3+
4+
file_location = "kepconfig/__init__.py"
5+
version_re_string = "([0-9]+)\.([0-9]+)\.([0-9]+$|[0-9]+[ab][0-9]+)"
6+
version_search = re.compile(r'__version__ = "'+ version_re_string + '"')
7+
version_check = re.compile(version_re_string)
8+
9+
def bump_version():
10+
with open(file_location) as f:
11+
s = f.read()
12+
m = version_search.search(s)
13+
v1, v2, v3 = m.groups()
14+
oldv = "{0}.{1}.{2}".format(v1, v2, v3)
15+
ans = input("Current version of kepconfig is: {0} \nUpdate new version to? (ctrl-c to exit): ".format(oldv))
16+
if ans:
17+
m = version_check.search(ans)
18+
if (m==None):
19+
print("Version must be in format major.minor.patch (1.0.0 or 1.0.0a1) format. Exiting...")
20+
exit()
21+
newv = ans
22+
else:
23+
print("Please enter updated version number. Exiting...")
24+
exit()
25+
print("\n"+ "Updating " + file_location + " version to {0}.".format(newv))
26+
s = s.replace(oldv, newv)
27+
with open(file_location, "w") as f:
28+
f.write(s)
29+
return newv
30+
31+
32+
def release():
33+
v = bump_version()
34+
ans = input("Version updated, commit changes?(y/n)")
35+
if ans.lower() in ("y", "yes"):
36+
os.system("git add " + file_location)
37+
os.system('git commit -m \"{} Release\"'.format(v))
38+
os.system("git tag {0}".format(v))
39+
ans = input("Change committed, push to server? (y/n)")
40+
if ans.lower() in ("y", "yes"):
41+
# os.system("git push")
42+
# os.system("git push --tags")
43+
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 setup.py sdist bdist_wheel")
49+
50+
# Test PyPi Server
51+
os.system("twine upload --repository testpypi dist/*")
52+
53+
#Production PyPi Server
54+
# os.system("twine upload dist/*")
55+
56+
57+
if __name__ == "__main__":
58+
release()

0 commit comments

Comments
 (0)