[game-data-packager] 06/10: Add support for extracting lha files
Simon McVittie
smcv at debian.org
Sun Jan 4 18:34:48 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 dc8e4698fb43374decfe016db5bb0680234b5491
Author: Simon McVittie <smcv at debian.org>
Date: Sat Jan 3 20:12:40 2015 +0000
Add support for extracting lha files
---
lib/game_data_packager/__init__.py | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
index 4159522..f8098b9 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -360,6 +360,12 @@ class GameData(object):
assert installable in self.files, installable
for filename, wanted in self.files.items():
+ if wanted.unpack:
+ assert 'format' in wanted.unpack, filename
+ if wanted.unpack['format'] == 'lha':
+ # for this unpacker we have to know what to pull out
+ assert wanted.unpack['unpack'], filename
+
if wanted.alternatives:
for alt in wanted.alternatives:
assert alt in self.files, alt
@@ -861,6 +867,19 @@ class GameData(object):
elif fmt == 'zip':
with zipfile.ZipFile(found_name, 'r') as zf:
self.consider_zip(found_name, zf, provider)
+ elif fmt == 'lha':
+ logger.debug('Extracting %r from %s',
+ provider.unpack['unpack'], found_name)
+ tmpdir = os.path.join(self.get_workdir(), 'tmp',
+ provider_name + '.d')
+ mkdir_p(tmpdir)
+ subprocess.check_call(['lha', 'xq',
+ os.path.abspath(found_name)] +
+ provider.unpack['unpack'],
+ cwd=tmpdir)
+ for f in provider.unpack['unpack']:
+ self.consider_file(os.path.join(tmpdir, f), True)
+
elif providable:
# we don't have it, but we can get it
possible = 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