This repository has been archived by the owner on Jan 4, 2023. It is now read-only.
forked from zhuminjie/OpenSeesPy
-
Notifications
You must be signed in to change notification settings - Fork 2
/
update_version.py
51 lines (39 loc) · 1.5 KB
/
update_version.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
44
45
46
47
48
49
50
51
import subprocess
import shutil
import os
import os.path
import sys
import glob
def update_version(version):
# change to script's folder
os.chdir(os.path.dirname(os.path.abspath(__file__)))
# pull from OpenSees main repo
subprocess.run(['git', 'subtree', 'pull', '--prefix',
'opensees', 'https://github.com/OpenSees/OpenSees',
'master', '--squash'])
# pull from OpenSeesPyDoc main repo
subprocess.run(['git', 'subtree', 'pull', '--prefix',
'openseespy-docs',
'https://github.com/zhuminjie/OpenSeesPyDoc',
'master', '--squash'])
# change pip version
with open('openseespy-pip/openseespy/version.py', 'w') as fd:
fd.write(f'version = "{version}"')
with open('openseespylinux-pip/openseespylinux/version.py', 'w') as fd:
fd.write(f'version = "{version}"')
with open('openseespywin-pip/openseespywin/version.py', 'w') as fd:
fd.write(f'version = "{version}"')
# commit pip version
subprocess.run(['git', 'add', 'openseespy-pip'])
subprocess.run(['git', 'add', 'openseespylinux-pip'])
subprocess.run(['git', 'add', 'openseespywin-pip'])
subprocess.run(['git', 'commit', '-m',
f'update version {version}'])
# push to github
subprocess.run(['git', 'push'])
if __name__ == '__main__':
if len(sys.argv) < 2:
print('update_version version')
exit()
version = sys.argv[1]
update_version(version)