-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathdependencies.py
47 lines (39 loc) · 1.16 KB
/
dependencies.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
#!/usr/bin/env python
import os
import sys
import argparse
import subprocess
import platform
is_windows = (platform.system() == 'Windows')
def update_dependencies( upgrade ):
pip_cmd = 'pip3'
print( 'Updating Dependencies...' )
if upgrade:
args = [pip_cmd, "install", "--upgrade", "-r", "requirements.txt"]
else:
args = [pip_cmd, "install", "-r", "requirements.txt"]
print( ' '.join(args) )
subprocess.call( args )
print( 'Removing old compiled files...' )
for root, dirs, files in os.walk( '.' ):
for f in files:
fname = os.path.join( root, f )
if os.path.splitext(fname)[1] == '.pyc':
os.remove( fname )
if __name__ == '__main__':
python_min = (3,7)
if sys.version_info[:len(python_min)] < python_min:
print("Python {} or later is required for RaceDB. Please upgrade".format(python_min))
sys.exit(1)
parser = argparse.ArgumentParser( description='Update RaceDB Dependencies' )
parser.add_argument(
'--upgrade',
action='store_true',
default=False,
)
args = parser.parse_args()
update_dependencies( args.upgrade )
if is_windows:
print( 'Creating Windows desktop shortcut...' )
import CreateShortcut
CreateShortcut.CreateShortcut()