handling missing ROS_ROOT/bin in PATH better

This commit is contained in:
Tully Foote 2009-12-02 04:09:10 +00:00
parent 5f73e8e6c4
commit 913fa6910f
1 changed files with 13 additions and 6 deletions

View File

@ -36,17 +36,24 @@ import sys
import subprocess
def assert_rospack_built():
if os.path.exists(os.path.join(os.environ["ROS_ROOT"], "bin/rospack")):
return True
else:
if not os.path.exists(os.path.join(os.environ["ROS_ROOT"], "bin/rospack")):
print "Rosmake detected that rospack was not built. Building it for you because it is required."
return subprocess.check_call(["make", "-C", os.path.join(os.environ["ROS_ROOT"], "tools/rospack")])
if subprocess.call(["make", "-C", os.path.join(os.environ["ROS_ROOT"], "tools/rospack")]) :
print "Rospack failed to build"
return False
if subprocess.call(["which", "rospack"]):
print "Rospack not in path. Please add ROS_ROOT/bin to PATH"
return False
else:
print "which rospack passed"
return True
## make sure that rospack is built, it is a requirement for rosmake
assert_rospack_built()
if not assert_rospack_built():
sys.exit(-1)
from ros import rosmake