[game-data-packager] 14/25: make_template: detect most DOSBOX files

Simon McVittie smcv at debian.org
Wed Feb 11 10:41:12 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 b47651bf1476c0b25528bb4f4cc0019ccec03202
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Mon Feb 9 20:13:32 2015 +0100

    make_template: detect most DOSBOX files
---
 game_data_packager/make_template.py | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/game_data_packager/make_template.py b/game_data_packager/make_template.py
index 55c62a5..67fb679 100644
--- a/game_data_packager/make_template.py
+++ b/game_data_packager/make_template.py
@@ -40,6 +40,18 @@ def is_doc(file):
             return True
     return False
 
+def is_dosbox(file):
+    basename = os.path.basename(file)
+    if basename in ('dosbox.conf', 'dosbox-0.71.tar.gz', 'dosbox.exe',
+                    'SDL_net.dll', 'SDL.dll', 'zmbv.dll', 'zmbv.inf'):
+         return True
+    # to check: COPYING.txt INSTALL.txt NEWS.txt THANKS.txt *.conf
+    if basename not in ('AUTHORS.txt', 'README.txt'):
+         return False
+    with open(file, 'r', encoding='latin1') as txt:
+         line = txt.readline()
+         return 'dosbox' in line.lower()
+
 def do_one_dir(destdir,lower):
     data = dict()
     files = dict(files={})
@@ -72,6 +84,7 @@ def do_one_dir(destdir,lower):
     install = set()
     optional = set()
     sums = dict(sha1={}, md5={}, sha256={}, ck={})
+    has_dosbox = False
 
     for dirpath, dirnames, filenames in os.walk(destdir):
         for fn in filenames:
@@ -85,8 +98,10 @@ def do_one_dir(destdir,lower):
 
             if os.path.isdir(path):
                 continue
+            elif is_dosbox(path):
+                has_dosbox = True
             elif os.path.splitext(fn.lower())[1] in ('.exe', '.ovl', '.dll', '.bat', '.386'):
-                logger.warning('ignoring dos/windows binary at %s' % path)
+                logger.warning('ignoring dos/windows binary %s' % fn)
             elif os.path.islink(path):
                 package.setdefault('symlinks', {})[name] = os.path.realpath(path).lstrip('/')
             elif os.path.isfile(path):
@@ -104,6 +119,9 @@ def do_one_dir(destdir,lower):
             else:
                 logger.warning('ignoring unknown file type at %s' % path)
 
+    if has_dosbox:
+        logger.warning('DOSBOX files detected, make sure not to include those in your package')
+
     print('%YAML 1.2')
     print('---')
     if longname:

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