def _unsupported_distribution(self) -> bool: current_distro = get_distribution_name() current_release = get_distribution_release() for (distro, release) in self.possible_distributions: if distro == current_distro and release == current_release: return False return True
def _execute(self, db: Database): if self._unsupported_distribution(): expected = join_strs( ["{} {} ".format(*l) for l in self.possible_distributions], "or") self._fail( "Unsupported distribution {} and release {}, expected {}". format(get_distribution_name(), get_distribution_release(), expected))
def __init__(self, possible_distributions: t.List[t.Tuple[str, str]] = [(get_distribution_name(), get_distribution_release())]): """ Creates an instance. :param possible_distributions: allowed (distribution, release) tuples """ super().__init__() self.possible_distributions = possible_distributions # type: t.List[t.Tuple[str, str]] """ Allowed (distribution, release) tuples """ self.typecheck()
def __init__(self, possible_distributions: t.List[t.Tuple[str, str]] = [ (get_distribution_name(), get_distribution_release()) ]): """ Creates an instance. :param possible_distributions: allowed (distribution, release) tuples """ super().__init__() self.possible_distributions = possible_distributions # type: t.List[t.Tuple[str, str]] """ Allowed (distribution, release) tuples """ self.typecheck()
def _execute(self, db: Database): if self._unsupported_distribution(): expected = join_strs(["{} {} ".format(*l) for l in self.possible_distributions], "or") self._fail("Unsupported distribution {} and release {}, expected {}".format(get_distribution_name(), get_distribution_release(), expected))