[game-data-packager] 04/08: factor out GameData.look_for_files(), add undocumented --[no-]-search
Simon McVittie
smcv at debian.org
Thu Jan 15 09:40:15 UTC 2015
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 07b754043b7f48b8330fbe6adb89a27a5449f887
Author: Simon McVittie <smcv at debian.org>
Date: Wed Jan 14 09:52:43 2015 +0000
factor out GameData.look_for_files(), add undocumented --[no-]-search
--search is normally (always?) the right thing, but --no-search is useful
for g-d-p developers.
---
lib/game_data_packager/__init__.py | 51 ++++++++++++++++++++++++--------------
1 file changed, 33 insertions(+), 18 deletions(-)
diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
index a114c2c..e2a3173 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -1383,6 +1383,29 @@ class GameData(object):
self.argument_parser = parser
return parser
+ def look_for_files(self, paths=(), search=True):
+ paths = list(paths)
+
+ if search:
+ for path in self.try_repack_from:
+ if os.path.isdir(path):
+ paths.append(path)
+
+ for package in self.packages.values():
+ path = '/' + package.install_to
+ if os.path.isdir(path):
+ paths.append(path)
+ path = '/usr/share/doc/' + package.name
+ if os.path.isdir(path):
+ paths.append(path)
+
+ for path in self.iter_steam_paths():
+ paths.append(path)
+
+ for arg in paths:
+ logger.debug('%s...', arg)
+ self.consider_file_or_dir(arg)
+
def run_command_line(self, args):
logger.debug('package description:\n%s',
yaml.safe_dump(self.to_yaml()))
@@ -1397,24 +1420,7 @@ class GameData(object):
compress = getattr(args, 'compress', True)
- for path in self.try_repack_from:
- if os.path.isdir(path):
- args.paths.append(path)
-
- for package in self.packages.values():
- path = '/' + package.install_to
- if os.path.isdir(path):
- args.paths.append(path)
- path = '/usr/share/doc/' + package.name
- if os.path.isdir(path):
- args.paths.append(path)
-
- for path in self.iter_steam_paths():
- args.paths.append(path)
-
- for arg in args.paths:
- logger.debug('%s...', arg)
- self.consider_file_or_dir(arg)
+ self.look_for_files(paths=args.paths, search=args.search)
possible = set()
@@ -1638,6 +1644,15 @@ def run_command_line():
dest='compress',
help='do not compress generated .deb (default without -d)')
+ group = base_parser.add_mutually_exclusive_group()
+ group.add_argument('--search', action='store_true',
+ default=True,
+ help='look for installed files in Steam and other likely places ' +
+ '(default)')
+ group.add_argument('--no-search', action='store_false',
+ dest='search',
+ help='only look in paths provided on the command line')
+
parser = argparse.ArgumentParser(prog='game-data-packager',
description='Package game files.', parents=(base_parser,))
--
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