forked from ofek/coincurve
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.py
40 lines (28 loc) · 835 Bytes
/
release.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
import os
import subprocess
import sys
import appdirs
def main():
here = os.path.dirname(os.path.abspath(__file__))
os.chdir(here)
version = sys.argv[-1]
delete = not not sys.argv[-2] == '-d'
delete_only = not not sys.argv[-2] == '--d'
try:
subprocess.call('git -h')
git_path = 'git'
except:
git_path = None
if git_path is None:
raise OSError('Unable to find git executable.')
cmds = ['{0} tag -a {1} -m "Version {1}"'.format(git_path, version), '{} push origin {}'.format(git_path, version)]
delete_cmd = '{} tag -d {}'.format(git_path, version)
if delete:
cmds.insert(0, delete_cmd)
elif delete_only:
cmds = [delete_cmd]
for cmd in cmds:
subprocess.call(cmd)
print(cmds)
if __name__ == '__main__':
main()