def list_rosinstalls(track):
    response = urllib2.urlopen('%s/%s.yaml' % (settings.get_rosinstall_database_uri(), track))
    rosinstalls = yaml.load(response.read())
    sorted_rosinstalls = rosinstalls.keys()
    sorted_rosinstalls.sort()
    for r in sorted_rosinstalls:
        console.pretty_print(" " + r + ": ", console.cyan)
        console.pretty_println("%s" % rosinstalls[r], console.yellow)
Пример #2
0
def list_rosinstalls(track):
    response = urllib2.urlopen('%s/%s.yaml' %
                               (settings.get_rosinstall_database_uri(), track))
    rosinstalls = yaml.load(response.read())
    sorted_rosinstalls = rosinstalls.keys()
    sorted_rosinstalls.sort()
    for r in sorted_rosinstalls:
        console.pretty_print(" " + r + ": ", console.cyan)
        console.pretty_println("%s" % rosinstalls[r], console.yellow)
Пример #3
0
def init_workspace():
    args = parse_arguments()
    if not args.track:
        args.track = settings.get_default_track()
    if args.list_rosinstalls:
        list_rosinstalls(args.track)
        sys.exit(0)
#    if not which("/opt/ros/" + args.track + "/bin/catkin_init_workspace"):
#        sys.exit("\nCatkin is not installed: 'sudo apt-get install ros-%s-catkin'\n" % args.track)
    if os.path.isabs(args.dir):
        workspace_dir = args.dir
    else:
        workspace_dir = os.path.join(os.getcwd(), args.dir)
    if not os.path.isdir(workspace_dir):
        os.mkdir(workspace_dir)
    if os.path.isdir(os.path.join(workspace_dir, 'src')):
        sys.exit("This workspace is already initialised")
    if args.uri:
        uri = args.uri  # assume its an absolute path or http uri
        if not os.path.isabs(args.uri):
            if os.path.isfile(os.path.join(os.getcwd(), args.uri)):
                uri = os.path.join(os.getcwd(), args.uri)
            else:
                if urlparse.urlparse(args.uri).scheme == "":  # not a http element, let's look up our databas
                    console.pretty_print("Retrieving", console.cyan)
                    console.pretty_print(" %s " % args.uri, console.yellow)
                    console.pretty_print("on track", console.cyan)
                    console.pretty_print(" %s " % args.track, console.yellow)
                    console.pretty_print("from", console.cyan)
                    console.pretty_println(" %s " % settings.get_rosinstall_database_uri(), console.yellow)
                    response = urllib2.urlopen('%s/%s.yaml' % (settings.get_rosinstall_database_uri(), args.track))
                    rosinstalls = yaml.load(response.read())
                    if args.uri in rosinstalls:
                        uri = rosinstalls[args.uri]
                    else:
                        console.logerror("Uri not an absolute path, local file, http or in our rosinstall database.")
                        sys.exit(1)
    else:
        uri = ""
    populate_worskpace(os.path.join(workspace_dir, 'src'), uri)
    print_details(workspace_dir, uri)
Пример #4
0
def get_rosinstall_database(track):
    lookup_track = track
    lookup_database = settings.get_rosinstall_database_uri()
    response = urllib2.urlopen('%s/%s.yaml' % (lookup_database, track))
    rosinstall_database = yaml.load(response.read())
    return rosinstall_database, lookup_track, lookup_database
Пример #5
0
def get_rosinstall_database(track):
    lookup_track = track
    lookup_database = settings.get_rosinstall_database_uri()
    response = urllib2.urlopen('%s/%s.yaml' % (lookup_database, track))
    rosinstall_database = yaml.load(response.read())
    return rosinstall_database, lookup_track, lookup_database