[game-data-packager] 03/14: add support for 7zip archives & NSIS archives

Simon McVittie smcv at debian.org
Sun Feb 15 15:25:36 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 57dd689903efa7d83b6227907036c0fd15f9375e
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Wed Feb 11 15:38:49 2015 +0100

    add support for 7zip archives & NSIS archives
    
    NSIS = Nullsoft Scriptable Install System
---
 game_data_packager/__init__.py | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index 622f13d..743985d 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -1420,6 +1420,8 @@ class GameData(object):
                         self.consider_file(tmp, True)
                 elif fmt == 'innoextract':
                     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)
@@ -1444,6 +1446,18 @@ class GameData(object):
                     # -LL forces conversion to lowercase
                     for f in to_unpack:
                         self.consider_file(os.path.join(tmpdir, f), True)
+                elif fmt == '7z':
+                    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(['7z', 'x', '-bd',
+                                os.path.abspath(found_name)] +
+                            list(to_unpack), cwd=tmpdir)
+                    for f in to_unpack:
+                        self.consider_file(os.path.join(tmpdir, f), True)
                 elif fmt == 'cat':
                     self.cat_files(package, provider, wanted)
 
@@ -2254,7 +2268,7 @@ class GameData(object):
 
         fmt = wanted.unpack['format']
 
-        if fmt in ('id-shr-extract', 'lha', 'unzip', 'innoextract'):
+        if fmt in ('id-shr-extract', 'lha', 'unzip', 'innoextract', '7z'):
             if which(fmt) is None:
                 logger.warning('cannot unpack "%s": tool "%s" is not ' +
                         'installed', wanted.name, fmt)
@@ -2271,6 +2285,7 @@ class GameData(object):
         package_map = {
                 'id-shr-extract': 'dynamite',
                 'lha': 'lhasa',
+                '7z': 'p7zip-full',
         }
         packages = set()
 

-- 
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