aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorjonathan MERCIER <bioinfornatics@gmail.com>2019-04-03 20:42:15 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2019-04-03 21:42:15 +0300
commitff299eb36b7d5d89a3d2d1fdb5b489c9e7d05b29 (patch)
treeb1b45f33bd93cefa9ebc6052d5c9fb01210215e3 /mesonbuild
parent5ee2fb6ede7534fe8ad04e8bfa60f154e74889b3 (diff)
downloadmeson-ff299eb36b7d5d89a3d2d1fdb5b489c9e7d05b29.zip
meson-ff299eb36b7d5d89a3d2d1fdb5b489c9e7d05b29.tar.gz
meson-ff299eb36b7d5d89a3d2d1fdb5b489c9e7d05b29.tar.bz2
Read file as utf8 on python3
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/scripts/vcstagger.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/mesonbuild/scripts/vcstagger.py b/mesonbuild/scripts/vcstagger.py
index 62a45d9..16dd4d1 100644
--- a/mesonbuild/scripts/vcstagger.py
+++ b/mesonbuild/scripts/vcstagger.py
@@ -14,6 +14,7 @@
import sys, os, subprocess, re
+
def config_vcs_tag(infile, outfile, fallback, source_dir, replace_string, regex_selector, cmd):
try:
output = subprocess.check_output(cmd, cwd=source_dir)
@@ -21,17 +22,18 @@ def config_vcs_tag(infile, outfile, fallback, source_dir, replace_string, regex_
except Exception:
new_string = fallback
- with open(infile) as f:
+ with open(infile, encoding='utf8') as f:
new_data = f.read().replace(replace_string, new_string)
if os.path.exists(outfile):
- with open(outfile) as f:
+ with open(outfile, encoding='utf8') as f:
needs_update = (f.read() != new_data)
else:
needs_update = True
if needs_update:
- with open(outfile, 'w') as f:
+ with open(outfile, 'w', encoding='utf8') as f:
f.write(new_data)
+
def run(args):
infile, outfile, fallback, source_dir, replace_string, regex_selector = args[0:6]
command = args[6:]