Fix to work with flatpak 1.0

This commit is contained in:
Vinicius Moreira
2019-06-12 18:35:07 -03:00
parent 7b03ccba2e
commit c0193a66bf
3 changed files with 7 additions and 7 deletions

View File

@@ -40,9 +40,9 @@ def _package_str_to_json(line: str, version: str) -> dict:
return app
def _run_cmd(cmd: str, expected_code: int = 0) -> str:
def _run_cmd(cmd: str, expected_code: int = 0, ignore_return_code: bool = False) -> str:
res = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE)
return res.stdout.decode() if res.returncode == expected_code else None
return res.stdout.decode() if ignore_return_code or res.returncode == expected_code else None
def get_version():
@@ -75,4 +75,4 @@ def update(ref: str):
def list_updates():
return _run_cmd('flatpak update', expected_code=1)
return _run_cmd('flatpak update', ignore_return_code=True)

View File

@@ -47,10 +47,10 @@ class FlatpakManager:
pak_data = None
if not pak_data:
pak['latest_release'] = None
pak['latest_version'] = None
pak['icon'] = None
else:
pak['latest_release'] = pak_data['currentReleaseVersion']
pak['latest_version'] = pak_data['currentReleaseVersion']
pak['icon'] = pak_data['iconDesktopUrl']
if pak['icon'].startswith('/'):