[game-data-packager] 02/02: license shortcut: make-template

Alexandre Detiste detiste-guest at moszumanska.debian.org
Fri Apr 24 21:28:08 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 47e5d734744f1da2c9cad0e60a7dbf7c3c710cdc
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Fri Apr 24 23:27:27 2015 +0200

    license shortcut: make-template
---
 game_data_packager/make_template.py | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/game_data_packager/make_template.py b/game_data_packager/make_template.py
index bb7a81e..723b2b3 100644
--- a/game_data_packager/make_template.py
+++ b/game_data_packager/make_template.py
@@ -31,11 +31,21 @@ from .steam import parse_acf
 logging.basicConfig()
 logger = logging.getLogger('game_data_packager.make-template')
 
+
+def is_license(file):
+    name, ext = os.path.splitext(file.lower())
+    if ext not in ('.doc', '.htm', '.html', '.pdf', '.txt', ''):
+        return False
+    for word in ('eula', 'license', 'vendor'):
+        if word in name:
+            return True
+    return False
+
 def is_doc(file):
     name, ext = os.path.splitext(file.lower())
     if ext not in ('.doc', '.htm', '.html', '.pdf', '.txt', ''):
         return False
-    for word in ('changes', 'eula', 'license', 'manual', 'quickstart', 'readme', 'vendor'):
+    for word in ('changes', 'manual', 'quickstart', 'readme'):
         if word in name:
             return True
     return False
@@ -82,6 +92,7 @@ def do_one_dir(destdir,lower):
     package['install_to'] = 'usr/share/games/' + game
 
     install = set()
+    license = set()
     optional = set()
     sums = dict(sha1={}, md5={}, sha256={}, ck={})
     has_dosbox = False
@@ -115,7 +126,10 @@ def do_one_dir(destdir,lower):
             elif os.path.islink(path):
                 package.setdefault('symlinks', {})[name] = os.path.realpath(path).lstrip('/')
             elif os.path.isfile(path):
-                if is_doc(fn):
+                if is_license(fn):
+                     out_name = os.path.basename(out_name)
+                     license.add(out_name)
+                elif is_doc(fn):
                      optional.add(out_name)
                      files['files'][out_name] = dict(install_to='$docdir')
                 else:
@@ -148,6 +162,10 @@ def do_one_dir(destdir,lower):
         print('    optional:')
         for file in sorted(optional):
             print('    - %s' % file)
+    if license:
+        print('    license:')
+        for file in sorted(license):
+            print('    - %s' % file)
 
     if files['files']:
         yaml.safe_dump(files, stream=sys.stdout, default_flow_style=False)

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