[game-data-packager] 09/19: Change handling of non-distinctive names

Simon McVittie smcv at debian.org
Tue Jan 13 11:34:38 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 139abaef1c52ad016a5b47d3ad29f6e1f4be3c61
Author: Simon McVittie <smcv at debian.org>
Date:   Tue Jan 13 10:10:12 2015 +0000

    Change handling of non-distinctive names
    
    We still use the name as a hint for where to look, but quietly ignore
    checksum mismatches.
---
 lib/game_data_packager/__init__.py | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
index d2fc3c8..00e603f 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -463,9 +463,8 @@ class GameData(object):
             if f.distinctive_size and f.size is not None:
                 self.known_sizes.setdefault(f.size, set()).add(filename)
 
-            if f.distinctive_name:
-                for lf in f.look_for:
-                    self.known_filenames.setdefault(lf, set()).add(filename)
+            for lf in f.look_for:
+                self.known_filenames.setdefault(lf, set()).add(filename)
 
             if f.md5 is not None:
                 if self.known_md5s.get(f.md5):
@@ -748,13 +747,18 @@ class GameData(object):
                         continue
                     tried.add(wanted_name)
                     if self.use_file(self.files[wanted_name], path, hashes,
-                            log=(len(candidates) == 1)):
+                            log=(self.files[wanted_name].distinctive_name
+                                and len(candidates) == 1)):
                         return
                 else:
                     if len(candidates) > 1:
-                        self._log_not_any_of(path, size, hashes,
-                                'possible "%s"' % look_for,
-                                [self.files[c] for c in candidates])
+                        candidates = [self.files[c] for c in candidates]
+                        for candidate in candidates:
+                            if not candidate.distinctive_name:
+                                break
+                            else:
+                                self._log_not_any_of(path, size, hashes,
+                                        'possible "%s"' % look_for, candidates)
 
         if size in self.known_sizes:
             hashes = self._ensure_hashes(hashes, path, size)

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