[game-data-packager] 16/16: unreal plugin: support Unreal Tournament (1999) too, they're similar

Simon McVittie smcv at debian.org
Fri Jan 8 09:14:04 UTC 2016


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 1687a1ee9e1bba1f047533adb688ad2eabe17bcc
Author: Simon McVittie <smcv at debian.org>
Date:   Thu Jan 7 10:51:28 2016 +0000

    unreal plugin: support Unreal Tournament (1999) too, they're similar
---
 game_data_packager/games/unreal.py | 56 ++++++++++++++++++++++++--------------
 1 file changed, 36 insertions(+), 20 deletions(-)

diff --git a/game_data_packager/games/unreal.py b/game_data_packager/games/unreal.py
index bcf39f1..204abc7 100644
--- a/game_data_packager/games/unreal.py
+++ b/game_data_packager/games/unreal.py
@@ -30,9 +30,13 @@ class UnrealTask(PackagingTask):
 
         if package.name == 'unreal-data':
             with TemporaryUmask(0o022):
-                self.__convert_logo(destdir)
+                self.__convert_logo(destdir, package, 'skaarj_logo.jpg')
 
-        if package.name in ('unreal-gold', 'unreal-classic'):
+        if package.name == 'ut99-data':
+            with TemporaryUmask(0o022):
+                self.__convert_logo(destdir, package, 'ut99.gif')
+
+        if package.name in ('unreal-gold', 'unreal-classic', 'ut99'):
             with TemporaryUmask(0o022):
                 self.__add_manifest(package, destdir)
 
@@ -47,39 +51,51 @@ class UnrealTask(PackagingTask):
         with open(os.path.join(destdir, install_to, 'System',
                 'Manifest.ini'), 'w') as writer:
             if package.name == 'unreal-gold':
-                groups = ('UnrealGold', 'Unreal Gold')
+                groups = (('UnrealGold', package.name, package.version),
+                        ('Unreal Gold', package.name, package.version))
+                sample_file = 'System\\UnrealLinux.ini'
+            elif package.name == 'ut99':
+                groups = (('UnrealTournament', package.name, package.version),
+                        ('UTBonusPack', 'Unreal Tournament Bonus Pack', '100'),
+                        ('DEMutators', 'DEMutators', '101'),
+                        ('UTInoxxPack', 'Unreal Tournament Inoxx Pack', '100'),
+                        ('UTBonusPack4', 'Unreal Tournament Bonus Pack 4',
+                            '100'))
+                sample_file = 'System\\UnrealTournament.ini'
             else:
-                groups = ('Unreal',)
+                groups = (('Unreal', package.name, package.version))
+                sample_file = 'System\\UnrealLinux.ini'
 
-            lines = ['[Setup]', 'MasterProduct=' + groups[0]]
+            lines = ['[Setup]', 'MasterProduct=' + groups[0][0]]
 
             for g in groups:
-                lines.append('Group=' + g)
+                lines.append('Group=' + g[0])
 
             for g in groups:
                 lines.append('')
-                lines.append('[' + g + ']')
-                lines.append('Caption=' + package.longname)
-                lines.append('Version=227i')
-                lines.append('File=System\\UnrealLinux.ini')
+                lines.append('[' + g[0] + ']')
+                lines.append('Caption=' + g[1])
+                lines.append('Version=' + g[2])
+                lines.append('File=' + sample_file)
 
             lines += ['', '[RefCounts]',
-                    'File:System\\UnrealLinux.ini=%d' % len(groups), '']
+                    'File:%s=%d' % (sample_file, len(groups)), '']
 
             for line in lines:
                 writer.write(line + '\r\n')
 
-    def __convert_logo(self, destdir):
-        skaarj_logo = os.path.join(destdir, self.packaging.ASSETS, 'unreal',
-                'skaarj_logo.jpg')
+    def __convert_logo(self, destdir, package, logo_name):
+        source_logo = os.path.join(destdir,
+                self.packaging.substitute(package.install_to, package.name),
+                logo_name)
 
         try:
             import gi
             gi.require_version('GdkPixbuf', '2.0')
             from gi.repository import GdkPixbuf
         except:
-            logger.warning('Unable to load GdkPixbuf bindings. Unreal icon '
-                    'will not be resized or converted')
+            logger.warning('Unable to load GdkPixbuf bindings. %s icon '
+                    'will not be resized or converted' % self.game.longname)
             return
 
         mkdir_p(os.path.join(destdir, 'usr', 'share', 'icons',
@@ -87,14 +103,14 @@ class UnrealTask(PackagingTask):
         mkdir_p(os.path.join(destdir, 'usr', 'share', 'icons',
                 'hicolor', '256x256', 'apps'))
 
-        pixbuf = GdkPixbuf.Pixbuf.new_from_file(skaarj_logo)
+        pixbuf = GdkPixbuf.Pixbuf.new_from_file(source_logo)
         pixbuf.savev(os.path.join(destdir, 'usr', 'share', 'icons',
-                    'hicolor', '256x256', 'apps', 'unreal.png'),
+                    'hicolor', '256x256', 'apps', self.game.shortname + '.png'),
                 'png', [], [])
 
-        pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(skaarj_logo, 48, 48)
+        pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(source_logo, 48, 48)
         pixbuf.savev(os.path.join(destdir, 'usr', 'share', 'icons',
-                    'hicolor', '48x48', 'apps', 'unreal.png'),
+                    'hicolor', '48x48', 'apps', self.game.shortname + '.png'),
                 'png', [], [])
 
 class UnrealGameData(GameData):

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