[game-data-packager] 01/21: add 'unzip' compression method
Simon McVittie
smcv at debian.org
Wed Jan 21 11:51:59 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 40354ce6d3c5bc2ef13712747f6bcdcd596701b4
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date: Wed Jan 21 09:36:58 2015 +0100
add 'unzip' compression method
this is needed to read old zip files supported by unzip,
but not by native module that trigger this:
"NotImplementedError: compression type 6 (implode)"
---
lib/game_data_packager/__init__.py | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
index 131aace..d28e4db 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -1301,6 +1301,21 @@ class GameData(object):
cwd=tmpdir)
for f in to_unpack:
self.consider_file(os.path.join(tmpdir, f), True)
+ elif fmt == 'unzip':
+ to_unpack = provider.unpack.get('unpack', provider.provides)
+ logger.debug('Extracting %r from %s',
+ to_unpack, found_name)
+ tmpdir = os.path.join(self.get_workdir(), 'tmp',
+ provider_name + '.d')
+ mkdir_p(tmpdir)
+ subprocess.check_call(['unzip', '-j', '-C', '-LL',
+ os.path.abspath(found_name)] +
+ list(to_unpack), cwd=tmpdir)
+ # -j junk paths
+ # -C use case-insensitive matching
+ # -LL forces conversion to lowercase
+ for f in to_unpack:
+ self.consider_file(os.path.join(tmpdir, f), True)
elif fmt == 'cat':
self.cat_files(package, provider, wanted)
@@ -1920,7 +1935,7 @@ class GameData(object):
fmt = wanted.unpack['format']
- if fmt in ('id-shr-extract', 'lha'):
+ if fmt in ('id-shr-extract', 'lha', 'unzip'):
if which(fmt) is None:
logger.warning('cannot unpack "%s": tool "%s" is not ' +
'installed', wanted.name, fmt)
@@ -1941,7 +1956,7 @@ class GameData(object):
packages = set()
for t in self.missing_tools:
- p = package_map.get(t)
+ p = package_map.get(t, t)
if p is not None:
packages.add(p)
--
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