def run_vcs_tool(path, tool): """If path is a valid VCS repository, run the corresponding VCS tool Supported VCS tools: 'commit', 'browse' Return False if the VCS tool is not installed""" infos = get_vcs_infos(get_vcs_root(path)) for name, args in infos[tool]: if programs.find_program(name): programs.run_program(name, args, cwd=path) return else: raise RuntimeError( _("For %s support, please install one of the<br/> " "following tools:<br/><br/> %s") % (infos['name'], ', '.join([name for name, cmd in infos['commit']])))
def run_vcs_tool(path, tool): """If path is a valid VCS repository, run the corresponding VCS tool Supported VCS tools: 'commit', 'browse' Return False if the VCS tool is not installed""" infos = get_vcs_infos(get_vcs_root(path)) for name, args in infos[tool]: if programs.find_program(name): programs.run_program(name, args, cwd=path) return else: raise RuntimeError(_("For %s support, please install one of the<br/> " "following tools:<br/><br/> %s") % (infos['name'], ', '.join([name for name,cmd in infos['commit']]) ))
def create_program_action(parent, text, name, icon=None, nt_name=None): """Create action to run a program""" if is_text_string(icon): icon = get_icon(icon) if os.name == 'nt' and nt_name is not None: name = nt_name path = programs.find_program(name) if path is not None: return create_action(parent, text, icon=icon, triggered=lambda: programs.run_program(name))