summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_common.py
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-03-01 14:34:21 +0100
committerHolger Levsen <holger@layer-acht.org>2015-03-01 14:35:12 +0100
commitbaceb316d82eb30cd413204071625f1e2dae4a7f (patch)
tree3cbc0ecda191f98b6ec4a7ad0ee7562501136b97 /bin/reproducible_common.py
parentc8e63af710da441078fa1c9855ac8063ff9a64d0 (diff)
downloadjenkins.debian.net-baceb316d82eb30cd413204071625f1e2dae4a7f.tar.xz
reproducible: common: catch OSError EEXISTS while creating directories in write_html_page()
Diffstat (limited to 'bin/reproducible_common.py')
-rwxr-xr-xbin/reproducible_common.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index edc43ef8..7782f623 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -12,6 +12,7 @@
import os
import re
import sys
+import errno
import sqlite3
import logging
import argparse
@@ -208,7 +209,11 @@ def write_html_page(title, body, destfile, noheader=False, style_note=False, noe
html += html_footer.substitute(date=now)
else:
html += '</body>\n</html>'
- os.makedirs(destfile.rsplit('/', 1)[0], exist_ok=True)
+ try:
+ os.makedirs(destfile.rsplit('/', 1)[0], exist_ok=True)
+ except OSError as e:
+ if e.errno != errno.EEXIST: # that's 'File exists' error (errno 17)
+ raise
with open(destfile, 'w') as fd:
fd.write(html)