-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
update.py
43 lines (40 loc) · 1.14 KB
/
update.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
import sys, os
import shutil
# https://stackoverflow.com/questions/41836988/git-push-via-gitpython
for root, dirs, files in os.walk(".", topdown=False):
for name in dirs:
if name == '__pycache__':
shutil.rmtree(os.path.join(root, name))
rmtrees = ["products", "data", "static/assets/prodimages","configs"]
for i in rmtrees:
try:
shutil.rmtree(i)
if i == 'logs':
os.mkdir('logs')
except Exception as e:
input(e)
try:
os.remove('setup')
except Exception as e:
input(e)
a = input("LoonaBilling Update Script \n1. Main Branch \n2. Development Branch\n>>> """)
if isinstance(a, int) == False:
raise TypeError
if a == '1':
os.system('git checkout main')
elif a == '2':
os.system('git checkout development')
else:
print('Invalid option')
exit()
os.system('pipreqs . --force')
os.system('git add -A')
os.system('git commit -a')
input('Push enter')
if a == '1':
os.system('git push origin HEAD:main')
elif a == '2':
os.system('git push origin HEAD:development')
else:
print('Invalid option')
exit()