[game-data-packager] 01/01: make-template: read "try_repack_from: ['~/GOG Games/<something>']" from lua
Alexandre Detiste
detiste-guest at moszumanska.debian.org
Sun Oct 4 00:01:28 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 a423c8d90bc840a9764bcae116d8ae91749a9a3a
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date: Sun Oct 4 01:59:37 2015 +0200
make-template: read "try_repack_from: ['~/GOG Games/<something>']" from lua
... script used by MojoSetup
---
data/rott.yaml | 1 +
game_data_packager/make_template.py | 26 ++++++++++++++++++++++----
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/data/rott.yaml b/data/rott.yaml
index 573036d..4ec66b2 100644
--- a/data/rott.yaml
+++ b/data/rott.yaml
@@ -3,6 +3,7 @@ longname: Rise of the Triad
copyright: © 1995 Apogee Software
engine: rott
genre: First-person shooter
+try_repack_from: ["~/GOG Games/Rise of the Triad Dark War"]
steam:
id: 238050
diff --git a/game_data_packager/make_template.py b/game_data_packager/make_template.py
index 1cdd77d..694186d 100644
--- a/game_data_packager/make_template.py
+++ b/game_data_packager/make_template.py
@@ -24,6 +24,7 @@ import sys
import tarfile
import tempfile
import glob
+import zipfile
from debian.deb822 import Deb822
from debian.debian_support import Version
@@ -91,7 +92,7 @@ class GameData(object):
'''simplified object with only one package per game'''
def __init__(self):
self.longname = None
- self.try_repack_from = None
+ self.try_repack_from = []
self.plugin = None
self.gog_url = None
self.gog_game = None
@@ -139,7 +140,7 @@ class GameData(object):
def add_one_dir(self,destdir,lower,archive=None):
if destdir.startswith('/usr/local') or destdir.startswith('/opt/'):
- self.try_repack_from = destdir
+ self.try_repack_from.append(destdir)
game = os.path.basename(os.path.abspath(destdir))
if game.endswith('-data'):
@@ -213,6 +214,21 @@ class GameData(object):
if self.plugin != 'scummvm_common':
self.package['install_to'] = 'usr/share/games/' + game
+ def add_one_zip(self,archive):
+ # TODO
+ return
+
+ def add_one_gog_sh(self,archive):
+ self.add_one_zip(archive)
+ with zipfile.ZipFile(archive, 'r') as zf:
+ if 'scripts/config.lua' in zf.namelist():
+ with zf.open('scripts/config.lua') as metadata:
+ for line in metadata.read().decode().splitlines():
+ line = line.strip()
+ if line.startswith('id = '):
+ dir = '~/GOG Games/' + line.split('"')[1]
+ self.try_repack_from.append(dir)
+
def add_one_innoextract(self,exe):
self.gog_game = GOG.get_id_from_archive(exe)
@@ -367,7 +383,7 @@ class GameData(object):
print('longname: %s' % self.longname)
print('copyright: © 1970 FIXME')
if self.try_repack_from:
- print('try_repack_from: [- %s]' % self.try_repack_from)
+ print('try_repack_from: %s' % self.try_repack_from)
if self.plugin:
print('plugin: %s' % self.plugin)
if self.gog_url:
@@ -580,10 +596,12 @@ def main():
gamedata.add_one_file(arg,args.lower)
gamedata.files['files'][basename] = dict(unpack=dict(format='deb'),
provides=['<stuff>'])
- elif os.path.basename(arg).startswith('setup_') and arg.endswith('.exe'):
+ elif basename.startswith('setup_') and arg.endswith('.exe'):
if not which('innoextract'):
exit('Install innoextract')
gamedata.add_one_innoextract(arg)
+ elif basename.startswith('gog_') and arg.endswith('.sh'):
+ gamedata.add_one_gog_sh(arg)
elif len(args.args) == 1:
do_one_file(arg,args.lower)
return
--
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