[game-data-packager] 34/39: Add --demo option to all YAML games with a demo/shareware version, which will download/create the demo even if the full game is available

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 dd13083ad4a6f9f96dc86f6ddc6a365e1aabd277
Author: Simon McVittie <smcv at debian.org>
Date:   Sat Jan 10 22:17:40 2015 +0000

    Add --demo option to all YAML games with a demo/shareware version, which will download/create the demo even if the full game is available
---
 debian/changelog                   |  2 ++
 lib/game_data_packager/__init__.py | 13 ++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 1c16000..b221bc1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,8 @@ game-data-packager (39) UNRELEASED; urgency=medium
   * 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
+  * Add --demo option to all YAML games with a demo/shareware version,
+    which will download/create the demo even if the full game is available
 
  -- Simon McVittie <smcv at debian.org>  Mon, 05 Jan 2015 19:38:04 +0000
 
diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
index 49f95c6..3b9a6b3 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -1103,6 +1103,17 @@ class GameData(object):
         parser.add_argument('paths', nargs='*',
                 metavar='DIRECTORY|FILE',
                 help='Files to use in constructing the .deb')
+
+        # There is only a --demo option if at least one package is a demo
+        parser.set_defaults(demo=False)
+        for package in self.packages.values():
+            if package.type == 'demo':
+                parser.add_argument('--demo', action='store_true',
+                        default=False,
+                        help='Build demo package even if files for full '
+                            + 'version are available')
+                break
+
         return parser
 
     def run_command_line(self, args, outdir=''):
@@ -1180,7 +1191,7 @@ class GameData(object):
                 have_full = True
 
         for package in possible:
-            if have_full and package.type == 'demo':
+            if have_full and package.type == 'demo' and not args.demo:
                 # no point in packaging the demo if we have the full
                 # version
                 logger.debug('will not produce %s because we have a full ' +

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