From ae0f0c7e759691ec33ca3e0a64dd11a66142177a Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 29 Nov 2021 10:47:09 -0300 Subject: [PATCH] [appimage] refactoring: INSTALLATION_PATH constant renamed to INSTALLATION_DIR --- bauh/gems/appimage/__init__.py | 2 +- bauh/gems/appimage/controller.py | 8 ++++---- bauh/gems/appimage/model.py | 4 ++-- bauh/gems/appimage/worker.py | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bauh/gems/appimage/__init__.py b/bauh/gems/appimage/__init__.py index 3338e698..24133d96 100644 --- a/bauh/gems/appimage/__init__.py +++ b/bauh/gems/appimage/__init__.py @@ -8,7 +8,7 @@ from bauh.commons import resource ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) APPIMAGE_SHARED_DIR = f'{SHARED_FILES_DIR}/appimage' -INSTALLATION_PATH = f'{APPIMAGE_SHARED_DIR}/installed' +INSTALLATION_DIR = f'{APPIMAGE_SHARED_DIR}/installed' SUGGESTIONS_FILE = f'https://raw.githubusercontent.com/vinifmor/{__app_name__}-files/master/appimage/suggestions.txt' CONFIG_FILE = f'{CONFIG_DIR}/appimage.yml' APPIMAGE_CONFIG_DIR = f'{CONFIG_DIR}/appimage' diff --git a/bauh/gems/appimage/controller.py b/bauh/gems/appimage/controller.py index 36deb041..844f4356 100644 --- a/bauh/gems/appimage/controller.py +++ b/bauh/gems/appimage/controller.py @@ -28,7 +28,7 @@ from bauh.commons import resource from bauh.commons.boot import CreateConfigFile from bauh.commons.html import bold from bauh.commons.system import SystemProcess, new_subprocess, ProcessHandler, run_cmd, SimpleProcess -from bauh.gems.appimage import query, INSTALLATION_PATH, APPIMAGE_SHARED_DIR, ROOT_DIR, \ +from bauh.gems.appimage import query, INSTALLATION_DIR, APPIMAGE_SHARED_DIR, ROOT_DIR, \ APPIMAGE_CONFIG_DIR, UPDATES_IGNORED_FILE, util, get_default_manual_installation_file_dir, DATABASE_APPS_FILE, \ DATABASE_RELEASES_FILE, APPIMAGE_CACHE_DIR, get_icon_path, DOWNLOAD_DIR from bauh.gems.appimage.config import AppImageConfigManager @@ -253,8 +253,8 @@ class AppImageManager(SoftwareManager): installed_apps = [] res = SearchResult(installed_apps, [], 0) - if os.path.exists(INSTALLATION_PATH): - installed = run_cmd(f'ls {INSTALLATION_PATH}/*/data.json', print_error=False) + if os.path.exists(INSTALLATION_DIR): + installed = run_cmd(f'ls {INSTALLATION_DIR}/*/data.json', print_error=False) if installed: names = set() @@ -553,7 +553,7 @@ class AppImageManager(SoftwareManager): def _install(self, pkg: AppImage, watcher: ProcessWatcher, pre_downloaded_file: Optional[Tuple[str, str]] = None): handler = ProcessHandler(watcher) - out_dir = f'{INSTALLATION_PATH}/{pkg.get_clean_name()}' + out_dir = f'{INSTALLATION_DIR}/{pkg.get_clean_name()}' counter = 0 while True: if os.path.exists(out_dir): diff --git a/bauh/gems/appimage/model.py b/bauh/gems/appimage/model.py index 479c58b3..9da6041a 100644 --- a/bauh/gems/appimage/model.py +++ b/bauh/gems/appimage/model.py @@ -4,7 +4,7 @@ from typing import List, Optional from bauh.api.abstract.model import SoftwarePackage, CustomSoftwareAction from bauh.commons import resource -from bauh.gems.appimage import ROOT_DIR, INSTALLATION_PATH +from bauh.gems.appimage import ROOT_DIR, INSTALLATION_DIR from bauh.view.util.translation import I18n RE_MANY_SPACES = re.compile(r'\s+') @@ -94,7 +94,7 @@ class AppImage(SoftwarePackage): if self.install_dir: return self.install_dir elif self.name: - return f'{INSTALLATION_PATH}/{self.name.lower()}' + return f'{INSTALLATION_DIR}/{self.name.lower()}' def get_disk_icon_path(self): return self.icon_path diff --git a/bauh/gems/appimage/worker.py b/bauh/gems/appimage/worker.py index 58b37a2c..e416f5f9 100644 --- a/bauh/gems/appimage/worker.py +++ b/bauh/gems/appimage/worker.py @@ -16,7 +16,7 @@ from bauh.api.abstract.handler import TaskManager, ProcessWatcher from bauh.api.http import HttpClient from bauh.commons.boot import CreateConfigFile from bauh.commons.html import bold -from bauh.gems.appimage import get_icon_path, INSTALLATION_PATH, SYMLINKS_DIR, util, DATABASES_TS_FILE, \ +from bauh.gems.appimage import get_icon_path, INSTALLATION_DIR, SYMLINKS_DIR, util, DATABASES_TS_FILE, \ APPIMAGE_CACHE_DIR, DATABASE_APPS_FILE, DATABASE_RELEASES_FILE, URL_COMPRESSED_DATABASES, SUGGESTIONS_FILE, \ SUGGESTIONS_CACHED_TS_FILE, SUGGESTIONS_CACHED_FILE from bauh.gems.appimage.model import AppImage @@ -233,8 +233,8 @@ class SymlinksVerifier(Thread): watcher.print('[error] {}'.format(msg)) def run(self): - if os.path.exists(INSTALLATION_PATH): - installed_files = glob.glob(f'{INSTALLATION_PATH}/*/*.json') + if os.path.exists(INSTALLATION_DIR): + installed_files = glob.glob(f'{INSTALLATION_DIR}/*/*.json') if installed_files: self.logger.info("Checking installed AppImage files with no symlinks created")