-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_package.py
executable file
·56 lines (40 loc) · 1.54 KB
/
install_package.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
52
53
54
55
56
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import subprocess
import sys
py_version = sys.version
print(py_version)
if py_version[:4] == '3.9' or py_version[:4] == '3.10' or py_version[:4] == '3.11':
py_requires = 'python' + sys.version[:4]
else:
py_requires = 'python3.8'
print(py_requires)
file = os.getcwd()
#subprocess.run(["cd",file]), check=True, stdout=subprocess.PIPE).stdout
os.system('cd ' + file)
os.system('./make_version.sh')
print("version file updated")
print('*'*100)
# subprocess.run(["git", "add", "."], check=True, stdout=subprocess.PIPE).stdout
# subprocess.run(["git", "commit", "-am", "Bug fix commit"], check=True, stdout=subprocess.PIPE).stdout
# print('git commit done')
subprocess.run(["git", "pull"], check=True, stdout=subprocess.PIPE).stdout
print('git pull done')
print('*'*100)
subprocess.run(["git", "push"], check=True, stdout=subprocess.PIPE).stdout
print('*'*100)
print('removing dist and build folders')
if os.path.exists(file+'/dist'):
os.system('sudo rm -rf '+file+'/dist')
os.system('sudo rm -rf '+file+'/build')
#subprocess.run(["ls"]),check=True, stdout=subprocess.PIPE).stdout
os.system("ls")
os.system(py_requires + ' -m build')
print('*'*100)
print('wheel built')
print(py_requires + ' -m pip install '+file + '/dist/' +os.listdir(file +'/dist')[-1] + ' --break-system-packages')
os.system(py_requires + ' -m pip install '+file + '/dist/' +os.listdir(file +'/dist')[-1] + ' --break-system-packages')
print('package installed')
print('*'*100)
os.system(py_requires + ' -m twine upload dist/*')