Ejemplo n.º 1
0
def update_all(config):
    # To update check what is the installed version
    # And what is the available version
    # If they do not match then do installation.
    try:
        #try:
        #	with open(config['PACKAGE_LIST']) as fp:
        #		package_list = json.loads(fp.read())
        #except:
        #	print('Please run: alps updatescripts before running an update.')
        #	abnormal_exit()
        to_be_updated = get_updates(config)
        #for pkg in package_list:
        #		if pkg['status'] == True and not pkg['available_version'] == pkg['version']:
        #			to_be_updated.append(pkg['name'])

        print('The following packages would be updated:\n\t' +
              ' '.join(to_be_updated))
        response = console.prompt_choice(
            'Are you sure you want to install these packages?', ['y', 'n'],
            'y')
        if response == 'y':
            for pkg in to_be_updated:
                begin_install(script_path(pkg, config))
                execute_cmd(script_path(pkg, config).split())
                remove_duplicate_entries(config)
    except KeyboardInterrupt:
        abnormal_exit()
Ejemplo n.º 2
0
def execute_script(script_path, params=None):
    try:
        if params != None:
            execute_cmd(script_path.split().extend(params))
        else:
            execute_cmd(script_path.split())
    except KeyboardInterrupt:
        abnormal_exit()
Ejemplo n.º 3
0
def install_pkgs(pkg_names, opts, config):
    try:
        dep_chain = deps.dep_chain_status(pkg_names, False, config)
        console.print_status(dep_chain)
        if not ('-ni' in opts or '--no-interactive' in opts):
            response = console.prompt_choice(
                'Are you sure you want to install these packages?', ['y', 'n'],
                'y')
        else:
            response = 'y'
        if response == 'y':
            for (pkg, status) in dep_chain.items():
                if not status:
                    begin_install(script_path(pkg, config))
                    execute_cmd(script_path(pkg, config).split())
    except KeyboardInterrupt:
        abnormal_exit()