[game-data-packager] 01/01: look for paths in .scummvmrc

Alexandre Detiste detiste-guest at moszumanska.debian.org
Sat Oct 17 21:48:26 UTC 2015


This is an automated email from the git hooks/post-receive script.

detiste-guest pushed a commit to branch master
in repository game-data-packager.

commit fc0d029560b06ebbaa0f3a0423fb2ef9007f5bf6
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Sat Oct 17 23:48:00 2015 +0200

    look for paths in .scummvmrc
---
 game_data_packager/build.py                |  7 +++++++
 game_data_packager/games/scummvm_common.py | 21 +++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/game_data_packager/build.py b/game_data_packager/build.py
index ada6f23..ede95a7 100644
--- a/game_data_packager/build.py
+++ b/game_data_packager/build.py
@@ -1770,6 +1770,9 @@ class PackagingTask(object):
         else:
             return FillResult.UPGRADE_NEEDED
 
+    def iter_extra_paths(self, packages):
+        return []
+
     def look_for_files(self, paths=(), search=True, packages=None):
         paths = list(paths)
 
@@ -1801,6 +1804,10 @@ class PackagingTask(object):
                 if path not in paths:
                     paths.append(path)
 
+            for path in self.iter_extra_paths(packages):
+                if path not in paths:
+                    paths.append(path)
+
         for arg in paths:
             logger.debug('%s...', arg)
             self.consider_file_or_dir(arg)
diff --git a/game_data_packager/games/scummvm_common.py b/game_data_packager/games/scummvm_common.py
index f639dc9..a367081 100644
--- a/game_data_packager/games/scummvm_common.py
+++ b/game_data_packager/games/scummvm_common.py
@@ -58,6 +58,27 @@ class ScummvmGameData(GameData):
         return ScummvmTask(self, **kwargs)
 
 class ScummvmTask(PackagingTask):
+    def iter_extra_paths(self, packages):
+        super(ScummvmTask, self).iter_extra_paths(packages)
+
+        # http://wiki.scummvm.org/index.php/User_Manual/Configuring_ScummVM
+        rcfile = os.path.expanduser('~/.scummvmrc')
+        if not os.path.isfile(rcfile):
+            return
+
+        config = configparser.ConfigParser()
+        config.read(rcfile, encoding='utf-8')
+        gameids = set(p.gameid or self.game.gameid for p in packages)
+        for section in config.sections():
+            for gameid in gameids:
+                if section.startswith(gameid):
+                    if 'path' not in config[section]:
+                        # invalid .scummvmrc
+                        continue
+                    path = config[section]['path']
+                    if os.path.isdir(path):
+                        yield path
+
     def fill_extra_files(self, package, destdir):
         super(ScummvmTask, self).fill_extra_files(package, destdir)
         if package.type == 'expansion':

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