def main(): from config import ErosConfig config = ErosConfig() from optparse import OptionParser usage = "\n\ %prog : shows the currently set ros platform\n\ %prog clear : clear the currently set ros platform\n\ %prog create : create a user-defined platform configuration\n\ %prog delete : delete a platform configuration\n\ %prog help : print this help information\n\ %prog list : list available eros and user-defined platforms\n\ %prog select : interactively select a platform configuration\n\ %prog select <str> : directly select the specified platform configuration\n\ %prog validate : attempt to validate a platform (not yet implemented)\n\ \n\ Description: \n\ Create/delete and manage the platform configuration for this ros environment\n\ Location of the user platform directory can be modified via --dir or more \n\ permanently via " + core.eros_config() + "." parser = OptionParser(usage=usage) parser.add_option("-d","--dir", action="store", default=config.user_platforms_dir(), help="location of the user platforms directory.") #parser.add_option("-v","--validate", action="store_true", dest="validate", help="when creating, attempt to validate the configuration") options, args = parser.parse_args() # Configure the user platform directory. user_platform_dir(options.dir) ################### # Show current ################### if not args: show_current_platform() return 0 command = args[0] ################### # Help ################### if command == 'help': parser.print_help() return 0 ################### # List ################### if command == 'list': list_platforms() return 0 ################### # Clear ################### if command == 'clear': if os.path.exists(core.rosconfig_cmake()): os.remove(core.rosconfig_cmake()) print print "-- Platform configuration cleared." print else: print print "-- Nothing to do (no rosconfig.cmake)." print return 0 ################### # Create ################### if command == 'create': return create_platform() ################### # Delete ################### if command == 'delete': return delete_platform() ################### # Select ################### if command == 'select': if len(args) == 1: # interactive selection if not select_platform(): return 1 else: if not select_platform_by_name(args[1]): return 1 print return 0 ################### # Validate ################### if command == 'validate': print print "-- This command is not yet available." print return 0 # If we reach here, we have not received a valid command. print print "-- Not a valid command [" + command + "]." print parser.print_help() print return 1
def main(): from config import ErosConfig config = ErosConfig() from optparse import OptionParser usage = "\n\ %prog : shows the currently set ros toolchain\n\ %prog clear : clear the currently set ros toolchain\n\ %prog create : create a user-defined toolchain configuration\n\ %prog delete : delete a preconfigured toolchain\n\ %prog help : print this help information\n\ %prog list : list available eros and user-defined toolchains\n\ %prog select : interactively select a toolchain\n\ %prog select <str> : directly select the specified toolchain\n\ %prog validate : attempt to validate a toolchain (not yet implemented)\n\ \n\ Description: \n\ Create/delete and manage the toolchain configuration for this ros environment.\n\ Location of the user toolchain directory can be modified via --dir or more \n\ permanently via " + core.eros_config() + "." parser = OptionParser(usage=usage) parser.add_option("-d","--dir", action="store", default=config.user_toolchains_dir(), help="location of the user toolchain library") options, args = parser.parse_args() # Configure the user toolchain directory. user_toolchain_dir(options.dir) ################### # Show current ################### if not args: show_current_toolchain() return 0 command = args[0] ################### # Help ################### if command == 'help': parser.print_help() return 0 ################### # List ################### if command == 'list': list_toolchains() return 0 ################### # Clear ################### if command == 'clear': if os.path.exists(core.rostoolchain_cmake()): os.remove(core.rostoolchain_cmake()) print print "-- Toolchain configuration cleared." # print "-- Remember to reconfigure ROS_BOOST_ROOT if necessary." print else: print print "-- Nothing to do (no toolchain configuration present)." print return 0 ################### # Create ################### if command == 'create': return create_toolchain() ################### # Delete ################### if command == 'delete': return delete_toolchain() ################### # Select ################### if command == 'select': if len(args) == 1: # interactive selection if not select_toolchain(): return 1 else: if args[1].isdigit(): if select_toolchain_by_id(args[1]): return 1 else: if select_toolchain_by_name(args[1]): return 1 # Not currently needing it, but anyway, its good to have. print "-- Toolchain copied to rostoolchain.cmake." patch_ros() check_platform() #print "-- You need to manually export a root for the boost in your toolchain in setup.sh." #print " -- (typically the same as the TOOLCHAIN_INSTALL_PREFIX), e.g." #print #print " export ROS_BOOST_ROOT=\"/usr/my_toolchain_tuple/usr/local\"" print return 0 ################### # Validate ################### if command == 'validate': print print "-- This command is not yet available." print return 0 # If we reach here, we have not received a valid command. print print "-- Not a valid command [" + command + "]." print parser.print_help() print return 1