search and install

This commit is contained in:
Vinícius Moreira
2019-06-28 19:01:37 -03:00
committed by GitHub
parent e3a8df5dab
commit 22eed7af67
16 changed files with 649 additions and 83 deletions

View File

@@ -1,6 +1,9 @@
import os
import subprocess
from typing import List
from fpakman.core import resource
def run_cmd(cmd: str, expected_code: int = 0, ignore_return_code: bool = False) -> str:
res = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, env={'LANG': 'en'})
@@ -9,3 +12,8 @@ def run_cmd(cmd: str, expected_code: int = 0, ignore_return_code: bool = False)
def stream_cmd(cmd: List[str]):
return subprocess.Popen(cmd, stdout=subprocess.PIPE, env={'LANG': 'en'}).stdout
def notify_user(msg: str, icon_path: str = resource.get_path('img/flathub_45.svg')):
if bool(os.getenv('FPAKMAN_UPDATE_NOTIFICATION', 1)):
os.system("notify-send {} '{}'".format("-i {}".format(icon_path) if icon_path else '', msg))