def test_install(self): Pacman.install(['pkg1', 'pkg2'], as_deps=True) cmds = ['/usr/bin/sudo /usr/bin/pacman -Sy pkg1 pkg2 --asdeps', '/bin/su -c \'/usr/bin/pacman -Sy pkg1 pkg2 --asdeps\''] self.assertIn(PacmanTest.cmd, cmds)
def _install_deps(names): ''' Installs missing dependencies ''' aurs, officials = [], names Msg.info(_('Need following packages as dependencies:')) if Config.get('check-deps-from-aur', True): aur_checks = Pacman.check_from_aur(names) aurs = list(filter(lambda k: aur_checks[k], aur_checks)) officials = list(filter(lambda k: not aur_checks[k], aur_checks)) for i in [("AUR", aurs), ("Official", officials)]: if i[1]: Msg.info( _('{0} repository: [{1}]'.format( i[0], ', '.join(i[1])))) else: Msg.info(_('[{0}]'.format(', '.join(names)))) if not Msg.ask(_('Install?')): if Msg.ask(_('Try without installing dependencies?')): return False Msg.info(_('Bye')) LocalRepo.shutdown(1) try: if aurs: LocalRepo.aur_add(aurs) Pacman.install(officials, as_deps=True) return True except LocalRepoError as e: LocalRepo.error(e)
def test_install(self): Pacman.install(['pkg1', 'pkg2'], as_deps=True) cmds = [ '/usr/bin/sudo /usr/bin/pacman -Sy pkg1 pkg2 --asdeps', '/bin/su -c \'/usr/bin/pacman -Sy pkg1 pkg2 --asdeps\'' ] self.assertIn(PacmanTest.cmd, cmds)
def _install_deps(names): ''' Installs missing dependencies ''' Msg.info(_('Need following packages as dependencies:\n[{0}]').format(', '.join(names))) if not Msg.ask(_('Install?')): if Msg.ask(_('Try without installing dependencies?')): return Msg.info(_('Bye')) LocalRepo.shutdown(1) try: Pacman.install(names, as_deps=True) except LocalRepoError as e: LocalRepo.error(e)