Skip to content

Commit

Permalink
fix: Do not show success with failed dependencies install (#3062)
Browse files Browse the repository at this point in the history
* fix: Do not show success with failed dependencies install and do not override mshtml

* fix: Return bool instead of Result for create_bottle_from_config()
  • Loading branch information
koplo199 authored Sep 2, 2023
1 parent bbb6735 commit 44b0604
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bottles/backend/managers/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self, manager, offline: bool = False):
self.__utils_conn = manager.utils_conn

@lru_cache
def get_dependency(self, name: str, plain: bool = False) -> Union[str, dict]:
def get_dependency(self, name: str, plain: bool = False) -> Union[str, dict, bool]:
return self.__repo.get(name, plain)

@lru_cache
Expand Down
14 changes: 10 additions & 4 deletions bottles/backend/managers/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1063,8 +1063,10 @@ def create_bottle_from_config(self, config: BottleConfig) -> bool:
'''
if dependency in self.supported_dependencies.keys():
dep = [dependency, self.supported_dependencies[dependency]]
self.dependency_manager.install(config, dep)

res = self.dependency_manager.install(config, dep)
if not res.ok:
logging.error(_("Failed to install dependency: %s") % dep.get("Description", "n/a"), jn=True)
return False
logging.info(f"New bottle from config created: {config.Path}")
self.update_bottles(silent=True)
return True
Expand Down Expand Up @@ -1314,7 +1316,7 @@ def components_check():
# blacklisting processes
logging.info("Optimizing environment…")
log_update(_("Optimizing environment…"))
_blacklist_dll = ["winemenubuilder.exe", "mshtml"] # avoid gecko, mono popups
_blacklist_dll = ["winemenubuilder.exe"]
for _dll in _blacklist_dll:
reg.add(
key="HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides",
Expand Down Expand Up @@ -1381,7 +1383,11 @@ def components_check():
if dep in self.supported_dependencies:
_dep = self.supported_dependencies[dep]
log_update(_("Installing dependency: %s …") % _dep.get("Description", "n/a"))
self.dependency_manager.install(config, [dep, _dep])
res = self.dependency_manager.install(config, [dep, _dep])
if not res.ok:
logging.error(_("Failed to install dependency: %s") % _dep.get("Description", "n/a"), jn=True)
log_update(_("Failed to install dependency: %s") % _dep.get("Description", "n/a"))
return Result(False)
template_updated = True

# save bottle config
Expand Down
5 changes: 3 additions & 2 deletions bottles/backend/repos/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#

from io import BytesIO
from typing import Union

import pycurl

Expand Down Expand Up @@ -62,7 +63,7 @@ def __get_catalog(self, index: str, offline: bool = False):
logging.error(f"Cannot fetch {self.name} repository index.")
return {}

def get_manifest(self, url: str, plain: bool = False):
def get_manifest(self, url: str, plain: bool = False) -> Union[str, dict, bool]:
try:
buffer = BytesIO()

Expand All @@ -81,4 +82,4 @@ def get_manifest(self, url: str, plain: bool = False):
return yaml.load(res)
except (pycurl.error, yaml.YAMLError):
logging.error(f"Cannot fetch {self.name} manifest.")
return {}
return False
2 changes: 0 additions & 2 deletions bottles/backend/wine/winecommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,6 @@ def get_env(self, environment: Optional[dict] = None, return_steam_env: bool = F

# Default DLL overrides
if not return_steam_env:
if all(not s.startswith("mshtml=") for s in dll_overrides):
dll_overrides.append("mshtml=d")
dll_overrides.append("winemenubuilder=''")

# Get Runtime libraries
Expand Down

0 comments on commit 44b0604

Please sign in to comment.