implemented rosversion more fully and updated ROS version to 1.3.x-trunk

This commit is contained in:
Ken Conley 2010-09-13 23:54:55 +00:00
parent 4769c544d8
commit 344d9ee8aa
2 changed files with 39 additions and 8 deletions

View File

@ -16,4 +16,4 @@ set(ROSPACK_MAKEDIST true)
# variables.
#list(APPEND CPACK_SOURCE_IGNORE_FILES /core/experimental)
rosbuild_make_distribution(1.1.16)
rosbuild_make_distribution(1.3.x-trunk)

View File

@ -28,14 +28,45 @@
# This tool is a place-holder for a future version inspection system.
USAGE = '''USAGE: rosversion <stack>
Available stacks:
ros'''
from __future__ import with_statement
USAGE = "Usage: rosversion <stack>"
import os
import sys
import re
import roslib.stacks
if len(sys.argv) == 2 and sys.argv[1] == 'ros':
print '1.1.16'
def get_source_version(text):
for l in text.split('\n'):
if l.strip().startswith('rosbuild_make_distribution'):
x_re = re.compile(r'[()]')
lsplit = x_re.split(l.strip())
if len(lsplit) < 2:
raise Exception("couldn't find version number in CMakeLists.txt:\n\n%s"%l)
return lsplit[1]
raise Exception("could not locate version number in stack CMakeLists.txt")
if len(sys.argv) == 2:
stack_name = sys.argv[1]
try:
d = roslib.stacks.get_stack_dir(stack_name)
except Exception, e:
print >> sys.stderr, str(e)
sys.exit(1)
cmake_p = os.path.join(d, 'CMakeLists.txt')
if not os.path.isfile(cmake_p):
print '<unversioned>'
else:
with open(cmake_p) as f:
text = f.read()
try:
print get_source_version(text)
except Exception, e:
print >> sys.stderr, str(e)
sys.exit(1)
else:
print >> sys.stderr, USAGE
sys.exit(-1)