Example #1
0
 def lookup_name_in_current_repos(self, program_name):
     #self.update_sys_list()
     lookup_command_text = 'sudo apt-cache search {0}'.format(program_name)
     lookup_command = BashCommand(lookup_command_text, r='output')
     full_list = lookup_command.run()
     select_start_to_hyphen = re.compile(r'^(\S*)\s-')
     program_list = []
     for l in full_list.split('\n'):
         m = select_start_to_hyphen.search(l)
         if m:
             program_list.append(m.groups()[0])
     print('candidates found in your local repos: ')
     Prompt.column_print(program_list)
     return program_name in program_list
Example #2
0
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)