[game-data-packager] 01/01: provide only_file: shortcut & integrity check at "make check" phase

Alexandre Detiste detiste-guest at moszumanska.debian.org
Sun May 31 12:39:11 UTC 2015


This is an automated email from the git hooks/post-receive script.

detiste-guest pushed a commit to branch master
in repository game-data-packager.

commit 16d86c95ee642679f99c423a06987e1b1eb655db
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Sun May 31 14:38:10 2015 +0200

    provide only_file: shortcut & integrity check at "make check" phase
---
 game_data_packager/__init__.py          |  9 ++++++++-
 game_data_packager/games/doom_common.py | 15 +++++++--------
 game_data_packager/games/z_code.py      |  4 +++-
 3 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index 7402900..28bdf42 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -421,6 +421,13 @@ class GameDataPackage(object):
         self._install = set(value)
 
     @property
+    def only_file(self):
+        if len(self._install) == 1:
+            return list(self._install)[0]
+        else:
+            return None
+
+    @property
     def install_contents_of(self):
         return self._install_contents_of
     @install_contents_of.setter
@@ -1853,7 +1860,7 @@ class GameData(object):
 
             if count_usr == 0 and count_doc == 1:
                 o.write('"/usr/share/doc/%s/%s"\n' % (package.name,
-                                                      list(package.install)[0]))
+                                                      package.only_file))
             elif count_usr == 1:
                 o.write('"/%s/%s"\n' % (package.install_to, main_wad))
             elif len(exts) == 1:
diff --git a/game_data_packager/games/doom_common.py b/game_data_packager/games/doom_common.py
index c3fc744..1a140e2 100644
--- a/game_data_packager/games/doom_common.py
+++ b/game_data_packager/games/doom_common.py
@@ -75,8 +75,11 @@ class DoomGameData(GameData):
             engine = package.engine or self.engine
             engine = engine.split('|')[-1].strip()
             package.program = package_map.get(engine, engine)
-            package.main_wads = self.data['packages'][package.name].get(
-                    'main_wads', {list(package.install)[0]: {}})
+            if 'main_wads' in self.data['packages'][package.name]:
+                package.main_wads = self.data['packages'][package.name]['main_wads']
+            else:
+                assert package.only_file
+                package.main_wads = {package.only_file: {}}
             assert type(package.main_wads) == dict
             for main_wad in package.main_wads.values():
                 assert type(main_wad) == dict
@@ -132,12 +135,8 @@ class DoomGameData(GameData):
             if 'args' in quirks:
                 args = '-file ' + main_wad + ' ' + quirks['args']
             elif package.expansion_for:
-                for f in self.packages[package.expansion_for].install:
-                    if f.endswith('.wad'):
-                        iwad = f
-                        break
-                else:
-                    raise AssertionError("Couldn't find %s's IWAD" % main_wad)
+                iwad = self.packages[package.expansion_for].only_file
+                assert iwad is not None, "Couldn't find %s's IWAD" % main_wad
                 args = (  '-iwad /usr/share/games/doom/' + iwad
                        + ' -file /usr/share/games/doom/' + main_wad)
             else:
diff --git a/game_data_packager/games/z_code.py b/game_data_packager/games/z_code.py
index d7aac1f..aa983b0 100644
--- a/game_data_packager/games/z_code.py
+++ b/game_data_packager/games/z_code.py
@@ -30,6 +30,8 @@ class ZCodeGameData(GameData):
     def __init__(self, shortname, data, workdir=None):
         super(ZCodeGameData, self).__init__(shortname, data,
                 workdir=workdir)
+        for package in self.packages.values():
+            assert package.only_file
 
         if self.engine is None:
             self.engine = 'gargoyle-free | frotz'
@@ -57,7 +59,7 @@ class ZCodeGameData(GameData):
                 engine = 'gargoyle-free'
                 entry['Terminal'] = 'false'
             entry['TryExec'] = engine
-            arg = '/' + package.install_to + '/' + list(package.install)[0]
+            arg = '/' + package.install_to + '/' + package.only_file
             entry['Exec'] = engine + ' ' + arg
 
             pixdir = os.path.join(destdir, 'usr/share/pixmaps')

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