예제 #1
0
def add_module_repository(options):
    # does not work yet really...
    config = VikiConfig()
    repositories.clone_module_repository('core', config)
    # install direct dependencies
    install_packages({})
    # install using rosdep, for build dependencies
    dependencies.install_second_level_dependencies()
예제 #2
0
파일: configuring.py 프로젝트: UT-RAM/viki
class Configuring:
    """
    Class which will run the configuration for the user
    especially useful the first time
    """

    def __init__(self):
        self.config = VikiConfig()

        # Return functions here, which are used with lazy evaluation,
        # such that we can evaluate already set options
        # Also, initialize it in this way, because of order
        self.default_options = OrderedDict()
        self.default_options['ros_version'] = lambda: 'indigo'
        self.default_options['ros_dir'] = lambda: '/opt/ros/' + self.config.get_option('ros_version')
        self.default_options['viki_dir'] = lambda: os.getcwd()
        self.default_options['catkin_workspace'] = lambda : '~/catkin_ws'
        self.default_options['root_module_directory'] = lambda : self.config.get_option('catkin_workspace') + '/src/viki_modules'

    def run(self):
        print "Configuring settings:\nPress enter to use default, or enter your own value"
        for option in self.default_options.keys():
            default = self.config.get_option(option, True)
            if default is None:
                default = self.default_options[option]()

            value = self.ask_config_option(option, default)
            self.config.set_option(option, value)
        self.config.save_config()

    def ask_config_option(self, option, value):
        input = raw_input("{}: [{}]".format(option, value))
        if input is not "":
            return input
        return value
예제 #3
0
파일: configuring.py 프로젝트: UT-RAM/viki
    def __init__(self):
        self.config = VikiConfig()

        # Return functions here, which are used with lazy evaluation,
        # such that we can evaluate already set options
        # Also, initialize it in this way, because of order
        self.default_options = OrderedDict()
        self.default_options['ros_version'] = lambda: 'indigo'
        self.default_options['ros_dir'] = lambda: '/opt/ros/' + self.config.get_option('ros_version')
        self.default_options['viki_dir'] = lambda: os.getcwd()
        self.default_options['catkin_workspace'] = lambda : '~/catkin_ws'
        self.default_options['root_module_directory'] = lambda : self.config.get_option('catkin_workspace') + '/src/viki_modules'
예제 #4
0
def check_installed_packages():
    """
    Checks for every module that is available,
    if the ROS packages needed for it are installed on the system

    :return: Boolean
    """
    viki_config = VikiConfig()
    missing_packages = get_missing_packages(viki_config)

    if len(missing_packages) > 0:
        print "[WARNING] - There are missing packages for full VIKI support:"
        print "\n".join(map((lambda x: x['name']), missing_packages))
        return False
    else:
        print "[OK] - All ROS package dependencies are met!"
        print "Note: only second level dependencies of already installed packages have been checked"
        return True
예제 #5
0
def install_packages(options):
    """
        Installs packages that the 'check_packages' function determines as missing
        This can either be with apt-get, or git, something else is not yet supported
        :return:
    """
    config = VikiConfig()
    missing_ros_packages = dependencies.get_missing_packages(config)
    if len(missing_ros_packages) == 0:
        print "[OK] - All ROS package dependencies are met, noting to install!"

    missing_aptget_packages = map((lambda x: x['name']),
                                  filter((lambda x: x['type'] == 'apt-get'),
                                         missing_ros_packages))
    missing_vcs_packages = filter((lambda x: x['type'] == 'git'),
                                  missing_ros_packages)

    installation_candidates = dependencies.get_aptget_packages(
        missing_aptget_packages)
    dependencies.start_aptget_installation(installation_candidates)
    dependencies.start_vcs_installation(missing_vcs_packages)