forked from orig74/DroneSimLab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.py
executable file
·68 lines (52 loc) · 2.49 KB
/
build.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
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env python3
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
import os,sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--skip_ue4_editor", help="skip install and build unreal engine editor",default=False,action='store_true')
args = parser.parse_args()
print('skip unreal engine option =',args.skip_ue4_editor)
###params
req_docker_images=['ros_image_indigo','ros_image_kinetic','python3_dev','sitl_image']
if not args.skip_ue4_editor:
req_docker_images.append('unreal_engine_4')
## TODO: check prerequisits
# tmux docker nvidia
#git update sub modules
games_path='https://studweb.cosc.canterbury.ac.nz/~oga13/ue4_games/'
games_names=['game_demo']
print("update submodules...")
submodules=map(lambda x:x.split('=')[1].strip(),os.popen('grep path .gitmodules').readlines())
for submodule in submodules:
if args.skip_ue4_editor and 'UnrealEngine' in submodule:
continue
print('updating submodule:', submodule)
assert(os.system("git submodule update --init --recursive "+submodule)==0)
print("downloading baked games...")
for game_name in games_names:
md5=os.popen('curl '+games_path+game_name+'.md5').read().split()[0]
assert(len(md5)==32)
game_local_dir='baked_games/'+game_name
if not os.path.isdir(game_local_dir):
os.makedirs(game_local_dir)
if not os.path.isfile(game_local_dir+'/done'):
cmd="curl -o "+game_local_dir+'/'+game_name+'.tgz '+games_path+'/'+game_name+'.tgz'
print('Downloading command:',cmd)
assert(os.system(cmd)==0)
assert(os.system("cd "+game_local_dir+" && tar xzf "+game_name+'.tgz')==0)
assert(os.system("rm "+game_local_dir+'/'+game_name+'.tgz')==0)
open(game_local_dir+'/done','w')
print("building docker images...")
assert(os.system("docker images > /dev/null")==0) #just to see if have the right preveliges
current_docker_images=map(lambda x:x.strip(),os.popen('docker images |cut -d" " -f 1').readlines())
if 'unreal_engine_4' in req_docker_images:
assert(os.system("cd dockers/unreal_engine_4 && ./prep_unreal")==0)
for docker_image in req_docker_images:
if docker_image not in current_docker_images:
print('building image ',docker_image)
assert(os.system('cd dockers/'+docker_image+' && ../build')==0)
print("install ros...")
#if not os.path.isdir('ros/catkin_mavros'):
# os.mkdir('ros/catkin_mavros')
assert(os.system('''cd dockers/ros_image_indigo && ./run_image.sh '-c "/DroneLab/scripts/make_catkin.sh"' ''')==0)
print("done!")