forked from Varbin/xtea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload.py
43 lines (35 loc) · 1.03 KB
/
upload.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from __future__ import with_statement
import os
import sys
with open("changelog.rst") as cl:
changelog = cl.read()
def git_update():
with open("changelog.rst") as cl:
changelog = cl.read()
lines = changelog.splitlines()
main = lines[6] # News
os.system("git add *")
os.system("git commit -m \"%s\"" % main) # Bad, old py2 syntay
def git_push():
while 1:
if not os.system("git push origin master"):
input("Everthing should be uploaded now...")
break
else:
c = input("Oops! It failed! Try again? [Y/n] ")
print(c)
if c.lower() not in ["y", "yes", "z", "j", "ja", "zes", ""]:
# Z on US keyboard == Y on DE keyboard
break
def git_pull():
os.system("git pull")
if __name__ == "__main__":
if len(sys.argv)==1:
git_update()
git_push()
if "update" in sys.argv:
git_update()
if "pull" in sys.argv:
git_pull()
if "push" in sys.argv:
git_push()