[appimage] refactoring: INSTALLATION_PATH constant renamed to INSTALLATION_DIR

This commit is contained in:
Vinicius Moreira
2021-11-29 10:47:09 -03:00
parent 9f4e08e29c
commit ae0f0c7e75
4 changed files with 10 additions and 10 deletions

View File

@@ -8,7 +8,7 @@ from bauh.commons import resource
ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
APPIMAGE_SHARED_DIR = f'{SHARED_FILES_DIR}/appimage' 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' SUGGESTIONS_FILE = f'https://raw.githubusercontent.com/vinifmor/{__app_name__}-files/master/appimage/suggestions.txt'
CONFIG_FILE = f'{CONFIG_DIR}/appimage.yml' CONFIG_FILE = f'{CONFIG_DIR}/appimage.yml'
APPIMAGE_CONFIG_DIR = f'{CONFIG_DIR}/appimage' APPIMAGE_CONFIG_DIR = f'{CONFIG_DIR}/appimage'

View File

@@ -28,7 +28,7 @@ from bauh.commons import resource
from bauh.commons.boot import CreateConfigFile from bauh.commons.boot import CreateConfigFile
from bauh.commons.html import bold from bauh.commons.html import bold
from bauh.commons.system import SystemProcess, new_subprocess, ProcessHandler, run_cmd, SimpleProcess 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, \ 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 DATABASE_RELEASES_FILE, APPIMAGE_CACHE_DIR, get_icon_path, DOWNLOAD_DIR
from bauh.gems.appimage.config import AppImageConfigManager from bauh.gems.appimage.config import AppImageConfigManager
@@ -253,8 +253,8 @@ class AppImageManager(SoftwareManager):
installed_apps = [] installed_apps = []
res = SearchResult(installed_apps, [], 0) res = SearchResult(installed_apps, [], 0)
if os.path.exists(INSTALLATION_PATH): if os.path.exists(INSTALLATION_DIR):
installed = run_cmd(f'ls {INSTALLATION_PATH}/*/data.json', print_error=False) installed = run_cmd(f'ls {INSTALLATION_DIR}/*/data.json', print_error=False)
if installed: if installed:
names = set() names = set()
@@ -553,7 +553,7 @@ class AppImageManager(SoftwareManager):
def _install(self, pkg: AppImage, watcher: ProcessWatcher, pre_downloaded_file: Optional[Tuple[str, str]] = None): def _install(self, pkg: AppImage, watcher: ProcessWatcher, pre_downloaded_file: Optional[Tuple[str, str]] = None):
handler = ProcessHandler(watcher) handler = ProcessHandler(watcher)
out_dir = f'{INSTALLATION_PATH}/{pkg.get_clean_name()}' out_dir = f'{INSTALLATION_DIR}/{pkg.get_clean_name()}'
counter = 0 counter = 0
while True: while True:
if os.path.exists(out_dir): if os.path.exists(out_dir):

View File

@@ -4,7 +4,7 @@ from typing import List, Optional
from bauh.api.abstract.model import SoftwarePackage, CustomSoftwareAction from bauh.api.abstract.model import SoftwarePackage, CustomSoftwareAction
from bauh.commons import resource 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 from bauh.view.util.translation import I18n
RE_MANY_SPACES = re.compile(r'\s+') RE_MANY_SPACES = re.compile(r'\s+')
@@ -94,7 +94,7 @@ class AppImage(SoftwarePackage):
if self.install_dir: if self.install_dir:
return self.install_dir return self.install_dir
elif self.name: elif self.name:
return f'{INSTALLATION_PATH}/{self.name.lower()}' return f'{INSTALLATION_DIR}/{self.name.lower()}'
def get_disk_icon_path(self): def get_disk_icon_path(self):
return self.icon_path return self.icon_path

View File

@@ -16,7 +16,7 @@ from bauh.api.abstract.handler import TaskManager, ProcessWatcher
from bauh.api.http import HttpClient from bauh.api.http import HttpClient
from bauh.commons.boot import CreateConfigFile from bauh.commons.boot import CreateConfigFile
from bauh.commons.html import bold 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, \ APPIMAGE_CACHE_DIR, DATABASE_APPS_FILE, DATABASE_RELEASES_FILE, URL_COMPRESSED_DATABASES, SUGGESTIONS_FILE, \
SUGGESTIONS_CACHED_TS_FILE, SUGGESTIONS_CACHED_FILE SUGGESTIONS_CACHED_TS_FILE, SUGGESTIONS_CACHED_FILE
from bauh.gems.appimage.model import AppImage from bauh.gems.appimage.model import AppImage
@@ -233,8 +233,8 @@ class SymlinksVerifier(Thread):
watcher.print('[error] {}'.format(msg)) watcher.print('[error] {}'.format(msg))
def run(self): def run(self):
if os.path.exists(INSTALLATION_PATH): if os.path.exists(INSTALLATION_DIR):
installed_files = glob.glob(f'{INSTALLATION_PATH}/*/*.json') installed_files = glob.glob(f'{INSTALLATION_DIR}/*/*.json')
if installed_files: if installed_files:
self.logger.info("Checking installed AppImage files with no symlinks created") self.logger.info("Checking installed AppImage files with no symlinks created")