[Qa-jenkins-scm] [jenkins.debian.net] 01/01: reproducible: json: fix tempfile handling, to avoid (non-fatal) FileNotFoundError

Holger Levsen holger at moszumanska.debian.org
Thu Jul 9 16:33:37 UTC 2015


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit 0a50eee46dc82a1992e74aa89c25715f65a4be55
Author: Mattia Rizzolo <mattia at mapreri.org>
Date:   Thu Jul 9 16:28:10 2015 +0000

    reproducible: json: fix tempfile handling, to avoid (non-fatal) FileNotFoundError
---
 bin/reproducible_json.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bin/reproducible_json.py b/bin/reproducible_json.py
index d5d7aaf..3103147 100755
--- a/bin/reproducible_json.py
+++ b/bin/reproducible_json.py
@@ -36,12 +36,12 @@ for row in result:
     log.debug(pkg)
     output.append(pkg)
 
-tmpfile = tempfile.NamedTemporaryFile(dir=os.path.dirname(REPRODUCIBLE_JSON))
+tmpfile = tempfile.mkstemp(dir=os.path.dirname(REPRODUCIBLE_JSON))[1]
 
-with open(tmpfile.name, 'w') as fd:
+with open(tmpfile, 'w') as fd:
     json.dump(output, fd, indent=4, sort_keys=True)
 
-os.rename(tmpfile.name, REPRODUCIBLE_JSON)
+os.rename(tmpfile, REPRODUCIBLE_JSON)
 os.chmod(REPRODUCIBLE_JSON, 0o644)
 
 log.info(REPRODUCIBLE_URL + '/reproducible.json has been updated.')

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list