summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/scripts/gettext.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/mesonbuild/scripts/gettext.py b/mesonbuild/scripts/gettext.py
index f308c5a3b..593247afd 100644
--- a/mesonbuild/scripts/gettext.py
+++ b/mesonbuild/scripts/gettext.py
@@ -81,9 +81,11 @@ def do_install(src_sub, bld_sub, dest, pkgname, langs):
srcfile = os.path.join(bld_sub, l + '.gmo')
outfile = os.path.join(dest, l, 'LC_MESSAGES',
pkgname + '.mo')
+ tempfile = outfile + '.tmp'
os.makedirs(os.path.dirname(outfile), exist_ok=True)
- shutil.copyfile(srcfile, outfile)
- shutil.copystat(srcfile, outfile)
+ shutil.copyfile(srcfile, tempfile)
+ shutil.copystat(srcfile, tempfile)
+ os.replace(tempfile, outfile)
print('Installing %s to %s' % (srcfile, outfile))
return 0