Skip to content

Commit

Permalink
move result warns and falures to cli.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Dummerle committed Oct 21, 2021
1 parent 6e248e6 commit 997971c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
15 changes: 14 additions & 1 deletion legendary/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ def install_game(self, args):
# todo use status queue to print progress from CLI
# This has become a little ridiculous hasn't it?
try:
dlm, analysis, game, igame, repair, repair_file = self.core.prepare_download(
dlm, analysis, game, igame, repair, repair_file, res = self.core.prepare_download(
app_name=args.app_name,
base_path=args.base_path,
force=args.force,
Expand Down Expand Up @@ -782,6 +782,19 @@ def install_game(self, args):
logger.fatal(e)
exit(1)
# game is either up to date or hasn't changed, so we have nothing to do

if res.warnings or res.failures:
self.logger.info('Installation requirements check returned the following results:')

if res.warnings:
for warn in sorted(res.warnings):
self.logger.warning(warn)

if res.failures:
for msg in sorted(res.failures):
self.logger.fatal(msg)
exit(1)

if not analysis.dl_size:
old_igame = self.core.get_installed_game(game.app_name)
logger.info('Download size is 0, the game is either already up to date or has not changed. Exiting...')
Expand Down
14 changes: 1 addition & 13 deletions legendary/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1289,19 +1289,7 @@ def prepare_download(self, app_name: str, base_path: str = '', no_install: bool
updating=self.is_installed(app_name),
ignore_space_req=ignore_space_req)

if res.warnings or res.failures:
self.log.info('Installation requirements check returned the following results:')

if res.warnings:
for warn in sorted(res.warnings):
self.log.warning(warn)

if res.failures:
for msg in sorted(res.failures):
self.log.fatal(msg)
raise RuntimeError('Installation cannot proceed, exiting.')

return dlm, anlres, game, igame, repair, repair_file
return dlm, anlres, game, igame, repair, repair_file, res

def verify_game(self, app_name: str, callback: Callable[[int, int], None] = print):
if not self.is_installed(app_name):
Expand Down

0 comments on commit 997971c

Please sign in to comment.