diff --git a/bauh/api/abstract/model.py b/bauh/api/abstract/model.py index 7158462c..e674cf32 100644 --- a/bauh/api/abstract/model.py +++ b/bauh/api/abstract/model.py @@ -2,7 +2,7 @@ from abc import ABC, abstractmethod from enum import Enum from typing import List, Optional -from bauh.api.paths import CACHE_PATH +from bauh.api.paths import CACHE_DIR class CustomSoftwareAction: @@ -146,7 +146,7 @@ class SoftwarePackage(ABC): """ :return: base cache path for the specific app type """ - return f'{CACHE_PATH}/{self.get_type()}' + return f'{CACHE_DIR}/{self.get_type()}' def can_be_updated(self) -> bool: """ diff --git a/bauh/api/paths.py b/bauh/api/paths.py index 88be86c4..621fb649 100644 --- a/bauh/api/paths.py +++ b/bauh/api/paths.py @@ -4,7 +4,7 @@ from pathlib import Path from bauh import __app_name__ from bauh.api import user -CACHE_PATH = f'/var/cache/{__app_name__}' if user.is_root() else f'{Path.home()}/.cache/{__app_name__}' +CACHE_DIR = f'/var/cache/{__app_name__}' if user.is_root() else f'{Path.home()}/.cache/{__app_name__}' CONFIG_DIR = f'/etc/{__app_name__}' if user.is_root() else f'{Path.home()}/.config/{__app_name__}' USER_THEMES_DIR = f'/usr/share/{__app_name__}/themes' if user.is_root() else f'{Path.home()}/.local/share/{__app_name__}/themes' DESKTOP_ENTRIES_DIR = '{}/.local/share/applications'.format(str(Path.home())) diff --git a/bauh/gems/appimage/__init__.py b/bauh/gems/appimage/__init__.py index 5c8e30d6..a301da6f 100644 --- a/bauh/gems/appimage/__init__.py +++ b/bauh/gems/appimage/__init__.py @@ -2,7 +2,7 @@ import os from pathlib import Path from typing import Optional -from bauh.api.paths import CONFIG_DIR, TEMP_DIR, CACHE_PATH +from bauh.api.paths import CONFIG_DIR, TEMP_DIR, CACHE_DIR from bauh.commons import resource ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -14,7 +14,7 @@ APPIMAGE_CONFIG_DIR = f'{CONFIG_DIR}/appimage' UPDATES_IGNORED_FILE = f'{APPIMAGE_CONFIG_DIR}/updates_ignored.txt' SYMLINKS_DIR = '{}/.local/bin'.format(str(Path.home())) URL_COMPRESSED_DATABASES = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/appimage/dbs.tar.gz' -APPIMAGE_CACHE_PATH = f'{CACHE_PATH}/appimage' +APPIMAGE_CACHE_PATH = f'{CACHE_DIR}/appimage' DATABASE_APPS_FILE = f'{APPIMAGE_CACHE_PATH}/apps.db' DATABASE_RELEASES_FILE = f'{APPIMAGE_CACHE_PATH}/releases.db' DATABASES_TS_FILE = f'{APPIMAGE_CACHE_PATH}/dbs.ts' diff --git a/bauh/gems/arch/__init__.py b/bauh/gems/arch/__init__.py index ba3b64ae..8abaa524 100644 --- a/bauh/gems/arch/__init__.py +++ b/bauh/gems/arch/__init__.py @@ -1,11 +1,11 @@ import os -from bauh.api.paths import CONFIG_DIR, TEMP_DIR, CACHE_PATH +from bauh.api.paths import CONFIG_DIR, TEMP_DIR, CACHE_DIR from bauh.commons import resource ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) BUILD_DIR = f'{TEMP_DIR}/arch' -ARCH_CACHE_PATH = f'{CACHE_PATH}/arch' +ARCH_CACHE_PATH = f'{CACHE_DIR}/arch' CATEGORIES_FILE_PATH = f'{ARCH_CACHE_PATH}/categories.txt' URL_CATEGORIES_FILE = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/arch/categories.txt' URL_GPG_SERVERS = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/arch/gpgservers.txt' diff --git a/bauh/gems/arch/database.py b/bauh/gems/arch/database.py index cbc4cd68..63a17f80 100644 --- a/bauh/gems/arch/database.py +++ b/bauh/gems/arch/database.py @@ -7,10 +7,10 @@ from logging import Logger from pathlib import Path from typing import Optional -from bauh.api.paths import CACHE_PATH +from bauh.api.paths import CACHE_DIR from bauh.commons.system import ProcessHandler -SYNC_FILE = f'{CACHE_PATH}/arch/db_sync' +SYNC_FILE = f'{CACHE_DIR}/arch/db_sync' def should_sync(arch_config: dict, aur_supported: bool, handler: Optional[ProcessHandler], logger: logging.Logger): diff --git a/bauh/gems/arch/mirrors.py b/bauh/gems/arch/mirrors.py index fa9ce454..81dacebd 100644 --- a/bauh/gems/arch/mirrors.py +++ b/bauh/gems/arch/mirrors.py @@ -6,9 +6,9 @@ from datetime import datetime from logging import Logger from pathlib import Path -from bauh.api.paths import CACHE_PATH +from bauh.api.paths import CACHE_DIR -SYNC_FILE = f'{CACHE_PATH}/arch/mirrors_sync' +SYNC_FILE = f'{CACHE_DIR}/arch/mirrors_sync' def should_sync(logger: logging.Logger): diff --git a/bauh/gems/snap/__init__.py b/bauh/gems/snap/__init__.py index d2d25497..db4b5efb 100644 --- a/bauh/gems/snap/__init__.py +++ b/bauh/gems/snap/__init__.py @@ -1,10 +1,10 @@ import os -from bauh.api.paths import CONFIG_DIR, CACHE_PATH +from bauh.api.paths import CONFIG_DIR, CACHE_DIR from bauh.commons import resource ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) -SNAP_CACHE_PATH = f'{CACHE_PATH}/snap' +SNAP_CACHE_PATH = f'{CACHE_DIR}/snap' CONFIG_FILE = f'{CONFIG_DIR}/snap.yml' CATEGORIES_FILE_PATH = f'{SNAP_CACHE_PATH}/categories.txt' URL_CATEGORIES_FILE = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/snap/categories.txt' diff --git a/bauh/gems/web/__init__.py b/bauh/gems/web/__init__.py index 43e47df9..928f8535 100644 --- a/bauh/gems/web/__init__.py +++ b/bauh/gems/web/__init__.py @@ -1,13 +1,13 @@ import os from pathlib import Path -from bauh.api.paths import DESKTOP_ENTRIES_DIR, CONFIG_DIR, TEMP_DIR, CACHE_PATH +from bauh.api.paths import DESKTOP_ENTRIES_DIR, CONFIG_DIR, TEMP_DIR, CACHE_DIR from bauh.commons import resource from bauh.commons.util import map_timestamp_file ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) WEB_PATH = '{}/.local/share/bauh/web'.format(Path.home()) -WEB_CACHE_PATH = f'{CACHE_PATH}/web' +WEB_CACHE_PATH = f'{CACHE_DIR}/web' INSTALLED_PATH = '{}/installed'.format(WEB_PATH) ENV_PATH = '{}/env'.format(WEB_PATH) FIXES_PATH = '{}/fixes'.format(WEB_PATH) diff --git a/bauh/view/core/tray_client.py b/bauh/view/core/tray_client.py index 7b283f58..1bdad0f9 100644 --- a/bauh/view/core/tray_client.py +++ b/bauh/view/core/tray_client.py @@ -1,12 +1,12 @@ from pathlib import Path -from bauh.api.paths import CACHE_PATH +from bauh.api.paths import CACHE_DIR -TRAY_CHECK_FILE = f'{CACHE_PATH}/notify_tray' # it is a file that signals to the tray icon it should recheck for updates +TRAY_CHECK_FILE = f'{CACHE_DIR}/notify_tray' # it is a file that signals to the tray icon it should recheck for updates def notify_tray(): - Path(CACHE_PATH).mkdir(exist_ok=True, parents=True) + Path(CACHE_DIR).mkdir(exist_ok=True, parents=True) with open(TRAY_CHECK_FILE, 'w+') as f: f.write('') diff --git a/bauh/view/core/update.py b/bauh/view/core/update.py index 3eb91ff9..168fdb20 100644 --- a/bauh/view/core/update.py +++ b/bauh/view/core/update.py @@ -6,7 +6,7 @@ from packaging.version import parse as parse_version from bauh import __app_name__, __version__ from bauh.api.http import HttpClient -from bauh.api.paths import CACHE_PATH +from bauh.api.paths import CACHE_DIR from bauh.commons.html import bold, link from bauh.view.util.translation import I18n @@ -33,7 +33,7 @@ def check_for_update(logger: logging.Logger, http_client: HttpClient, i18n: I18n break if latest and latest.get('tag_name'): - notifications_dir = f'{CACHE_PATH}/updates' + notifications_dir = f'{CACHE_DIR}/updates' release_file = '{}/{}{}'.format(notifications_dir, '' if not tray else 'tray_', latest['tag_name']) if os.path.exists(release_file): logger.info("Release {} already notified".format(latest['tag_name'])) diff --git a/bauh/view/util/util.py b/bauh/view/util/util.py index 8f126628..4d9078df 100644 --- a/bauh/view/util/util.py +++ b/bauh/view/util/util.py @@ -11,7 +11,7 @@ from colorama import Fore from bauh import __app_name__ from bauh.api.abstract.controller import SoftwareManager -from bauh.api.paths import CONFIG_DIR, CACHE_PATH +from bauh.api.paths import CONFIG_DIR, CACHE_DIR from bauh.commons.system import run_cmd from bauh.view.util import resource @@ -61,7 +61,7 @@ def clean_app_files(managers: List[SoftwareManager], logs: bool = True): if logs: print('[bauh] Cleaning configuration and cache files') - for path in (CACHE_PATH, CONFIG_DIR): + for path in (CACHE_DIR, CONFIG_DIR): if logs: print('[bauh] Deleting directory {}'.format(path))