[game-data-packager] 31/39: Move special ROTT command-line parsing into Python
Simon McVittie
smcv at debian.org
Sun Jan 11 01:52:24 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 69d70b8b4d8bb1ac90bd34bc2e9cde53ddad1e2f
Author: Simon McVittie <smcv at debian.org>
Date: Sat Jan 10 21:42:45 2015 +0000
Move special ROTT command-line parsing into Python
---
debian/changelog | 4 +++
.../games/{tyrian.py => rott.py} | 13 ++++----
lib/game_data_packager/games/tyrian.py | 1 -
supported/rott | 38 ----------------------
4 files changed, 10 insertions(+), 46 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 3eb9156..1c16000 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,10 @@ game-data-packager (39) UNRELEASED; urgency=medium
* For YAML games distributed via Steam, search various likely locations
for Steam files: Wine, winetricks, PlayOnLinux or native Linux
* Automatically exclude __pycache__ from tarball
+ * Use a common go() method to wrap all YAML games
+ * Allow YAML games to have a Python subclass of GameData to customize
+ their behaviour, and use that to implement rott and tyrian's
+ historical command-line options
-- Simon McVittie <smcv at debian.org> Mon, 05 Jan 2015 19:38:04 +0000
diff --git a/lib/game_data_packager/games/tyrian.py b/lib/game_data_packager/games/rott.py
similarity index 70%
copy from lib/game_data_packager/games/tyrian.py
copy to lib/game_data_packager/games/rott.py
index 4b66fc8..4df8941 100644
--- a/lib/game_data_packager/games/tyrian.py
+++ b/lib/game_data_packager/games/rott.py
@@ -15,20 +15,19 @@
# 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
-logger = logging.getLogger('game-data-packager.games.tyrian')
+logger = logging.getLogger('game-data-packager.games.rott')
-class TyrianGameData(GameData):
+class ROTTGameData(GameData):
def add_parser(self, parsers):
- parser = super(TyrianGameData, self).add_parser(parsers)
+ parser = super(ROTTGameData, self).add_parser(parsers)
parser.add_argument('-f', action='append', dest='paths',
- metavar='tyrian21.zip', help='Path to tyrian21.zip')
+ metavar='1rott13.zip', help='Path to 1rott13.zip')
parser.add_argument('-w', dest='download', action='store_true',
- help='Download tyrian21.zip (done automatically if necessary)')
+ help='Download 1rott13.zip (done automatically if necessary)')
return parser
-GAME_DATA_SUBCLASS = TyrianGameData
+GAME_DATA_SUBCLASS = ROTTGameData
diff --git a/lib/game_data_packager/games/tyrian.py b/lib/game_data_packager/games/tyrian.py
index 4b66fc8..4cb766c 100644
--- a/lib/game_data_packager/games/tyrian.py
+++ b/lib/game_data_packager/games/tyrian.py
@@ -15,7 +15,6 @@
# 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
diff --git a/supported/rott b/supported/rott
index fd34534..dc196ed 100644
--- a/supported/rott
+++ b/supported/rott
@@ -1,42 +1,4 @@
SHORTNAME=rott
LONGNAME="Rise of the Triad"
-deb=rott-data
-
-rott_usage() {
- echo "game-data-packager ${SHORTNAME} arguments:"
- printf "\tgame-data-packager ${SHORTNAME} [ -f path ] | [ -w ]
-\t\t-f path\t\tpath to your existing copy of 1rott13.zip\n\
-\t\t-w\t\tfetch 1rott13.zip from the World Wide Web\n"
-}
. "$LIBDIR/via-python"
-
-go() {
- case $# in
- 0)
- rott_usage
- exit 0
- ;;
- 1)
- if [ "$1" != "-w" ]; then
- usage >&2
- rott_usage >&2
- exit 1
- fi
- gdp_data_driven rott --
- ;;
- 2)
- if [ "$1" != "-f" ]; then
- usage >&2
- rott_usage >&2
- exit 1
- fi
- gdp_data_driven rott "$2"
- ;;
- *)
- usage >&2
- rott_usage >&2
- exit 1
- ;;
- esac
-}
--
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