[game-data-packager] 19/39: Let YAML games provide help text

Simon McVittie smcv at debian.org
Sun Jan 11 01:52:22 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 2c0615745cb72c11b7cf00bf0278c2cc28fa7559
Author: Simon McVittie <smcv at debian.org>
Date:   Sat Jan 10 20:42:46 2015 +0000

    Let YAML games provide help text
---
 data/ja.yaml                           | 17 +++++++++++++++++
 data/jk2.yaml                          | 12 ++++++++++++
 data/quake3.yaml                       | 21 +++++++++++++++++++++
 data/rtcw.yaml                         | 23 ++++++-----------------
 data/tyrian.yaml                       |  5 +++++
 lib/game_data_packager/__init__.py     | 14 ++++++++++++--
 lib/game_data_packager/games/tyrian.py | 11 ++++-------
 7 files changed, 77 insertions(+), 26 deletions(-)

diff --git a/data/ja.yaml b/data/ja.yaml
index 827601f..29c2652 100644
--- a/data/ja.yaml
+++ b/data/ja.yaml
@@ -8,6 +8,23 @@ longname: "Star Wars Jedi Knight: Jedi Academy"
 # but that's less than 2% of the total size and takes 10 times as long.
 compress_deb: false
 
+help_text: |
+  For jedi-academy-data, directories provided should be one
+  of these:
+
+  * an installation of Jedi Academy retail CD-ROM, patched to version 1.01
+    using Windows or Wine (download jkacademy1_01.exe, sha256:
+    2bb34035ed65f4855e2e17e1b56076543947e426bac794b098b58c039ec253dc)
+
+  * an installation of Jedi Academy 1.01 from Steam
+    (<http://store.steampowered.com/app/6020/>)
+    via Windows or Wine, typically found in
+    C:/Program Files/Steam/steamapps/common/Jedi Academy
+
+  For jedi-academy-bonus-data, provide the optional free addons
+  jabonusmaps.exe and jasiegedestroyer.exe, or the PK3 files base/bonus.pk3
+  and base/siege_destroyer.pk3, or a directory containing them.
+
 packages:
   jedi-academy-data:
     type: full
diff --git a/data/jk2.yaml b/data/jk2.yaml
index 730cdda..87d2491 100644
--- a/data/jk2.yaml
+++ b/data/jk2.yaml
@@ -6,6 +6,18 @@ longname: "Star Wars Jedi Knight II: Jedi Outcast"
 # Like Jedi Academy, there isn't much point in compressing this .deb.
 compress_deb: false
 
+help_text: |
+  The directories provided should be one of these:
+
+  * an installation of Jedi Outcast retail CD-ROM, patched to
+    version 1.04 using Windows or Wine (download jkiiup104.exe, sha256:
+    de80f478a48f91d6237b8efc7048e4803a198e9ac02f11d64980eddcd818fad7)
+
+  * an installation of Jedi Outcast 1.04 from Steam
+    (<http://store.steampowered.com/app/6030/>)
+    via Windows or Wine, typically found in
+    C:/Program Files/Steam/steamapps/common/Jedi Outcast
+
 packages:
   jedi-outcast-data:
     type: full
diff --git a/data/quake3.yaml b/data/quake3.yaml
index 8fd9497..57af15b 100644
--- a/data/quake3.yaml
+++ b/data/quake3.yaml
@@ -4,6 +4,27 @@ shortname: quake3
 longname: Quake III Arena (including Team Arena)
 compress_deb: false
 
+help_text: |
+  For quake3-data, you must provide baseq3/pak0.pk3 or a directory
+  containing it. It can be found in installed copies of Quake III Arena
+  for any platform, or on the CD-ROM.
+
+  The 1.32 patch will be downloaded if necessary, but you can avoid the
+  download by providing linuxq3apoint-1.32b-3.x86.run or the individual
+  PK3 files (including missionpack/*.pk3).
+
+  For the quake3-team-arena-data addon pack, you must provide
+  missionpack/pak0.pk3 or a directory containing it. It can be found in
+  installed copies of Quake III Team Arena for any platform, or on the CD-ROM.
+
+  Available on Steam as <http://store.steampowered.com/app/2200/> (Q3A) and
+  <http://store.steampowered.com/app/2350/> (Q3TA).
+
+# FIXME:
+# Steam installations would typically be in:
+# C:/Program Files/Steam/steamapps/common/<what?>
+
+
 packages:
   quake3-data:
     type: full
diff --git a/data/rtcw.yaml b/data/rtcw.yaml
index 9f965ae..dcd809c 100644
--- a/data/rtcw.yaml
+++ b/data/rtcw.yaml
@@ -59,24 +59,13 @@ packages:
       #  size: 9559
       #  optional: true
 
-# Not used yet. FIXME: use this to make help text?
-sources:
-  "a Return to Castle Wolfenstein installation":
-    provides:
-    - main/autoexec.cfg
-    - main/mp_pak0.pk3
-    - main/mp_pak1.pk3
-    - main/mp_pak2.pk3
-    - main/pak0.pk3
-    - "FIXME: main/sp_pak1.pk3_en or main/sp_pak1.pk3_fr"
-    - main/sp_pak2.pk3
-    help: |
-      Install Return to Castle Wolfenstein from CD-ROM using Windows or Wine,
-      or install it from Steam <http://store.steampowered.com/app/9010/>,
-      and tell game-data-packager the installation directory.
+help_text: |
+  Install Return to Castle Wolfenstein from CD-ROM using Windows or Wine,
+  or install it from Steam <http://store.steampowered.com/app/9010/>,
+  and tell game-data-packager the installation directory.
 
-      Steam installations would typically be in:
-      C:/Program Files/Steam/steamapps/common/Return to Castle Wolfenstein
+  Steam installations would typically be in:
+  C:/Program Files/Steam/steamapps/common/Return to Castle Wolfenstein
 
 files:
   main/sp_pak1.pk3:
diff --git a/data/tyrian.yaml b/data/tyrian.yaml
index f274482..d7e37e7 100644
--- a/data/tyrian.yaml
+++ b/data/tyrian.yaml
@@ -3,6 +3,11 @@
 shortname: tyrian
 longname: Tyrian
 
+help_text: |
+  The full version of Tyrian can be downloaded at no cost.
+  game-data-packager will automatically download it if required.
+  You can skip the download by providing tyrian21.zip or its contents.
+
 packages:
   tyrian-data:
     type: full
diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
index f6deadd..dfdd9fc 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -290,6 +290,8 @@ class GameData(object):
         # If true, we may compress the .deb. If false, don't.
         self.compress_deb = True
 
+        self.help_text = ''
+
         self.yaml = yaml.load(open(os.path.join(self.datadir,
             shortname + '.yaml')))
 
@@ -364,6 +366,9 @@ class GameData(object):
         if 'compress_deb' in self.yaml:
             self.compress_deb = self.yaml['compress_deb']
 
+        if 'help_text' in self.yaml:
+            self.help_text = self.yaml['help_text']
+
         # consistency check
         for package in self.packages.values():
             # there had better be something it wants to install
@@ -423,6 +428,7 @@ class GameData(object):
             packages[name] = package.to_yaml()
 
         return {
+            'help_text': self.help_text,
             'packages': packages,
             'providers': providers,
             'files': files,
@@ -1065,11 +1071,15 @@ class GameData(object):
 
     def add_parser(self, parsers):
         parser = parsers.add_parser(self.shortname,
-                help=self.longname, aliases=self.packages.keys())
+                help=self.longname, aliases=self.packages.keys(),
+                description=self.help_text,
+                formatter_class=argparse.RawDescriptionHelpFormatter)
         parser.add_argument('--repack', action='store_true',
                 help='Locate installed game files automatically')
         parser.add_argument('paths', nargs='*',
-                metavar='DIRECTORY|FILE')
+                metavar='DIRECTORY|FILE',
+                help='Files to use in constructing the .deb')
+        return parser
 
     def run_command_line(self, args, outdir=''):
         logger.debug('package description:\n%s',
diff --git a/lib/game_data_packager/games/tyrian.py b/lib/game_data_packager/games/tyrian.py
index a199c6c..4b66fc8 100644
--- a/lib/game_data_packager/games/tyrian.py
+++ b/lib/game_data_packager/games/tyrian.py
@@ -15,6 +15,7 @@
 # You can find the GPL license text on a Debian system under
 # /usr/share/common-licenses/GPL-2.
 
+import argparse
 import logging
 
 from .. import GameData
@@ -23,15 +24,11 @@ logger = logging.getLogger('game-data-packager.games.tyrian')
 
 class TyrianGameData(GameData):
     def add_parser(self, parsers):
-        parser = parsers.add_parser(self.shortname,
-                help=self.longname, aliases=self.packages.keys())
+        parser = super(TyrianGameData, self).add_parser(parsers)
         parser.add_argument('-f', action='append', dest='paths',
-                help='Path to tyrian21.zip')
+                metavar='tyrian21.zip', help='Path to tyrian21.zip')
         parser.add_argument('-w', dest='download', action='store_true',
                 help='Download tyrian21.zip (done automatically if necessary)')
-        parser.add_argument('--repack', action='store_true',
-                help='Locate installed game files automatically')
-        parser.add_argument('paths', nargs='*',
-                metavar='DIRECTORY|FILE')
+        return parser
 
 GAME_DATA_SUBCLASS = TyrianGameData

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