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()
def script_version(script_name, config): if not os.path.exists(script_path(script_name, config)): return None with open(script_path(script_name, config)) as f: for line in f: if line.startswith('VERSION='): return line[8:].strip()
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()
def optional_deps(pkg_name, config): return dependencies(script_path(pkg_name, config), '#OPT:', config)
def recommended_deps(pkg_name, config): return dependencies(script_path(pkg_name, config), '#REC:', config)
def required_deps(pkg_name, config): return dependencies(script_path(pkg_name, config), '#REQ:', config)