mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 21:44:16 +02:00
[api.paths] refactoring: CACHE_PATH renamed to CACHE_DIR
This commit is contained in:
@@ -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:
|
||||
"""
|
||||
|
||||
@@ -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()))
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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('')
|
||||
|
||||
@@ -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']))
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user