[game-data-packager] 02/02: yaml2json: delete leftover obsolete files

Alexandre Detiste detiste-guest at moszumanska.debian.org
Sat Oct 3 06:59:27 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 1a278ea085f7a70616181cbec9ab5c398d8781d5
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Sat Oct 3 08:58:47 2015 +0200

    yaml2json: delete leftover obsolete files
---
 tools/yaml2json.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/yaml2json.py b/tools/yaml2json.py
index b3b6305..6495c38 100755
--- a/tools/yaml2json.py
+++ b/tools/yaml2json.py
@@ -41,9 +41,9 @@ def main(f, out):
     for k in ('cksums', 'sha1sums', 'sha256sums', 'md5sums',
             'size_and_md5'):
         v = data.pop(k, None)
+        offload = os.path.splitext(out)[0] + '.' + k
 
         if v is not None:
-            offload = os.path.splitext(out)[0] + '.' + k
             with open(offload + '.tmp', 'w', encoding='utf-8') as writer:
                 for line in v.splitlines():
                     stripped = line.strip()
@@ -52,6 +52,8 @@ def main(f, out):
                     writer.write(line)
                     writer.write('\n')
             os.rename(offload + '.tmp', offload)
+        elif os.path.isfile(offload):
+            os.remove(offload)
 
     json.dump(data, open(out + '.tmp', 'w', encoding='utf-8'), sort_keys=True)
     os.rename(out + '.tmp', out)

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