diff --git a/bauh/api/paths.py b/bauh/api/paths.py index be89411d..195ff318 100644 --- a/bauh/api/paths.py +++ b/bauh/api/paths.py @@ -1,8 +1,9 @@ -import os from pathlib import Path +from bauh.api import user + CACHE_PATH = '{}/.cache/bauh'.format(str(Path.home())) CONFIG_PATH = '{}/.config/bauh'.format(str(Path.home())) USER_THEMES_PATH = '{}/.local/share/bauh/themes'.format(str(Path.home())) DESKTOP_ENTRIES_DIR = '{}/.local/share/applications'.format(str(Path.home())) -TEMP_DIR = '/tmp/bauh{}'.format('_root' if os.getuid() == 0 else '') +TEMP_DIR = '/tmp/bauh{}'.format('_root' if user.is_root() else '') diff --git a/bauh/commons/user.py b/bauh/api/user.py similarity index 100% rename from bauh/commons/user.py rename to bauh/api/user.py diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index 8c29b579..1f896bed 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -11,7 +11,7 @@ from datetime import datetime from math import floor from pathlib import Path from threading import Thread -from typing import List, Set, Type, Tuple, Dict, Iterable, Optional, Collection, Generator +from typing import List, Set, Type, Tuple, Dict, Iterable, Optional, Collection import requests from dateutil.parser import parse as parse_date @@ -27,7 +27,8 @@ from bauh.api.abstract.view import MessageType, FormComponent, InputOption, Sing FileChooserComponent, TextComponent from bauh.api.paths import TEMP_DIR from bauh.api.exception import NoInternetException -from bauh.commons import user, system +from bauh.commons import system +from bauh.api import user from bauh.commons.boot import CreateConfigFile from bauh.commons.category import CategoriesDownloader from bauh.commons.html import bold diff --git a/bauh/gems/flatpak/controller.py b/bauh/gems/flatpak/controller.py index 8050eea2..2cfe2977 100644 --- a/bauh/gems/flatpak/controller.py +++ b/bauh/gems/flatpak/controller.py @@ -17,7 +17,7 @@ from bauh.api.abstract.model import PackageHistory, PackageUpdate, SoftwarePacka SuggestionPriority, PackageStatus from bauh.api.abstract.view import MessageType, FormComponent, SingleSelectComponent, InputOption, SelectViewType, \ ViewComponent, PanelComponent -from bauh.commons import user +from bauh.api import user from bauh.commons.boot import CreateConfigFile from bauh.commons.html import strip_html, bold from bauh.commons.system import ProcessHandler diff --git a/bauh/gems/web/model.py b/bauh/gems/web/model.py index 866538f3..358be3ff 100644 --- a/bauh/gems/web/model.py +++ b/bauh/gems/web/model.py @@ -4,7 +4,8 @@ from pathlib import Path from typing import List from bauh.api.abstract.model import SoftwarePackage -from bauh.commons import resource, user +from bauh.commons import resource +from bauh.api import user from bauh.gems.web import ROOT_DIR diff --git a/bauh/view/qt/prepare.py b/bauh/view/qt/prepare.py index e31c78a5..1439dd1f 100644 --- a/bauh/view/qt/prepare.py +++ b/bauh/view/qt/prepare.py @@ -13,7 +13,7 @@ from bauh import __app_name__ from bauh.api.abstract.context import ApplicationContext from bauh.api.abstract.controller import SoftwareManager, SoftwareAction from bauh.api.abstract.handler import TaskManager -from bauh.commons import user +from bauh.api import user from bauh.view.qt.components import new_spacer, QCustomToolbar from bauh.view.qt.qt_utils import centralize from bauh.view.qt.root import RootDialog diff --git a/bauh/view/qt/thread.py b/bauh/view/qt/thread.py index 0b2b0cb0..02076888 100644 --- a/bauh/view/qt/thread.py +++ b/bauh/view/qt/thread.py @@ -20,7 +20,7 @@ from bauh.api.abstract.model import PackageStatus, SoftwarePackage, CustomSoftwa from bauh.api.abstract.view import MessageType, MultipleSelectComponent, InputOption, TextComponent, \ FormComponent, ViewComponent from bauh.api.exception import NoInternetException -from bauh.commons import user +from bauh.api import user from bauh.commons.html import bold from bauh.commons.internet import InternetChecker from bauh.commons.system import get_human_size_str, ProcessHandler, SimpleProcess diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py index 0204a516..cb953aeb 100755 --- a/bauh/view/qt/window.py +++ b/bauh/view/qt/window.py @@ -18,7 +18,7 @@ from bauh.api.abstract.controller import SoftwareManager, SoftwareAction from bauh.api.abstract.model import SoftwarePackage from bauh.api.abstract.view import MessageType from bauh.api.http import HttpClient -from bauh.commons import user +from bauh.api import user from bauh.commons.html import bold from bauh.context import set_theme from bauh.stylesheet import read_all_themes_metadata, ThemeMetadata