This repository has been archived by the owner on Jul 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.py
54 lines (45 loc) · 1.85 KB
/
install.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
#!/usr/bin/env python
from __future__ import print_function
import os
import os.path
import subprocess
LOCAL = True
# Setup ROS dependencies
rosdep_list_default = "/etc/ros/rosdep/sources.list.d/20-default.list"
if os.path.exists(rosdep_list_default):
shellstr = "sudo rm " + rosdep_list_default
subprocess.check_call(shellstr,shell=True)
shellstr = "sudo rosdep init"
subprocess.check_call(shellstr,shell=True)
rosdep_list_custom = "/etc/ros/rosdep/sources.list.d/11-custom.list"
if os.path.exists(rosdep_list_custom):
shellstr = "sudo rm " + rosdep_list_custom
subprocess.check_call(shellstr,shell=True)
if not LOCAL:
shellstr = 'echo "yaml https://bitbucket.org/api/1.0/repositories/peterpolidoro/fs/raw/tip/rosdep.yaml" | sudo tee ' + rosdep_list_custom
else:
rosdep_yaml = 'yaml file://' + os.path.join(os.environ['FS_NAME'],'rosdep.yaml')
shellstr = 'echo ' + rosdep_yaml + ' | sudo tee ' + rosdep_list_custom
subprocess.check_call(shellstr,shell=True)
shellstr = "rosdep update"
subprocess.check_call(shellstr,shell=True)
# Install command line control scripts into ~/bin
script_dict = {'fs': 'fs_computer_admin/scripts/fs_control'}
bin_dir = os.path.join(os.environ['HOME'],'bin')
print('installing scripts into ~/bin')
for name, script in script_dict.iteritems():
src = os.path.join(os.environ['FS_NAME'],script)
dst = os.path.join(bin_dir,name)
if os.path.islink(dst):
print('removing symbolic link {0}'.format(dst))
os.unlink(dst)
print(' {0} -> {1}'.format(src,dst))
os.symlink(src,dst)
# Setup virtual env
virtualenv = os.environ['FS_PYTHON_VIRTUALENV']
if os.path.exists(virtualenv):
print("Removing " + virtualenv)
shellstr = "rm -rf " + virtualenv
subprocess.check_call(shellstr,shell=True)
shellstr = "virtualenv --system-site-packages " + virtualenv
subprocess.check_call(shellstr,shell=True)