Break circular dependency

I moved use_lutris_runtime into the commands/wine.py file, which is the only place it is used; from there it can hit the runtime without a cycle.
This commit is contained in:
Dan Johnson 2023-10-10 18:18:27 -04:00
parent 16a99f75ba
commit 8ff590055b
2 changed files with 16 additions and 16 deletions

View file

@ -17,7 +17,7 @@ from lutris.util.wine.cabinstall import CabInstaller
from lutris.util.wine.prefix import WinePrefixManager
from lutris.util.wine.wine import (
WINE_DEFAULT_ARCH, WINE_DIR, detect_arch, detect_prefix_arch, get_overrides_env, get_real_executable,
use_lutris_runtime
is_installed_systemwide
)
@ -196,6 +196,20 @@ def winekill(prefix, arch=WINE_DEFAULT_ARCH, wine_path=None, env=None, initial_p
logger.debug("Done waiting.")
def use_lutris_runtime(wine_path, force_disable=False):
"""Returns whether to use the Lutris runtime.
The runtime can be forced to be disabled, otherwise
it's disabled automatically if Wine is installed system wide.
"""
if force_disable or runtime.RUNTIME_DISABLED:
return False
if WINE_DIR in wine_path:
return True
if is_installed_systemwide():
return False
return True
# pragma pylint: disable=too-many-locals
def wineexec( # noqa: C901
executable,

View file

@ -4,7 +4,7 @@ from collections import OrderedDict
from functools import lru_cache
from gettext import gettext as _
from lutris import runtime, settings
from lutris import settings
from lutris.api import get_default_runner_version
from lutris.exceptions import UnavailableRunnerError
from lutris.gui.dialogs import ErrorDialog
@ -109,20 +109,6 @@ def set_drive_path(prefix, letter, path):
os.symlink(path, drive_path)
def use_lutris_runtime(wine_path, force_disable=False):
"""Returns whether to use the Lutris runtime.
The runtime can be forced to be disabled, otherwise
it's disabled automatically if Wine is installed system wide.
"""
if force_disable or runtime.RUNTIME_DISABLED:
return False
if WINE_DIR in wine_path:
return True
if is_installed_systemwide():
return False
return True
def is_gstreamer_build(wine_path):
"""Returns whether a wine build ships with gstreamer libraries.
This allows to set GST_PLUGIN_SYSTEM_PATH_1_0 for the builds that support it.