mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 17:34:14 +02:00
0.9.17
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
__version__ = '0.9.16'
|
||||
__version__ = '0.9.17'
|
||||
__app_name__ = 'bauh'
|
||||
|
||||
import os
|
||||
|
||||
@@ -606,9 +606,8 @@ class AppImageManager(SoftwareManager):
|
||||
def set_enabled(self, enabled: bool):
|
||||
self.enabled = enabled
|
||||
|
||||
def _is_sqlite3_available(self):
|
||||
res = run_cmd('which sqlite3')
|
||||
return res and not res.strip().startswith('which ')
|
||||
def _is_sqlite3_available(self) -> bool:
|
||||
return bool(shutil.which('sqlite3'))
|
||||
|
||||
def can_work(self) -> bool:
|
||||
return self._is_sqlite3_available() and self.file_downloader.can_work()
|
||||
|
||||
@@ -2649,9 +2649,8 @@ class ArchManager(SoftwareManager):
|
||||
|
||||
return res
|
||||
|
||||
def _is_wget_available(self):
|
||||
res = run_cmd('which wget')
|
||||
return res and not res.strip().startswith('which ')
|
||||
def _is_wget_available(self) -> bool:
|
||||
return bool(shutil.which('wget'))
|
||||
|
||||
def is_enabled(self) -> bool:
|
||||
return self.enabled
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import shutil
|
||||
from datetime import datetime
|
||||
from typing import List, Tuple, Optional
|
||||
|
||||
@@ -6,8 +7,7 @@ from bauh.commons.system import new_subprocess, SimpleProcess
|
||||
|
||||
|
||||
def is_installed() -> bool:
|
||||
code, _ = system.execute(cmd='which git', output=False)
|
||||
return code == 0
|
||||
return bool(shutil.which('git'))
|
||||
|
||||
|
||||
def list_commits(proj_dir: str) -> List[dict]:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
from threading import Thread
|
||||
from typing import List, Set, Tuple, Dict, Iterable, Optional
|
||||
|
||||
@@ -26,8 +27,7 @@ RE_DESKTOP_FILES = re.compile(r'\n?([\w\-_]+)\s+(/usr/share/.+\.desktop)')
|
||||
|
||||
|
||||
def is_available() -> bool:
|
||||
res = run_cmd('which pacman', print_error=False)
|
||||
return res and not res.strip().startswith('which ')
|
||||
return bool(shutil.which('pacman'))
|
||||
|
||||
|
||||
def get_repositories(pkgs: Iterable[str]) -> dict:
|
||||
@@ -463,8 +463,7 @@ def get_databases() -> Set[str]:
|
||||
|
||||
|
||||
def can_refresh_mirrors() -> bool:
|
||||
output = run_cmd('which pacman-mirrors', print_error=False)
|
||||
return True if output else False
|
||||
return is_mirrors_available()
|
||||
|
||||
|
||||
def refresh_mirrors(root_password: str) -> SimpleProcess:
|
||||
@@ -497,8 +496,7 @@ def get_current_mirror_countries() -> List[str]:
|
||||
|
||||
|
||||
def is_mirrors_available() -> bool:
|
||||
code, _ = system.execute(cmd='which pacman-mirrors', output=False)
|
||||
return code == 0
|
||||
return bool(shutil.which('pacman-mirrors'))
|
||||
|
||||
|
||||
def map_update_sizes(pkgs: List[str]) -> Dict[str, int]: # bytes:
|
||||
@@ -674,7 +672,7 @@ def map_updates_data(pkgs: Iterable[str], files: bool = False) -> dict:
|
||||
if val == 'None':
|
||||
data['d'] = None
|
||||
else:
|
||||
data['d'] = {w.strip().split(':')[0].strip() for w in val.split(' ') if w}
|
||||
data['d'] = {w.strip() for w in val.split(' ') if w}
|
||||
latest_field = 'd'
|
||||
elif field == 'Conflicts With':
|
||||
if val == 'None':
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from typing import Set
|
||||
|
||||
@@ -7,7 +8,7 @@ from bauh.gems.arch import IGNORED_REBUILD_CHECK_FILE
|
||||
|
||||
|
||||
def is_installed() -> bool:
|
||||
return system.execute(cmd='which checkrebuild', output=False)[0] == 0
|
||||
return bool(shutil.which('checkrebuild'))
|
||||
|
||||
|
||||
def list_required_rebuild() -> Set[str]:
|
||||
|
||||
@@ -2,6 +2,7 @@ import glob
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import time
|
||||
import traceback
|
||||
from datetime import datetime, timedelta
|
||||
@@ -13,7 +14,6 @@ import requests
|
||||
|
||||
from bauh.api.abstract.context import ApplicationContext
|
||||
from bauh.api.abstract.handler import TaskManager
|
||||
from bauh.commons import system
|
||||
from bauh.commons.boot import CreateConfigFile
|
||||
from bauh.commons.html import bold
|
||||
from bauh.commons.system import new_root_subprocess, ProcessHandler
|
||||
@@ -259,8 +259,7 @@ class ArchCompilationOptimizer(Thread):
|
||||
self.taskman.register_task(self.task_id, self.i18n['arch.task.optimizing'].format(bold('makepkg.conf')), get_icon_path())
|
||||
|
||||
def _is_ccache_installed(self) -> bool:
|
||||
code, _ = system.execute(cmd='which ccache', output=False)
|
||||
return code == 0
|
||||
return bool(shutil.which('ccache'))
|
||||
|
||||
def optimize(self):
|
||||
ti = time.time()
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
from io import StringIO
|
||||
from typing import Tuple, Optional
|
||||
|
||||
from bauh.commons.system import run_cmd, SimpleProcess
|
||||
from bauh.commons.system import SimpleProcess
|
||||
|
||||
BASE_CMD = 'snap'
|
||||
|
||||
|
||||
def is_installed() -> bool:
|
||||
return bool(run_cmd('which {}'.format(BASE_CMD), print_error=False))
|
||||
return bool(shutil.which(BASE_CMD))
|
||||
|
||||
|
||||
def uninstall_and_stream(app_name: str, root_password: str) -> SimpleProcess:
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import shutil
|
||||
from typing import List, Optional
|
||||
|
||||
from bauh.commons.system import SimpleProcess, run_cmd
|
||||
@@ -18,8 +19,7 @@ def install(url: str, name: str, output_dir: str, electron_version: Optional[str
|
||||
|
||||
|
||||
def is_available() -> bool:
|
||||
res = run_cmd('which nativefier', print_error=False)
|
||||
return res and not res.strip().startswith('which ')
|
||||
return bool(shutil.which('nativefier'))
|
||||
|
||||
|
||||
def get_version() -> str:
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from bauh.commons.system import run_cmd
|
||||
import shutil
|
||||
|
||||
|
||||
def is_available() -> bool:
|
||||
res = run_cmd('which npm', print_error=False)
|
||||
return res and not res.strip().startswith('which ')
|
||||
return bool(shutil.which('npm'))
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import re
|
||||
import re
|
||||
import shutil
|
||||
import time
|
||||
import traceback
|
||||
from subprocess import Popen, STDOUT
|
||||
@@ -16,7 +17,6 @@ from bauh.api.abstract.view import ViewComponent, TabGroupComponent, MessageType
|
||||
from bauh.api.exception import NoInternetException
|
||||
from bauh.commons.boot import CreateConfigFile
|
||||
from bauh.commons.html import bold
|
||||
from bauh.commons.system import run_cmd
|
||||
from bauh.view.core.config import CoreConfigManager
|
||||
from bauh.view.core.settings import GenericSettingsManager
|
||||
from bauh.view.core.update import check_for_update
|
||||
@@ -71,7 +71,7 @@ class GenericSoftwareManager(SoftwareManager):
|
||||
refresh=False): self.is_backups_action_available}
|
||||
|
||||
def _is_timeshift_launcher_available(self) -> bool:
|
||||
return bool(run_cmd('which timeshift-launcher', print_error=False))
|
||||
return bool(shutil.which('timeshift-launcher'))
|
||||
|
||||
def is_backups_action_available(self, app_config: dict) -> bool:
|
||||
return bool(app_config['backup']['enabled']) and self._is_timeshift_launcher_available()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import time
|
||||
import traceback
|
||||
from math import floor
|
||||
@@ -29,15 +30,15 @@ class AdaptableFileDownloader(FileDownloader):
|
||||
|
||||
@staticmethod
|
||||
def is_aria2c_available() -> bool:
|
||||
return bool(run_cmd('which aria2c', print_error=False))
|
||||
return bool(shutil.which('aria2c'))
|
||||
|
||||
@staticmethod
|
||||
def is_axel_available() -> bool:
|
||||
return bool(run_cmd('which axel', print_error=False))
|
||||
return bool(shutil.which('axel'))
|
||||
|
||||
@staticmethod
|
||||
def is_wget_available() -> bool:
|
||||
return bool(run_cmd('which wget', print_error=False))
|
||||
return bool(shutil.which('wget'))
|
||||
|
||||
def _get_aria2c_process(self, url: str, output_path: str, cwd: str, root_password: str, threads: int) -> SimpleProcess:
|
||||
cmd = ['aria2c', url,
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
from bauh.commons.system import run_cmd, SimpleProcess
|
||||
import shutil
|
||||
|
||||
from bauh.commons.system import SimpleProcess
|
||||
|
||||
|
||||
def is_available() -> bool:
|
||||
return bool(run_cmd('which timeshift', print_error=False))
|
||||
return bool(shutil.which('timeshift'))
|
||||
|
||||
|
||||
def delete_all_snapshots(root_password: str) -> SimpleProcess:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import traceback
|
||||
from io import StringIO
|
||||
@@ -15,7 +16,6 @@ from PyQt5.QtWidgets import QSystemTrayIcon, QMenu
|
||||
from bauh import __app_name__, ROOT_DIR
|
||||
from bauh.api.abstract.model import PackageUpdate
|
||||
from bauh.api.http import HttpClient
|
||||
from bauh.commons import system
|
||||
from bauh.commons.system import run_cmd
|
||||
from bauh.context import generate_i18n
|
||||
from bauh.view.core.tray_client import TRAY_CHECK_FILE
|
||||
@@ -40,11 +40,8 @@ def get_cli_path() -> str:
|
||||
if os.path.exists(cli_path):
|
||||
return cli_path
|
||||
else:
|
||||
cli_path = system.run_cmd('which bauh-cli', print_error=False)
|
||||
return shutil.which('bauh-cli')
|
||||
|
||||
if cli_path:
|
||||
return cli_path.strip()
|
||||
|
||||
|
||||
def list_updates(logger: logging.Logger) -> List[PackageUpdate]:
|
||||
cli_path = get_cli_path()
|
||||
|
||||
Reference in New Issue
Block a user