From 74ddfc03efed3bac3daea24b51439d9707a652a1 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Thu, 2 Jan 2020 17:13:57 -0300 Subject: [PATCH] [refactoring] removing the HOME_PATH constant in favor of Path.home() --- bauh/api/constants.py | 7 +++---- bauh/gems/appimage/__init__.py | 5 ++--- bauh/gems/arch/__init__.py | 5 +++-- bauh/gems/web/__init__.py | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/bauh/api/constants.py b/bauh/api/constants.py index a14e0b8d..61c96fe1 100644 --- a/bauh/api/constants.py +++ b/bauh/api/constants.py @@ -1,6 +1,5 @@ from pathlib import Path -HOME_PATH = Path.home() -CACHE_PATH = '{}/.cache/bauh'.format(HOME_PATH) -CONFIG_PATH = '{}/.config/bauh'.format(HOME_PATH) -DESKTOP_ENTRIES_DIR = '{}/.local/share/applications'.format(HOME_PATH) +CACHE_PATH = '{}/.cache/bauh'.format(Path.home()) +CONFIG_PATH = '{}/.config/bauh'.format(Path.home()) +DESKTOP_ENTRIES_DIR = '{}/.local/share/applications'.format(Path.home()) diff --git a/bauh/gems/appimage/__init__.py b/bauh/gems/appimage/__init__.py index 7ac802a6..341db84d 100644 --- a/bauh/gems/appimage/__init__.py +++ b/bauh/gems/appimage/__init__.py @@ -1,8 +1,7 @@ import os - -from bauh.api.constants import HOME_PATH +from pathlib import Path ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) -LOCAL_PATH = '{}/.local/share/bauh/appimage'.format(HOME_PATH) +LOCAL_PATH = '{}/.local/share/bauh/appimage'.format(Path.home()) INSTALLATION_PATH = LOCAL_PATH + '/installed/' SUGGESTIONS_FILE = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/appimage/suggestions.txt' \ No newline at end of file diff --git a/bauh/gems/arch/__init__.py b/bauh/gems/arch/__init__.py index 65bf849e..5c3c8bee 100644 --- a/bauh/gems/arch/__init__.py +++ b/bauh/gems/arch/__init__.py @@ -1,6 +1,7 @@ import os +from pathlib import Path -from bauh.api.constants import CACHE_PATH, HOME_PATH, CONFIG_PATH +from bauh.api.constants import CACHE_PATH, CONFIG_PATH ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) BUILD_DIR = '/tmp/bauh/aur' @@ -8,7 +9,7 @@ ARCH_CACHE_PATH = CACHE_PATH + '/arch' CATEGORIES_CACHE_DIR = ARCH_CACHE_PATH + '/categories' CATEGORIES_FILE_PATH = CATEGORIES_CACHE_DIR + '/aur.txt' URL_CATEGORIES_FILE = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/aur/categories.txt' -CONFIG_DIR = '{}/.config/bauh/arch'.format(HOME_PATH) +CONFIG_DIR = '{}/.config/bauh/arch'.format(Path.home()) CUSTOM_MAKEPKG_FILE = '{}/makepkg.conf'.format(CONFIG_DIR) AUR_INDEX_FILE = '{}/aur.txt'.format(BUILD_DIR) CONFIG_FILE = '{}/arch.yml'.format(CONFIG_PATH) diff --git a/bauh/gems/web/__init__.py b/bauh/gems/web/__init__.py index 68af6a87..7d9f9321 100644 --- a/bauh/gems/web/__init__.py +++ b/bauh/gems/web/__init__.py @@ -1,7 +1,7 @@ import os from pathlib import Path -from bauh.api.constants import HOME_PATH, DESKTOP_ENTRIES_DIR, CONFIG_PATH +from bauh.api.constants import DESKTOP_ENTRIES_DIR, CONFIG_PATH ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) WEB_PATH = '{}/.local/share/bauh/web'.format(Path.home()) @@ -13,7 +13,7 @@ NODE_BIN_PATH = '{}/bin/node'.format(NODE_DIR_PATH) NPM_BIN_PATH = '{}/bin/npm'.format(NODE_DIR_PATH) NODE_MODULES_PATH = '{}/node_modules'.format(ENV_PATH) NATIVEFIER_BIN_PATH = '{}/.bin/nativefier'.format(NODE_MODULES_PATH) -ELECTRON_PATH = '{}/.cache/electron'.format(HOME_PATH) +ELECTRON_PATH = '{}/.cache/electron'.format(Path.home()) ELECTRON_DOWNLOAD_URL = 'https://github.com/electron/electron/releases/download/v{version}/electron-v{version}-linux-{arch}.zip' ELECTRON_SHA256_URL = 'https://github.com/electron/electron/releases/download/v{version}/SHASUMS256.txt' URL_ENVIRONMENT_SETTINGS = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/web/environment.yml'