[game-data-packager] 10/12: quake: create tryexec scripts

Simon McVittie smcv at debian.org
Tue Jan 13 22:57:27 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 f0d475ae555f3eb658cab19153d1e184c849ad8e
Author: Simon McVittie <smcv at debian.org>
Date:   Tue Jan 13 22:23:34 2015 +0000

    quake: create tryexec scripts
---
 data/quake.yaml                       |  2 --
 lib/game_data_packager/games/quake.py | 50 +++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/data/quake.yaml b/data/quake.yaml
index e1c5f20..654e8ba 100644
--- a/data/quake.yaml
+++ b/data/quake.yaml
@@ -16,14 +16,12 @@ packages:
     install_to: usr/share/games/quake
 
   quake-armagon:
-    # FIXME: also needs to create executable hipnotic-tryexec.sh
     longname: "Quake Mission Pack 1: Scourge of Armagon"
     install:
     - hipnotic/pak0.pak
     install_to: usr/share/games/quake
 
   quake-dissolution:
-    # FIXME: also needs to create executable rogue-tryexec.sh
     longname: "Quake Mission Pack 2: Dissolution of Eternity"
     install:
     - rogue/pak0.pak
diff --git a/lib/game_data_packager/games/quake.py b/lib/game_data_packager/games/quake.py
new file mode 100644
index 0000000..f70b64b
--- /dev/null
+++ b/lib/game_data_packager/games/quake.py
@@ -0,0 +1,50 @@
+#!/usr/bin/python3
+# vim:set fenc=utf-8:
+#
+# Copyright © 2015 Simon McVittie <smcv at debian.org>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# You can find the GPL license text on a Debian system under
+# /usr/share/common-licenses/GPL-2.
+
+import logging
+
+from .. import GameData
+
+logger = logging.getLogger('game-data-packager.games.quake')
+
+class QuakeGameData(GameData):
+    """With hindsight, it would have been better to make the TryExec
+    in quake point to a symlink to the quake executable, or something;
+    but with a name like hipnotic-tryexec.sh it would seem silly for it
+    not to be a shell script.
+    """
+
+    def fill_extra_files(self, package, destdir):
+        super(QuakeGameData, self).fill_extra_files(package, destdir)
+
+        for path in package.install:
+            if path.startswith('hipnotic'):
+                detector = 'hipnotic-tryexec.sh'
+            elif path.startswith('rogue'):
+                detector = 'rogue-tryexec.sh'
+            else:
+                return
+
+        with TemporaryUmask(0o022):
+            quakedir = os.path.join(destdir, 'usr/share/games/quake')
+            mkdir_p(quakedir)
+            path = os.path.join(quakedir, detector)
+            with open(os.path.join(quakedir, detector), 'w') as f:
+                f.write('#!/bin/sh\nexit 0\n')
+            os.chmod(path, 0o755)
+
+GAME_DATA_SUBCLASS = QuakeGameData

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