summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-07-09 16:28:10 +0000
committerHolger Levsen <holger@layer-acht.org>2015-07-09 18:33:14 +0200
commit0a50eee46dc82a1992e74aa89c25715f65a4be55 (patch)
treeaa1de936a91247a612055a58753079d046652906 /bin
parentd291f7e1ee36b4a66a304e29666fc59e5c3fafb6 (diff)
downloadjenkins.debian.net-0a50eee46dc82a1992e74aa89c25715f65a4be55.tar.xz
reproducible: json: fix tempfile handling, to avoid (non-fatal) FileNotFoundError
Diffstat (limited to 'bin')
-rwxr-xr-xbin/reproducible_json.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/reproducible_json.py b/bin/reproducible_json.py
index d5d7aaf5..3103147d 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.')