[game-data-packager] 05/14: launcher: factor out check_required_files
Simon McVittie
smcv at debian.org
Fri Oct 14 00:09:49 UTC 2016
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch master
in repository game-data-packager.
commit b25bf92ff9ef7dfc84a4ee837d377ce69dbad963
Author: Simon McVittie <smcv at debian.org>
Date: Wed Oct 12 11:09:27 2016 +0100
launcher: factor out check_required_files
---
runtime/launcher.py | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/runtime/launcher.py b/runtime/launcher.py
index b0417d2..cd1ccd2 100755
--- a/runtime/launcher.py
+++ b/runtime/launcher.py
@@ -239,23 +239,29 @@ class Launcher:
else:
self.warning_stamp = None
- def main(self):
- have_all_data = True
-
- for p in self.base_directories:
- logger.debug('Searching: %s' % p)
-
- # sanity check: game engines often don't cope well with missing data
- for f in self.required_files:
+ def check_required_files(self, base_directories, required_files,
+ warn=True):
+ for f in required_files:
logger.debug('looking for %s', f)
- for p in self.base_directories:
+ for p in base_directories:
logger.debug('looking for %s in %s', f, p)
if os.path.exists(os.path.join(p, f)):
logger.debug('found %s in %s', f, p)
break
else:
- logger.warning('Data file is missing: %s' % f)
- have_all_data = False
+ if warn:
+ logger.warning('Data file is missing: %s' % f)
+ return False
+ else:
+ return True
+
+ def main(self):
+ for p in self.base_directories:
+ logger.debug('Searching: %s' % p)
+
+ # sanity check: game engines often don't cope well with missing data
+ have_all_data = self.check_required_files(self.base_directories,
+ self.required_files)
if self.dot_directory is not None:
os.makedirs(self.dot_directory, exist_ok=True)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git
More information about the Pkg-games-commits
mailing list