From 85f6bd3220f8eddd3d2ae3ef0c434b8c4968a0a0 Mon Sep 17 00:00:00 2001 From: derrod Date: Tue, 25 Oct 2022 15:14:26 +0200 Subject: [PATCH] Move some files from utils to more sensible locations --- legendary/cli.py | 10 +++++----- legendary/core.py | 10 ++++------ legendary/{utils => lfs}/crossover.py | 0 legendary/{utils => lfs}/eos.py | 2 +- legendary/lfs/lgndry.py | 5 +++-- legendary/{utils/lfs.py => lfs/utils.py} | 0 legendary/{utils => lfs}/windows_helpers.py | 0 legendary/{utils => lfs}/wine_helpers.py | 0 legendary/{utils => models}/config.py | 0 9 files changed, 13 insertions(+), 14 deletions(-) rename legendary/{utils => lfs}/crossover.py (100%) rename legendary/{utils => lfs}/eos.py (99%) rename legendary/{utils/lfs.py => lfs/utils.py} (100%) rename legendary/{utils => lfs}/windows_helpers.py (100%) rename legendary/{utils => lfs}/wine_helpers.py (100%) rename legendary/{utils => models}/config.py (100%) diff --git a/legendary/cli.py b/legendary/cli.py index d860924..0730bb4 100644 --- a/legendary/cli.py +++ b/legendary/cli.py @@ -22,13 +22,13 @@ from legendary.core import LegendaryCore from legendary.models.exceptions import InvalidCredentialsError from legendary.models.game import SaveGameStatus, VerifyResult, Game from legendary.utils.cli import get_boolean_choice, get_int_choice, sdl_prompt, strtobool -from legendary.utils.crossover import * +from legendary.lfs.crossover import * from legendary.utils.custom_parser import HiddenAliasSubparsersAction from legendary.utils.env import is_windows_mac_or_pyi -from legendary.utils.eos import add_registry_entries, query_registry_entries, remove_registry_entries -from legendary.utils.lfs import validate_files, clean_filename +from legendary.lfs.eos import add_registry_entries, query_registry_entries, remove_registry_entries +from legendary.lfs.utils import validate_files, clean_filename from legendary.utils.selective_dl import get_sdl_appname -from legendary.utils.wine_helpers import read_registry, get_shell_folders +from legendary.lfs.wine_helpers import read_registry, get_shell_folders # todo custom formatter for cli logger (clean info, highlighted error/warning) logging.basicConfig( @@ -2927,7 +2927,7 @@ def main(): print(f'\nCommand: {choice}') print(subparser.format_help()) elif os.name == 'nt': - from legendary.utils.windows_helpers import double_clicked + from legendary.lfs.windows_helpers import double_clicked if double_clicked(): print('Please note that this is not the intended way to run Legendary.') print('Follow https://github.com/derrod/legendary/wiki/Setup-Instructions to set it up properly') diff --git a/legendary/core.py b/legendary/core.py index 1144ca2..c3404b6 100644 --- a/legendary/core.py +++ b/legendary/core.py @@ -1,8 +1,6 @@ # coding: utf-8 import json -import logging -import os import shlex import shutil @@ -26,7 +24,7 @@ from legendary.api.lgd import LGDAPI from legendary.downloader.mp.manager import DLManager from legendary.lfs.egl import EPCLFS from legendary.lfs.lgndry import LGDLFS -from legendary.utils.lfs import clean_filename, delete_folder, delete_filelist, get_dir_size +from legendary.lfs.utils import clean_filename, delete_folder, delete_filelist, get_dir_size from legendary.models.downloading import AnalysisResult, ConditionCheckResult from legendary.models.egl import EGLManifest from legendary.models.exceptions import * @@ -34,15 +32,15 @@ from legendary.models.game import * from legendary.models.json_manifest import JSONManifest from legendary.models.manifest import Manifest, ManifestMeta from legendary.models.chunk import Chunk -from legendary.utils.crossover import * +from legendary.lfs.crossover import * from legendary.utils.egl_crypt import decrypt_epic_data from legendary.utils.env import is_windows_mac_or_pyi -from legendary.utils.eos import EOSOverlayApp, query_registry_entries +from legendary.lfs.eos import EOSOverlayApp, query_registry_entries from legendary.utils.game_workarounds import is_opt_enabled, update_workarounds, get_exe_override from legendary.utils.savegame_helper import SaveGameHelper from legendary.utils.selective_dl import games as sdl_games from legendary.utils.manifests import combine_manifests -from legendary.utils.wine_helpers import read_registry, get_shell_folders, case_insensitive_path_search +from legendary.lfs.wine_helpers import read_registry, get_shell_folders, case_insensitive_path_search # ToDo: instead of true/false return values for success/failure actually raise an exception that the CLI/GUI diff --git a/legendary/utils/crossover.py b/legendary/lfs/crossover.py similarity index 100% rename from legendary/utils/crossover.py rename to legendary/lfs/crossover.py diff --git a/legendary/utils/eos.py b/legendary/lfs/eos.py similarity index 99% rename from legendary/utils/eos.py rename to legendary/lfs/eos.py index f3bb550..fb8fc0f 100644 --- a/legendary/utils/eos.py +++ b/legendary/lfs/eos.py @@ -4,7 +4,7 @@ import logging from legendary.models.game import Game if os.name == 'nt': - from legendary.utils.windows_helpers import * + from legendary.lfs.windows_helpers import * logger = logging.getLogger('EOSUtils') # Dummy Game objects to use with Core methods that expect them diff --git a/legendary/lfs/lgndry.py b/legendary/lfs/lgndry.py index cee53f0..a0d273e 100644 --- a/legendary/lfs/lgndry.py +++ b/legendary/lfs/lgndry.py @@ -8,11 +8,12 @@ from collections import defaultdict from pathlib import Path from time import time +from .utils import clean_filename + from legendary.models.game import * from legendary.utils.aliasing import generate_aliases -from legendary.utils.config import LGDConf +from legendary.models.config import LGDConf from legendary.utils.env import is_windows_mac_or_pyi -from legendary.utils.lfs import clean_filename class LGDLFS: diff --git a/legendary/utils/lfs.py b/legendary/lfs/utils.py similarity index 100% rename from legendary/utils/lfs.py rename to legendary/lfs/utils.py diff --git a/legendary/utils/windows_helpers.py b/legendary/lfs/windows_helpers.py similarity index 100% rename from legendary/utils/windows_helpers.py rename to legendary/lfs/windows_helpers.py diff --git a/legendary/utils/wine_helpers.py b/legendary/lfs/wine_helpers.py similarity index 100% rename from legendary/utils/wine_helpers.py rename to legendary/lfs/wine_helpers.py diff --git a/legendary/utils/config.py b/legendary/models/config.py similarity index 100% rename from legendary/utils/config.py rename to legendary/models/config.py