from prompt import Prompt from candidate_program import CandidateProgram, JsonLogger import sys if __name__ == "__main__": instructions_json = JsonLogger() instructions = instructions_json.open_and_read() prompt = Prompt() json_location_string = 'installing all prorgams from {0}'.format(instructions_json.location) prompt.greet(add=json_location_string) prompt.write_to_prompt('here\'s the list of what I found:') prompt.write_separator() prompt.column_print(list(instructions.keys())) prompt.write_separator() if not prompt.ask_confirmation('would you like to procede?'): prompt.write_to_prompt('Ok, bye!') sys.exit(0) for program, install_instruction in instructions.items(): candidate = CandidateProgram(**install_instruction) candidate.add_repo_ppa() candidate.add_repo_key() candidate.add_repo_deb() candidate.install(v=1)
prompt.greet_off() sys.exit(0) if __name__ == "__main__": prompt = Prompt() prompt.greet() candidate = CandidateProgram() # candidate.update_sys_list() candidate.aka_name = prompt.ask_name() if candidate.lookup_name_in_current_repos(candidate.aka_name): success_text = 'found a program in your current repos called exactly {0}'.format( candidate.aka_name) ask_text = '\nDo you want me to install that one?' if prompt.ask_confirmation(success_text + ask_text): candidate.name_in_repo = candidate.aka_name candidate.install() candidate.dump_success() exit_installer(prompt) if prompt.ask_confirmation('Do you want to install one from this list? '): candidate.name_in_repo = prompt.ask_text('Which one? ') candidate.install() candidate.dump_success() exit_installer(prompt) if prompt.ask_confirmation('Do you need to add a repo?'): candidate.ppa_repo = prompt.ask_text( 'Insert PPA repo details [or press enter to skip to sources.list repo].\nppa:' ) if candidate.ppa_repo: candidate.add_repo_ppa()