[game-data-packager] 01/04: Support multiple files and versions in z_code games

Stephen Kitt skitt at moszumanska.debian.org
Sun Jan 10 17:45:57 UTC 2016


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

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

commit 77573abe710f3e1fffbd73dd3fae76187fdf7384
Author: Stephen Kitt <steve at sk2.org>
Date:   Sun Jan 10 15:55:02 2016 +0100

    Support multiple files and versions in z_code games
    
    Z-machine games come in versions from 1 to 8.
    
    Z6 games include graphical resources, so z_code games need to support
    multiple files (although only one can be the .z? game file).
---
 game_data_packager/games/z_code.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/game_data_packager/games/z_code.py b/game_data_packager/games/z_code.py
index 08ca1b8..80adc09 100644
--- a/game_data_packager/games/z_code.py
+++ b/game_data_packager/games/z_code.py
@@ -19,6 +19,7 @@
 import configparser
 import logging
 import os
+import re
 
 from .. import GameData
 from ..build import (PackagingTask)
@@ -31,8 +32,12 @@ logger = logging.getLogger('game-data-packager.games.z_code')
 class ZCodeGameData(GameData):
     def __init__(self, shortname, data):
         super(ZCodeGameData, self).__init__(shortname, data)
+        one_z_file = False
         for package in self.packages.values():
-            assert os.path.splitext(package.only_file)[1] == '.z3'
+            for install in package.install:
+                if re.match('^.z[12345678]$', os.path.splitext(install)[1]):
+                    one_z_file = not one_z_file
+        assert one_z_file
 
         if self.engine is None:
             self.engine = 'gargoyle-free | frotz'
@@ -69,7 +74,9 @@ class ZCodeTask(PackagingTask):
                         entry['Terminal'] = 'true'
                         break
             entry['TryExec'] = engine
-            arg = '/' + install_to + '/' + package.only_file
+            for wanted in package.install_files:
+                if re.match('^.z[12345678]$', os.path.splitext(wanted.name)[1]):
+                    arg = '/' + install_to + '/' + wanted.name
             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