[game-data-packager] 03/11: make_template: add heuristic to detect documentation

Simon McVittie smcv at debian.org
Sun Jan 25 19:29:36 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 af36c16d5bd2c8f968ef07389971e4498665ead9
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Sun Jan 25 14:29:28 2015 +0100

    make_template: add heuristic to detect documentation
    
    also trim out 'files:', as this would be reserved for special
    cases handling; the size info is already in 'cksums: |'
---
 game_data_packager/make_template.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/game_data_packager/make_template.py b/game_data_packager/make_template.py
index ef0f89d..c57fa6d 100644
--- a/game_data_packager/make_template.py
+++ b/game_data_packager/make_template.py
@@ -30,6 +30,15 @@ from . import HashedFile
 logging.basicConfig()
 logger = logging.getLogger('game_data_packager.make-template')
 
+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'):
+        if word in name:
+            return True
+    return False
+
 def do_one_dir(destdir):
     data = dict(files={})
     package = data.setdefault('packages', {}).setdefault('FIXME', {})
@@ -52,7 +61,9 @@ def do_one_dir(destdir):
                 package.setdefault('symlinks', {})[name] = os.path.realpath(path).lstrip('/')
             elif os.path.isfile(path):
                 package['install'].append(name)
-                data['files'][name] = dict(size=os.path.getsize(path))
+                #data['files'][name] = dict(size=os.path.getsize(path))
+                if is_doc(fn):
+                     data['files'][name] = dict(install_to='$docdir')
 
                 hf = HashedFile.from_file(name, open(path, 'rb'))
                 sums['ck'][name] = os.path.getsize(path)

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