not adding flathub remote when it is not set

This commit is contained in:
Vinicius Moreira
2019-07-30 17:35:46 -03:00
parent bfc13c1c01
commit 2f631ca903
8 changed files with 20 additions and 9 deletions

View File

@@ -147,7 +147,7 @@ class FlatpakManager(ApplicationManager):
raise Exception("'refresh' is not supported for {}".format(app.__class__.__name__))
def prepare(self):
flatpak.set_default_remotes()
pass
def list_updates(self) -> List[ApplicationUpdate]:
updates = []
@@ -179,4 +179,5 @@ class FlatpakManager(ApplicationManager):
return updates
def list_warnings(self) -> List[str]:
return None
if not flatpak.has_remotes_set():
return [self.locale_keys['flatpak.notification.no_remotes']]

View File

@@ -1,6 +1,6 @@
import re
import subprocess
from typing import List, Set
from typing import List
from fpakman.core import system
from fpakman.core.exception import NoInternetException
@@ -219,3 +219,7 @@ def install_and_stream(app_id: str, origin: str):
def set_default_remotes():
system.run_cmd('flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo')
def has_remotes_set() -> bool:
return bool(system.run_cmd('{} remotes'.format(BASE_CMD)).strip())